Page 1 of 1

Some question about using E2DSurfaceRGBA or E2DSurface ?

PostPosted: Sep 25, 2008 @ 2:40pm
by mamahow
Hi,
1)
I've checked the Q&A in the forum about releasing buffer that is created by "E2DSurfaceRGBA()" or "E2DSurface()", you said we DON'T need to free it when the image is identical. But, I also checked someone said we need to use surface->Free() to free unused buffer. What's the correct usage for using CreateSurface()?

2)
We wanna load image (using creaeSurface)so many times(to avoid image crash when resizing image).
But it's really heavy loading when we use createSurface so many times, do you have good suggestion to use createSurface in many times?

Thanks!

PostPosted: Sep 26, 2008 @ 2:24pm
by edge
Hi,

In most programs you don't call Free(), you just call CreateSurface (also on existing surfaces). When calling CreateSurface on an existing surface, this is the EDGELIB behaviour:
- If the dimensions (width/height) is the same, call Clear() on the surface before loading data
- If the dimensions are different, call Free() on the surface

This is all handled internally, as a developer you don't need to worry about it. An example where calling Free() yourself could be useful:
When exiting the game, free in-game resources before loading logo's, backdrop's, etc. for the end-of-game screen (for example, an advertisement banner). This decreases memory usage.

PostPosted: Oct 2, 2008 @ 8:04am
by mamahow
Hi,

If we want to resize the surface in many times with non-proportional scale (we can only use BltFast).
We found that the image is screwed up after resize so many times.
So, we choose to createSurface again and again to prevent this issue.
But createSurface spent 0.3s in every function call.(we have +10 images)
Can you kindly suggest us a good way to perform resize action on image? or any other good idea to load surface in efficient way?

MAMAHOW

PostPosted: Oct 3, 2008 @ 3:49pm
by edge

PostPosted: Oct 3, 2008 @ 5:18pm
by mamahow

PostPosted: Oct 7, 2008 @ 11:02am
by edge