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
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified
Accepted Solution

Emboss algorithm in BlackBerry?

Hello,

 

        Any one have a Emboss Algorithem if possible then given me idea or code .

 

Thanks.

Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Emboss algorithm in BlackBerry?

[ Edited ]

I note that you have looked at the code given here:

http://supportforums.blackberry.com/t5/Java-Development/Emboss-image-effect/m-p/1669915#M196433

 

I have had a chance to look at this code now.

 

The code in the Thread appears to be an implementation of the source from the following link (and uses the "Convolution Matrix").  :

 

http://xjaphx.wordpress.com/2011/06/22/image-processing-convolution-matrix/

 

Unfortunately, the implementation is not correct, in fact it is wrong in a number of places.  But despite a suggestion to debug the code,

(http://supportforums.blackberry.com/t5/Java-Development/Emboss-image-effect/m-p/1659449)

the OP appeared to have no intention of looking hard at the code himself, but asked a number of similar questions on and off the forum:

http://stackoverflow.com/questions/10023303/apply-emboss-and-sketch-effect-to-bitmap-in-blackberry

 

In fact, I think the code supplied in the link can be used - I have managed to implement this code and it seems to be working.  When compared with the supplied implementation, the changes I made to get the code working were not tricky, if you spent the time understanding what the code was doing and how get/setargb work, I suspect you could fix it too. 

 

To demonstrate I got it working, here is the link showing a number of image manipulations, including emboss:

http://xjaphx.wordpress.com/2011/06/22/

and attached is screen shot from a BlackBerry 9800 Simulator showing emboss: 

 

So have a look at the implementation supplied by the OP, review the Android code from the link above, correct the code as necessary and give it a shot,

 

Good luck.

Developer
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: Emboss algorithm in BlackBerry?

Hi,peter_strange

 

            I try it and resloved error but now there are no get the output same as a Emboss.So i attached code so check it out and if any problem then told me.

 

           I am waiting for your reply .

 

Thanks.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Emboss algorithm in BlackBerry?

Only had a very quick look, but these lines look wrong to me:

 

A = pixels[q][r] >> 24;
R = pixels[q][r] >> 16;
G = pixels[q][r] >> 8;
B = pixels[q][r];

 

Remove A from here, you don't need it in this loop.

 

The others should be anded with 0xFF, for example:

 

R = (pixels[q][r] >> 16) & 0xFF;

 

I would also change this:

A = pixels[1][1] >> 24;

to

A = pixels[1][1] & 0xFF000000;

 

Then use it later:

arb[y * width + x] = A | R << 16 | G << 8 | B);

Hope this helps.