PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Simply displaying an image

Hi..

From what I have read on all these posts, it seems as if displaying images is done only through CGapiSurface.CreateSurface()...

Is this the function that should be used when displaying several images (png, bmp, etc) on the screen at a time?

A broader question i have... Is a surface something that can be layered on top of other surfaces, resulting in a final image being produced (like layers in photoshop)? Or is the surface itself the final image that is displayed on the screen?

Basically, i'm having trouble just displaying images on the smartphone... im not sure which function to use. the surface class has draw functions for rectangles, lines, and pixels.. how come there's no draw function that places a certain image resource at a certain location? It doesnt really make sense that createSurface is the only way to display an image file...

Any help would be greatly appreciated...
-Gee
CreateSurface allows you to generate a graphical surface that you then 'blt' to the backbuffer (or another surface) via Blt or BltFast. CreateSurface in and of itself does not display the created surface. Surfaces can be 'layered' as you suggest to create a final image.

I'd recommend working with the supplied Simple project to get a feel for using the above methods.
Well CreateSurfuce does not display an image.

You have to create a surface with this function and then display it with backbuffer.BltFast
You may want to have a look at:

http://www.pocketmatrix.com/forums/viewtopic.php?t=12015&highlight;=blit+surface+another

This is a post that someone else made a few days ago, both ppcStudios and I replied and I think it may clarify things for you a bit as well.
mlepage · 03 Aug 2003, 03:39 UTC — Creating an image
Basically, three steps:

First, create the C++ object that will hold the surface:

CGapiSurface image;

Second, load the image into that C++ object by calling a member function:

image.CreateSurface(0, _T("image.png"));

Now, to actually display the image on the screen, you need to "blit" (copy) it to another surface that represents the screen. For example, if you look in the samples, the application MyApplication has a member function ProcessNextFrame which has a CGapiSurface parameter named backbuffer. If you blit your image to the backbuffer, when ProcessNextFrame exits the backbuffer will be copied to the video screen, and you will see your image.