diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2017-01-05 15:47:33 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2017-01-05 15:47:33 +0100 |
| commit | 49346012274739fd39745f9e035ee8853149bc73 (patch) | |
| tree | b8757165c6b31a6d08b7caad2118ed76f463c287 /src/Rectangles.cs | |
| parent | 9c0f77e860a1852ee7de381a82118e6d8c7fb819 (diff) | |
| parent | 40b16003066ad42604fd82dc0eec9cfa0a4abeca (diff) | |
Merge branch 'master' into CrowIDE
Diffstat (limited to 'src/Rectangles.cs')
| -rw-r--r-- | src/Rectangles.cs | 107 |
1 files changed, 4 insertions, 103 deletions
diff --git a/src/Rectangles.cs b/src/Rectangles.cs index 5168f3db..965b28c3 100644 --- a/src/Rectangles.cs +++ b/src/Rectangles.cs @@ -35,7 +35,7 @@ namespace Crow return false; return true; } - + public bool intersect(Rectangle r) { foreach (Rectangle rInList in list) @@ -43,102 +43,10 @@ namespace Crow return true; return false; } - - public Rectangles intersectingRects(Rectangle r) - { - Rectangles tmp = new Rectangles(); - - foreach (Rectangle rInList in list) - if (rInList.Intersect(r)) - tmp.list.Add(rInList);//on bypass le test déjà fait a l'ajout intial du rect dans la liste - - return tmp; - } - public Rectangles SmallerContainedRects(Rectangle r) - { - Rectangles tmp = new Rectangles(); - - foreach (Rectangle rInList in list) - if (r.ContainsOrIsEqual(rInList) && rInList.Size < r.Size) - tmp.list.Add(rInList); - - return tmp; - } - /// <summary> - /// Return rectangles with size smaller than r.size - /// </summary> - public Rectangles SmallerRects(Rectangle r) - { - Rectangles tmp = new Rectangles(); - - foreach (Rectangle rInList in list) - if (rInList.Size < r.Size) - tmp.list.Add(rInList); - - return tmp; - } - public Rectangles containedOrEqualRects(Rectangle r) - { - Rectangles tmp = new Rectangles(); - - foreach (Rectangle rInList in list) - if (r.ContainsOrIsEqual(rInList))// && rInList.Size <= r.Size) - tmp.list.Add(rInList); - - return tmp; - } - public void Srcoll(GraphicObject w) - { - Scroller sw = w as Scroller; - if (sw == null) - return; - - List<Rectangle> newList = new List<Rectangle>(); - - foreach (Rectangle rInList in list) - { - Rectangle r = rInList; - - if (sw.VerticalScrolling) - r.Top -= (int)sw.ScrollY; - if (sw.HorizontalScrolling) - r.Left -= (int)sw.ScrollX; - - newList.Add(r); - } - list = newList; - } - public void Rebase(GraphicObject w) - { - Rectangle r = w.Parent.ContextCoordinates(w.Slot); - List<Rectangle> newList = new List<Rectangle>(); - - foreach (Rectangle rInList in list) - { - Rectangle rebasedR = rInList; - rebasedR.TopLeft-= r.TopLeft; - - Scroller sw = w as Scroller; - if (sw != null) - { - if (sw.VerticalScrolling) { - rebasedR.Top -= (int)sw.ScrollY; -// if (sw.scrollY < 0) -// Debug.WriteLine (".."); - }if (sw.HorizontalScrolling) - rebasedR.Left -= (int)sw.ScrollX; - } - - newList.Add(rebasedR); - } - list = newList; - } public void stroke(Context ctx, Color c) { foreach (Rectangle r in list) - { ctx.Rectangle(r); - } ctx.SetSourceColor(c); @@ -153,17 +61,15 @@ namespace Crow ctx.Rectangle(r); ctx.ClipPreserve(); - ctx.Operator = Operator.Clear; + ctx.Operator = Operator.Clear; ctx.Fill(); - ctx.Operator = Operator.Over; + ctx.Operator = Operator.Over; } public void clip(Context ctx) { foreach (Rectangle r in list) - { - ctx.Rectangle(r); - } + ctx.Rectangle(r); ctx.Clip(); } @@ -187,16 +93,11 @@ namespace Crow } public void clear(Context ctx) { - //ctx.Save(); - foreach (Rectangle r in list) - { ctx.Rectangle(r); - } ctx.Operator = Operator.Clear; ctx.Fill(); ctx.Operator = Operator.Over; - //ctx.Restore(); } public override string ToString () { |