Code example for Bitmap

Methods: copygetConfiggetHeightgetWidth

0
            Log.e("Current Degree", this.currentDegree + "");
            rotateX((int) (futureRotateEnd));
        } else { 
            this.setDrawingCacheEnabled(true);
            Bitmap b = this.getDrawingCache();
            Bitmap newBm = b.copy(b.getConfig(), true);
            Dialog d = new Dialog(this.getContext());
            ImageView v = new ImageView(getContext());
            v.setImageBitmap(newBm);
 
            d.addContentView(v, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
            d.show();
            this.setDrawingCacheEnabled(false);
            this.setImageBitmap(newBm);
            Log.e("Rotate", "Done rotating " + currentDegree + " " + currentRotateEnd + " " + futureRotateEnd);
 
            this.currentRotateEnd = 0;
            this.futureRotateEnd = 0;
            this.setAnimation(null);
 
            // ((View) this.getParent()).invalidate(); 
        } 
    } 
 
    @Override 
    public void onAnimationRepeat(Animation animation) {
        // Nothing 
    } 
 
    @Override 
    public void onAnimationStart(Animation animation) {
        Log.e("Rotating", "Starting rotate");
        this.isRotating = true;
 
    } 
 
    @Override 
    public void setImageBitmap(Bitmap b) {
        super.setImageBitmap(b);
        this.bitmap = b;
        setDimensions(); 
    } 
 
    @Override 
    public void setImageResource(int res) {
        super.setImageResource(res);
        this.bitmap = BitmapFactory.decodeResource(getResources(), res);
        setDimensions(); 
    } 
 
    @Override 
    public void setImageDrawable(Drawable d) {
        super.setImageDrawable(d);
        this.bitmap = Bitmap.createBitmap(d.getIntrinsicWidth(), d.getIntrinsicHeight(), Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        d.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
        d.draw(canvas);
        setDimensions(); 
    } 
 
    private void setDimensions() { 
        this.width = bitmap.getWidth();
        this.height = bitmap.getHeight();
    } 
}