public AlphaBitmap (Context context) : base (context) { mBitmap = GetResourceBitmap (R.drawable.app_sample_code); mBitmap2 = mBitmap.extractAlpha (); mBitmap3 = Bitmap.createBitmap (200, 200, Bitmap.Config.ALPHA_8); drawIntoBitmap (mBitmap3); mShader = new LinearGradient (0, 0, 100, 70, new int[] { Color.RED, Color.GREEN, Color.BLUE }, null, Shader.TileMode.MIRROR); }
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); }
public Xfermodes (Context context) : base (context) { mSrcB = makeSrc (W, H); mDstB = makeDst (W, H); // make a ckeckerboard pattern int[] colors = new int[] { unchecked((int)0xFFFFFFFF), unchecked((int)0xFFCCCCCC), unchecked((int)0xFFCCCCCC), unchecked((int)0xFFFFFFFF) }; Bitmap bm = Bitmap.createBitmap (colors, 2, 2, Bitmap.Config.RGB_565); mBG = new BitmapShader (bm, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); Matrix m = new Matrix (); m.setScale (6, 6); mBG.setLocalMatrix (m); }
public BitmapMesh (Context context) : base (context) { mBitmap = GetResourceBitmap (R.drawable.beach); float w = mBitmap.getWidth (); float h = mBitmap.getHeight (); // construct our mesh int index = 0; for (int y = 0; y <= HEIGHT; y++) { float fy = h * y / HEIGHT; for (int x = 0; x <= WIDTH; x++) { float fx = w * x / WIDTH; setXY (mVerts, index, fx, fy); setXY (mOrig, index, fx, fy); index += 1; } } mMatrix.setTranslate (10, 10); mMatrix.invert (mInverse); }
public ColorMatrixSample (Context context) : base (context) { mBitmap = GetResourceBitmap (R.drawable.balloons); }
public static Bitmap createScaledBitmap(Bitmap src, int dstWidth, int dstHeight, bool filter) { return default(Bitmap); }