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 (3); paint.setStyle (Paint.Style.FILL); RectF r = new RectF (); float t, x, y; t = GetAnimScalar (25, 500); canvas.translate (320, 240); for (int i = 0; i < 35; i++) { paint.setColor (unchecked((int)0xFFF00FF0 - i * 0x04000000)); double step = Math.PI / (55 - i); double angle = t * step; x = (20 + i * 5) * (float)Math.Sin (angle); y = (20 + i * 5) * (float)Math.Cos (angle); r.set (x, y, x + 10, y + 10); canvas.drawRect (r, paint); } }
protected override void onDraw (Canvas canvas) { Paint paint = new Paint (); canvas.translate (10, 10); canvas.drawColor (Color.WHITE); paint.setColor (Color.RED); paint.setStrokeWidth (0); canvas.drawLines (mPts, paint); paint.setColor (Color.BLUE); paint.setStrokeWidth (3); canvas.drawPoints (mPts, paint); }
// create a bitmap with a rect, used for the "src" image static Bitmap makeSrc (int w, int h) { Bitmap bm = Bitmap.createBitmap (w, h, Bitmap.Config.ARGB_8888); Canvas c = new Canvas (bm); Paint p = new Paint (Paint.ANTI_ALIAS_FLAG); p.setColor (unchecked((int)0xFF66AAFF)); c.drawRect (w / 3, h / 3, w * 19 / 20, h * 19 / 20, p); return bm; }
// create a bitmap with a circle, used for the "dst" image static Bitmap makeDst (int w, int h) { Bitmap bm = Bitmap.createBitmap (w, h, Bitmap.Config.ARGB_8888); Canvas c = new Canvas (bm); Paint p = new Paint (Paint.ANTI_ALIAS_FLAG); p.setColor (unchecked((int)0xFFFFCC44)); c.drawOval (new RectF (0, 0, w * 3 / 4, h * 3 / 4), p); return bm; }
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); }
protected override void onDraw (Canvas canvas) { canvas.drawColor (Color.WHITE); Paint p = new Paint (); float y = 10; p.setColor (Color.RED); canvas.drawBitmap (mBitmap, 10, y, p); y += mBitmap.getHeight () + 10; canvas.drawBitmap (mBitmap2, 10, y, p); y += mBitmap2.getHeight () + 10; p.setShader (mShader); canvas.drawBitmap (mBitmap3, 10, y, p); }
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 (3); paint.setStyle (Paint.Style.FILL); RectF r = new RectF (10, 10, 110, 110); for (int i = 0; i < 256; ++i) { canvas.translate (1, 1); paint.setColor ((int)(0xFF000000 + i * 0x00010000)); canvas.drawRect (r, paint); } }
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 (); }
///** // * Instantiates a new circular seek bar. // * // * @param context // * the context // * @param attrs // * the attrs // * @param defStyle // * the def style // */ //public CircularSeekBar(Context context, AttributeSet attrs, int defStyle) { // //super(context, attrs, defStyle); // mContext = context; // //initDrawable(); //} ///** // * Instantiates a new circular seek bar. // * // * @param context // * the context // * @param attrs // * the attrs // */ //public CircularSeekBar(Context context, AttributeSet attrs) { // //super(context, attrs); // mContext = context; // //initDrawable(); //} /** * Instantiates a new circular seek bar. * * @param context * the context */ public CircularSeekBar(Context context) { //super(context); mContext = context; circleColor = new Paint(); innerColor = new Paint(); circleRing = new Paint(); circleColor.setColor(Color.parseColor("#ff33b5e5")); // Set default // progress // color to holo // blue. innerColor.setColor(Color.BLACK); // Set default background color to // black circleRing.setColor(Color.GRAY);// Set default background color to Gray circleColor.setAntiAlias(true); innerColor.setAntiAlias(true); circleRing.setAntiAlias(true); circleColor.setStrokeWidth(5); innerColor.setStrokeWidth(5); circleRing.setStrokeWidth(5); circleColor.setStyle(Paint.Style.FILL); //initDrawable(); }
protected override void onDraw(Canvas canvas) { Paint paint = new Paint(); paint.setStyle(Paint.Style.STROKE); paint.setColor(Color.RED); paint.setTextSize(30); canvas.drawText(text, 10, 60, paint); base.onDraw(canvas); }