static void drawCentered (Canvas c, Rect r, Paint p) { float inset = p.getStrokeWidth () * 0.5f; if (inset == 0) { // catch hairlines inset = 0.5f; } c.drawRect (r.left + inset, r.top + inset, r.right - inset, r.bottom - inset, p); }
public RoundRects (Context context) : base (context) { mRect = new Rect (0, 0, 120, 120); int[] colors = { unchecked((int)0xFFFF0000), unchecked((int)0xFF00FF00), unchecked((int)0xFF0000FF) }; mDrawable = new GradientDrawable (GradientDrawable.Orientation.TL_BR, colors); mDrawable.setShape (GradientDrawable.RECTANGLE); mDrawable.setGradientRadius ((float)(Math.Sqrt (2) * 60)); }
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); }
public override void draw(Canvas canvas) { Rect bounds = Bounds; int height = bounds.height(); paint.TextSize = height; Rect textBounds = new Rect(); string textValue = icon.character().ToString(); paint.getTextBounds(textValue, 0, 1, textBounds); int textHeight = textBounds.height(); float textBottom = bounds.top + (height - textHeight) / 2f + textHeight - textBounds.bottom; canvas.drawText(textValue, bounds.exactCenterX(), textBottom, paint); }
public bool requestChildRectangleOnScreen (View child, Rect rectangle, bool immediate) { return false; }
public bool getChildVisibleRect (View child, Rect r, Point offset) { throw new NotImplementedException (); }
public ViewParent invalidateChildInParent (int[] location, Rect r) { XobotActivityManager.RequestInvalidate (this); return null; }
public void invalidateChild (View child, Rect r) { XobotActivityManager.RequestInvalidate (this); }
public Canvas lockCanvas(Rect inOutDirty) { throw null; }