If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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

Native Development

Reply
Developer
dbigham
Posts: 492
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA
Accepted Solution

How to modify the Gesture sample application to load a different picture after initial load

The "Gesture" sample app is a good start for me, since I want to load and display an image full screen.

 

However, my app needs to change the image that is being displayed later on.

 

I have been successful at loading the new JPEG image via:

 

...

io_stream_t* memory_stream = io_open(IO_MEM, IO_READ, num_jpeg_bytes, jpeg_bytes);

rc = img_load(ilib, memory_stream, &callouts, &img);

...

 

... but the new image isn't displayed on the screen.  I'm assuming this is because the decode_setup function that is used to load the image on initial load doesn't work for subsequently changing the image, but I'm not sure how it needs to be changed.

 

I've read:

 

https://bdsc.webapps.blackberry.com/native/reference/com.qnx.doc.libimg.lib_ref/com.qnx.doc.libimg.l...

 

... but it doesn't seem to tell me anything more than I already know.

 

I suppose the question is this: If you load an image into an img_t structure, how do you then take that img_t and update the screen to display that image full screen?

 

Thanks!

Daniel

Please use plain text.
BlackBerry Development Advisor (Retired)
jenear
Posts: 1
Registered: ‎10-26-2011
My Device: Torch 9810
My Carrier: Rogers

Re: How to modify the Gesture sample application to load a different picture after initial load

Hi Daniel,

 

The decode_setup callout provided should successfully load any subsequential images into the render buffer. However this alone will not display the image on the screen. You will need to call screen_post_window() after your call to img_load to make your changes to the render buffer visible.

 

See: 

https://bdsc.webapps.blackberry.com/native/reference/com.qnx.doc.screen.lib_ref/topic/rscreen_post_w... 

for more information, or the main() function of the Gestures sample for an example.

 

Regards,

Jeff

Please use plain text.