Code example for Matrix

Methods: createBitmappreScale

0
     * @param src 元となる画像。 
     * @param gap 元画像と反射エフェクト間の距離。 
     * @return 成功時は Bitmap インスタンス。それ以外は null 参照。 
     */ 
    protected Bitmap makeReflectedImage(Bitmap src, int gap) {
        Matrix matrix = new Matrix();
        matrix.preScale(1, -1);
 
        int width = src.getWidth();
        int height = src.getHeight();
        int destHeight = height + height / 2;
        Bitmap effect = Bitmap.createBitmap(src, 0, height / 2, width, height / 2, matrix, false);
//        Bitmap dest = Bitmap.createBitmap(width, destHeight, Config.ARGB_4444); 
        Bitmap dest = Bitmap.createBitmap(width, destHeight, Config.ARGB_8888);
        Canvas canvas = new Canvas(dest);
 
        canvas.drawBitmap(src, 0, 0, null);
        canvas.drawRect(0, height, width, height + gap, new Paint());
        canvas.drawBitmap(effect, 0, height + gap, null);
 
Stop searching for code, let great code find you!  Add Codota to your java IDE