Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Raiden
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified
Accepted Solution

Cut bitmap given height and width

Hello guys'

I need to cut bitmap by parameters that given height and width.

Is there any sample code ?

Plz help me guys'

Please use plain text.
Developer
richard_puckett
Posts: 191
Registered: ‎04-03-2008
My Device: Bold 9700

Re: Cut bitmap given height and width

By "cut" do you mean "crop"?

 

public Bitmap cropTo(Bitmap src, int newWidth, int newHeight) { Bitmap cropped = new Bitmap(newWidth, newHeight); Graphics croppedGraphics = new Graphics(cropped); croppedGraphics.drawBitmap(0, 0, newWidth, newHeight, src, 0, 0); return cropped; }

 

Please use plain text.
Developer
Raiden
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified

Re: Cut bitmap given height and width

Yes. Tnx a lot for your response.
Please use plain text.