This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Some question about using E2DSurfaceRGBA or E2DSurface ?


Some question about using E2DSurfaceRGBA or E2DSurface ?

Postby mamahow » Sep 25, 2008 @ 2:40pm

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!
mamahow
pm Member
 
Posts: 17
Joined: Jul 1, 2008 @ 10:29am


Postby edge » Sep 26, 2008 @ 2:24pm

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.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby mamahow » Oct 2, 2008 @ 8:04am

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
mamahow
pm Member
 
Posts: 17
Joined: Jul 1, 2008 @ 10:29am


Postby edge » Oct 3, 2008 @ 3:49pm

EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby mamahow » Oct 3, 2008 @ 5:18pm

mamahow
pm Member
 
Posts: 17
Joined: Jul 1, 2008 @ 10:29am


Postby edge » Oct 7, 2008 @ 11:02am

EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron