PocketMatrix forums

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

Screen size question

Hi Edge,

For Symbian 9.1 S60, I know the graphics can be enlarged or reduced separately using the Blt(). I have the graphic set for 176x208 devices, can I enlarge the hole screen to fit the resolution 352x416?

Thanks
Hi Patrick,

For the 352x416 version, I recommend creating a temporary buffer which size is 176x208. Use all graphics operations on this surface instead of the display buffer and scale it using Blt() at the end of OnNextFrame() to the real buffer.

The 176x208 should use the real buffer. A good way to do this is to create a render function accepting a pointer to a buffer surface. Here is a small example:

Code:

void RenderGame(E2DSurface *buffer)
{
buffer->BltFast(...)
}

void OnNextFrame(ClassEDisplay *display, unsigned long timedelta)
{
if (display->buffer.GetWidth() == 352 && display->buffer.GetHeight() == 416)
{
RenderGame(&temp;_buffer);
display->buffer.Blt(...);//Scale here
}
else
RenderGame(&display-;>buffer);
}
Hi Edge,

As value equals to 65536 will no scale, what should be the value if I want to double size the image?
Hi Patrick,

Just multiply 65536 * 2 to double size the image. 65536 / 2 will half its size.

Please note that in Blt(), x/y position 0,0 is the center of the screen.
Hi Edge,

After using Blt() to scale the image, the program ran slowly, what is the problem?

Thanks
Hi Patrick,

Blt() is an expensive operation, especially when scaling a whole buffer.

A better solution might be to scale your internal surfaces (sprite and tilesheets, title screens, etc.) when loading them. You may also create a different graphics resource pack with upscaled graphics.

Working with native high-resolution graphics is faster than doing an upscale at the end of OnNextFrame().
Hi Edge,

How can I scale the internal surfaces when loading?
I found the API of Symbian for zooming (TZoomfactor and MGraphicsDeviceMap), does Edge support this API? If yes, is there any reference or example?

Thanks
Hi Patrick,

To upscale the graphics when loading you can use Blt(). Here is an example for loading and upscaling a tilesheet (the tilesheet variable is a 2D surface and class member of ClassMain).

Code:

ERESULT ClassMain::OnDisplayInit(EINSTANCE instance, ClassEDisplay *display)
{
E2DSurface temp;
bool upscale = false;
if (display->buffer.GetWidth() == 352 && display->buffer.GetHeight() == 416)
upscale = true;
if (upscale)
{
if (display->CreateSurface(&temp;, "tilesheet.bmp") == E_OK)
{
display->CreateSurface(&tilesheet;, temp.GetWidth() * 2, temp.GetHeight() * 2);
tilesheet.Blt(0, 0, &temp;, NULL, 0, 65536 * 2);
}
}
else
display->CreateSurface(&tilesheet;, "tilesheet.bmp");
return(E_OK);
}