public drawBitmap ( android arg0, android arg1, android arg2 ) : void | ||
arg0 | android | |
arg1 | android | |
arg2 | android | |
return | void |
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) { Paint paint = mPaint; float x = 20; float y = 20; canvas.drawColor (Color.WHITE); paint.setColorFilter (null); canvas.drawBitmap (mBitmap, x, y, paint); ColorMatrix cm = new ColorMatrix (); mAngle += 2; if (mAngle > 180) { mAngle = 0; } //convert our animated angle [-180...180] to a contrast value of [-1..1] float contrast = mAngle / 180.0f; setContrast (cm, contrast); paint.setColorFilter (new ColorMatrixColorFilter (cm)); canvas.drawBitmap (mBitmap, x + mBitmap.getWidth () + 10, y, paint); setContrastScaleOnly (cm, contrast); paint.setColorFilter (new ColorMatrixColorFilter (cm)); canvas.drawBitmap (mBitmap, x, y + mBitmap.getHeight () + 10, paint); setContrastTranslateOnly (cm, contrast); paint.setColorFilter (new ColorMatrixColorFilter (cm)); canvas.drawBitmap (mBitmap, x, y + 2 * (mBitmap.getHeight () + 10), paint); }
protected override void onDraw (Canvas canvas) { canvas.drawColor (Color.WHITE); Paint labelP = new Paint (Paint.ANTI_ALIAS_FLAG); labelP.setTextAlign (Paint.Align.CENTER); Paint paint = new Paint (); paint.setFilterBitmap (false); canvas.translate (15, 35); int x = 0; int y = 0; for (int i = 0; i < sModes.Length; i++) { // draw the border paint.setStyle (Paint.Style.STROKE); paint.setShader (null); canvas.drawRect (x - 0.5f, y - 0.5f, x + W + 0.5f, y + H + 0.5f, paint); // draw the checker-board pattern paint.setStyle (Paint.Style.FILL); paint.setShader (mBG); canvas.drawRect (x, y, x + W, y + H, paint); // draw the src/dst example into our offscreen bitmap int sc = canvas.saveLayer (x, y, x + W, y + H, null, Canvas.MATRIX_SAVE_FLAG | Canvas.CLIP_SAVE_FLAG | Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | Canvas.FULL_COLOR_LAYER_SAVE_FLAG | Canvas.CLIP_TO_LAYER_SAVE_FLAG); canvas.translate (x, y); canvas.drawBitmap (mDstB, 0, 0, paint); paint.setXfermode (sModes [i]); canvas.drawBitmap (mSrcB, 0, 0, paint); paint.setXfermode (null); canvas.restoreToCount (sc); // draw the label canvas.drawText (sLabels [i], x + W / 2, y - labelP.getTextSize () / 2, labelP); x += W + 10; // wrap around when we've drawn enough for one row if ((i % ROW_MAX) == ROW_MAX - 1) { x = 0; y += H + 30; } } }