forum

Home / DeveloperSection / Forums / Android bitmap with border

Android bitmap with border

Anonymous User 5070 29-May-2013
Hi Guys,

I have this function, with this function I can show an image with a little rotation. I'm trying to display a white border arround the bitmap.

Matrix m = new Matrix();
        m.postRotate( rotation, center.x, center.y );
        m.postTranslate( ( position.x - center.x ) - xOffset , position.y - ( center.x ) );
        //  set the current position to the updated position
        positionMatrix.set( m );            
        renderAnimation();          
        c.drawBitmap( this.bitmap , positionMatrix, paint );

I'm trying to add the white border with this function: reference: stackoverflow border

    RectF targetRect = new RectF(left+10, top+10, left + scaledWidth, top + scaledHeight);
    Bitmap dest = Bitmap.createBitmap(this.bitmap.getWith() +20, this.bitmap.getHeight() +20, this.bitmap.getConfig());
    Canvas canvas = new Canvas(dest);
    canvas.drawColor(Color.WHITE);
    canvas.drawBitmap(this.bitmap, null, targetRect, null);
c.drawBitmap( this.bitmap , positionMatrix, paint );
But, not works, can some help me.

Thanks 

Updated on 30-May-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By