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
Trusted Contributor
bbdev12345
Posts: 117
Registered: ‎09-06-2011
My Device: 9900
My Carrier: myself
Accepted Solution

locateDifference problem

[ Edited ]

Hi,

 

I have been struggling with some simple code for a couple of days and ended up switching to getting the pixels of 2 bitmaps in int[] array just to compare certain areas of images. I can't get locateDifference to do it. Could someone tell me if my code is ok or not,

 

I can't understand why if I get the pixel data and compare the arrays (commented out code) I get correct results but locateDifference always tells me there equal.

 

/* this works	pixs = new int[w*h];
																bit22.getARGB(pixs, 0, w, offsetX, offsetY, w, h);
																pixs2 = new int[w*h];
																lastBitmap.getARGB(pixs2, 0, w, offsetX, offsetY, w, h);
																b = ArrayComparison(pixs, pixs2);
															*/
															  rect2 = new XYRect(0,0,w,h);
														bit22.locateDifference(rect2,lastBitmap, offsetX, offsetY);
															}
															
															if((rect2.x > 0) || (rect2.y > 0))
															{

//never any difference

}

 

Please use plain text.
Trusted Contributor
bbdev12345
Posts: 117
Registered: ‎09-06-2011
My Device: 9900
My Carrier: myself

Re: locateDifference problem

passing the correct arguments to XYRect constructor fixed my problem!

Please use plain text.
Developer
peter_strange
Posts: 19,595
Registered: ‎07-14-2008
My Device: Not Specified

Re: locateDifference problem

Excellent, can you mark this as solved then - instructions in Help Link near top of screen in you need them.

Please use plain text.