GP2X minimal library v0.B

Written by rlyeh, © 2005.

Please check readme for licensing and other conditions.

Window

  • A window is a rectangle on screen which has a special propierty (alpha blending, mirroring, etc)
  • These propierties may be or not available for a determinated layer.

Region

  • A region is a framebuffer in a determinated pixel format.
  • A region can include windows or not.

Layer

  • A layer is a region or a group of them, which has some Z-order when displaying to screen.

YUV layers

  • There are two YUV layers (A and B) which coexist in a same display.
  • YUV A layer has priority over YUV B layer in case of overlapping.
  • You can divide each YUV layer into two regions (top and bottom).
  • The pixel data is YUY2:Y1Cr0Y0Cb0 (32 bits).
  • We will forget about this YUV concepts and we will create a new concept ‘part’ to make easier coding with YUV layers.
  • We will divide our screen up to 4 parts (check gp2x_video_YUV_setparts)
  • Each YUV part (0,1,2,3) has its own framebuffer, allowing mirroring and scaling.

SubPicture layer

  • The SubPicture layer is not supported in this library, and it is not likely to happen.

OSD layer

  • The OSD layer is not supported in this library at the moment.  Wait for a further release.

RGB layer

  • The RGB layer sizes the whole display.
  • It is a layer with a single region (framebuffer/scaler) and 4 windows (0,1,2,3).
  • The pixel data is palettized RGB:888, 15bits RGAB:5515 or 16 bits RGB:565.
  • You can divide the RGB layer into windows with different alpha blending, colorkey or solid drawing on each one.
  • Despite this fact, each RGB window does not have a separate framebuffer, so all of them share the RGB layer framebuffer.
  • So as a side effect, you can do coarse scaling in the whole RGB layer but you cannot scale each RGB window.

Cursor layer

  • The cursor layer is a small layer of 8x8, 16x16, 32x32 or 64x64 pixels.
  • The pixel data is 2 bpp (4 colors), although you only see two colors of them.
  • 2 colors are coded as background/foreground.  The other two are transparent and color invert codes.

Layer priority

  • The Z-order priority for each layer (exactly as the LCD controller does the mixing) follows from left (bottom) to right (top):
  • YUV B -> YUV A -> SubPicture / OSD -> luminance (contrast/brightness) -> RGB -> cursor -> gamma correction
  • The luminance and gamma are not layers really, they are brightness controls.
  • They work exactly at that mixing point, so luminance should not affect RGB layer for example, and gamma should affect any layer.

Alpha blending values

  • As a side note, all alpha blending values change from 0 (100% transparent) to 15 (100% solid), in steps of 6.25%
void gp2x_video_YUV_setparts(int part0,
int part1,
int part2,
int part3,
int x,
int y)
This function enables, disables and sets up screen to four YUV parts.