public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("Region["); bool first = true; using (RegionIterator iter = new RegionIterator(this)) { Rect r = new Rect(); while (iter.next(r)) { string text = String.Format( "[{0},{0},{0},{0}]", r.left, r.top, r.right, r.bottom); if (first) { first = false; } else { sb.Append(","); } sb.Append(text); } } sb.Append("]"); return(sb.ToString()); }
public override string ToString () { StringBuilder sb = new StringBuilder (); sb.Append ("Region["); bool first = true; using (RegionIterator iter = new RegionIterator (this)) { Rect r = new Rect (); while (iter.next (r)) { string text = String.Format ( "[{0},{0},{0},{0}]", r.left, r.top, r.right, r.bottom); if (first) first = false; else sb.Append (","); sb.Append (text); } } sb.Append ("]"); return sb.ToString (); }
void drawRgn (Canvas canvas, int color, String str, Region.Op op) { if (str != null) { mPaint.setColor (Color.BLACK); canvas.drawText (str, 80, 24, mPaint); } Region rgn = new Region (); rgn.set (mRect1); rgn.op (mRect2, op); mPaint.setColor (color); RegionIterator iter = new RegionIterator (rgn); Rect r = new Rect (); canvas.translate (0, 30); mPaint.setColor (color); while (iter.next(r)) { canvas.drawRect (r, mPaint); } drawOriginalRects (canvas, 0x80); }