Page 1 of 1

how to render image

PostPosted: Feb 2, 2009 @ 9:02am
by akabeer1983
Hi,
i am new to EDGElib, i tried to load and render an image using sample code, provided in the topic: " need help to draw png image" in this forum.
____________________________________________

E2DSurface titlebg;
SetRect(&rc, 0, 0, buffer->GetWidth(), 50);
buffer->FillRect(&rc, E_RGBX(0, 255, 0));
display->CreateSurface(&titlebg, "splash.png");
buffer->BltFast(0, 0, &titlebg, NULL);

____________________________________________

The simulator is not rendering anything, but is black.
i placed the image in Classes folder, res folder and also in the projec folder, still not getting.
i tried to change the rectangle size, etc.
can anyone help me?

PostPosted: Feb 2, 2009 @ 11:33am
by edge

PostPosted: Feb 2, 2009 @ 2:48pm
by akabeer1983
Hi,
Thanks for reply.
I have 2 doubts:
1) i executed the following code:

E2DSurface *image;
image = new E2DSurface();
long result = edisp -> CreateSurface(image, "map.jpg", EST_READONLY);
It runs properly, but the value of result is 7, (not E_OK).

But if i comment out the memory allocation for image //image = new E2DSurface();
and try to execute, iIt displays a big error, a line of which reads as:
Xcode could not locate source file: esurf_2d.cpp (line: 1493)

SHOULD I ALLOCATE MEMORY FOR image?


2) if i provide the absolute path of image "/projects/ImageRender/map.jpg",
then it displays image properly.
WHAT IS THE FORMAT FOR PATH?

PostPosted: Feb 3, 2009 @ 8:41am
by edge

PostPosted: Feb 3, 2009 @ 9:04am
by akabeer1983