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
babygodzilla
Posts: 275
Registered: ‎03-10-2009
My Device: Not Specified

draw an Image object on a Screen?

Hi,

 

Can someone teach me how to draw an Image object on a Screen? I've read many documentations and have yet to find a way.

 

Thanks!

Developer
babygodzilla
Posts: 275
Registered: ‎03-10-2009
My Device: Not Specified

Re: draw an Image object on a Screen?

actually what i really meant was draw an Image object in a UiApplication. thanks!

Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: draw an Image object on a Screen?

Can you give an example? You question is not very specific.

 

An image, in the form of an image file such as a png or bmp, can be added to a BitmapField and this field can be added to your screen, just like any other field object.

 

But I suspect that this is not your question.

 

Developer
babygodzilla
Posts: 275
Registered: ‎03-10-2009
My Device: Not Specified

Re: draw an Image object on a Screen?

hi. you're right, that is not what I meant. I don't mean a jpeg or a gif or a png per se. i said an Image object, as in javax.microedition.lcdui.Image object. is there a way to draw that object onto a UiApplication?
Developer
Developer
rab
Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified

Re: draw an Image object on a Screen?

Look at the graphics methods such as :

 

drawImage(int x, int y, int width, int height, EncodedImage image, int frameIndex, int left, int top)
          Draws an encoded image.

 

 

Rab

Developer
babygodzilla
Posts: 275
Registered: ‎03-10-2009
My Device: Not Specified

Re: draw an Image object on a Screen?

hi,

 

sorry, i'm not sure how that can help. I've checked the documentation for EncodedImage back and forth, and there is no way to convert an javax.microedition.lcdui.Image to an EncodedImage. Can you help on that part?

 

Thanks

Developer
Developer
rab
Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified

Re: draw an Image object on a Screen?

Then you must be using the javax.microedition.lcdui  Graphics class.

In this case you use :

 

drawImage(Image img, int x, int y, int anchor)

 

Where Image is javax.microedition.lcdui.Image

 

Rab