public drawCircle ( float arg0, float arg1, float arg2, android arg3 ) : void | ||
arg0 | float | |
arg1 | float | |
arg2 | float | |
arg3 | android | |
return | void |
protected override void onDraw (Canvas canvas) { canvas.drawColor (Color.WHITE); canvas.translate (10, 10); canvas.saveLayerAlpha (0, 0, 200, 200, 0x88, LAYER_FLAGS); mPaint.setColor (Color.RED); canvas.drawCircle (75, 75, 75, mPaint); mPaint.setColor (Color.BLUE); canvas.drawCircle (125, 125, 75, mPaint); canvas.restore (); }
protected override void onDraw(Canvas canvas) { canvas.drawColor(Color.YELLOW); int width = canvas.getWidth(); int height = canvas.getHeight(); Paint paint = new Paint(); paint.setColor(Color.RED); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(10); canvas.drawCircle(width / 2, height / 2, height / 3, paint); Paint inner = new Paint(); paint.setColor(Color.GREEN); paint.setStyle(Paint.Style.FILL); canvas.drawCircle(width / 2, height / 2, height / 3 - 10, inner); Paint text = new Paint(); text.setTextSize(20); canvas.drawText("I am a Xobot Monkey!", width / 8, height / 8, text); }
void drawScene (Canvas canvas) { canvas.clipRect (0, 0, 100, 100); canvas.drawColor (Color.WHITE); mPaint.setColor (Color.RED); canvas.drawLine (0, 0, 100, 100, mPaint); mPaint.setColor (Color.GREEN); canvas.drawCircle (30, 70, 30, mPaint); mPaint.setColor (Color.BLUE); canvas.drawText ("Clipping", 100, 30, mPaint); }
static void drawIntoBitmap (Bitmap bm) { float x = bm.getWidth (); float y = bm.getHeight (); Canvas c = new Canvas (bm); Paint p = new Paint (); p.setAntiAlias (true); p.setAlpha (0x80); c.drawCircle (x / 2, y / 2, x / 2, p); p.setAlpha (0x30); p.setXfermode (new PorterDuffXfermode (PorterDuff.Mode.SRC)); p.setTextSize (60); p.setTextAlign (Paint.Align.CENTER); Paint.FontMetrics fm = p.getFontMetrics (); c.drawText ("Alpha", x / 2, (y - fm.ascent) / 2, p); }
protected override void onDraw (Canvas canvas) { canvas.drawColor (unchecked((int)0xFFDDDDDD)); canvas.save (); Paint paint = new Paint (); paint.setColor (Color.BLUE); MaskFilter mf = new BlurMaskFilter (128, BlurMaskFilter.Blur.NORMAL); paint.setMaskFilter (mf); mf.Dispose (); canvas.translate (200, 200); canvas.drawCircle (100, 100, 200, paint); canvas.restore (); paint.Dispose (); }
protected override void onDraw (Canvas canvas) { canvas.drawColor (unchecked((int)0xFFDDDDDD)); Paint paint = new Paint (); paint.setAntiAlias (true); paint.setStyle (Paint.Style.STROKE); paint.setStrokeWidth (10); EmbossMaskFilter mf = new EmbossMaskFilter (new float[] { 1, 1, 1 }, 128, 16 * 2, 4); paint.setMaskFilter (mf); mf.Dispose (); // paint.setMaskFilter(new SkEmbossMaskFilter(fLight, SkIntToScalar(4)))->unref(); // paint.setShader(new SkColorShader(SK_ColorBLUE))->unref(); paint.setDither (true); canvas.drawCircle (50, 50, 30, paint); paint.Dispose (); }