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
Regular Contributor
pankaj_pradeep
Posts: 88
Registered: ‎04-09-2010
My Device: 9530
My Carrier: Software Developer
Accepted Solution

Cropping of image

Hi all i want to crop a part of Image ,for that i am using following code: int x=20; int y=50; int [] rgbdata=new int[(0+width-x+height-y)* (image.getWidth())]; image.getARGB(rgbdata, 0, image.getWidth(), x, y, width, height); cropedImage=new Bitmap(image.getWidth(),image.getWidth()); cropedImage.setARGB(rgbdata, 0,image.getWidth(), 80,80, width, height); x an y are the position from where the cropping will be done in the rectangular form. but it is not working can any one help me out please. any sample code will work for me. its urgent. thanks in advance
Please use plain text.
Regular Contributor
pankaj_pradeep
Posts: 88
Registered: ‎04-09-2010
My Device: 9530
My Carrier: Software Developer

Re: Cropping of image

Hi all i want to crop a part of Image ,for that i am using following code: int x=20; int y=50; int [] rgbdata=new int[(0+width-x+height-y)* (image.getWidth())]; image.getARGB(rgbdata, 0, image.getWidth(), x, y, width, height); cropedImage=new Bitmap(image.getWidth(),image.getWidth()); cropedImage.setARGB(rgbdata, 0,image.getWidth(), 80,80, width, height); x an y are the position from where the cropping will be done in the rectangular form. but it is not working can any one help me out please. any sample code will work for me. its urgent. thanks in advance
Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Cropping of image

Have you tried using a Graphics object?

 

Just doing a straight convertion of your code:

int x = 20;
int y = 50;
cropedImage = new Bitmap(image.getWidth(), image.getWidth());
Graphics g = new Graphics(cropedImage);
g.drawBitmap(80, 80, width, height, image, x, y);

 You might want to try "new Bitmap(image.getWidth(), image.getHeight());"

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Contributor
jayachandrap
Posts: 18
Registered: ‎11-10-2010
My Device: Not Specified

Re: Cropping of image

can u plz give me the solution for how to crop image according to touch event ??

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Cropping of image

Please create a new post and explain with more detail.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.