MoSync 3.3
FrameBuffer.h File Reference

Pixel format conversion, scaling, orientation change for palletized surfaces. More...

#include <ma.h>

Defines

#define FLAG_4BPP   1
#define FLAG_RGB666   2
#define ORIENTATION_0   0
#define ORIENTATION_90   1
#define ORIENTATION_180   2
#define ORIENTATION_270   3

Functions

void FrameBuffer_init (int w, int h, int orientation, int flags)
void FrameBuffer_setOrientation (int orientation)
int FrameBuffer_getOrientation (void)
void FrameBuffer_close (void)
void FrameBuffer_setPalette (int startDst, int startSrc, int num, const byte *src, int flags)
void FrameBuffer_setPaletteEntry (int i, int r, int g, int b, int flags)
void FrameBuffer_getPaletteEntry (int i, byte *dst, int flags)
void FrameBuffer_copyRect (short x, short y, short w, short h, int dstx, int dsty, const byte *buf, int pitch)
int FrameBuffer_getArrowKeyForOrientation (int mak)
int FrameBuffer_getArrowKeyForOrientationInitial (int mak, int initial)

Detailed Description

Pixel format conversion, scaling, orientation change for palletized surfaces.

Author:
Niklas Nummelin

Define Documentation

#define FLAG_4BPP   1
#define FLAG_RGB666   2
#define ORIENTATION_0   0
#define ORIENTATION_90   1
#define ORIENTATION_180   2
#define ORIENTATION_270   3

Function Documentation

void FrameBuffer_init ( int  w,
int  h,
int  orientation,
int  flags 
)

Initializes the FrameBuffer system. This system sets up the native MoSync framebuffer, so make sure that it isn't in use while using this system.

Parameters:
wThe width in pixels of the framebuffer.
hThe height in pixels of the framebuffer.
orientationThe orientation of the the screen.
flagsFlags for setting bits per pixel.
void FrameBuffer_setOrientation ( int  orientation)

Sets the orientation of the framebuffer.

Parameters:
orientationThe new orientation of the framebuffer.

Gets the orientation of the framebuffer.

Returns:
The current orientation.
void FrameBuffer_close ( void  )

Closes the framebuffer.

void FrameBuffer_setPalette ( int  startDst,
int  startSrc,
int  num,
const byte src,
int  flags 
)

Sets a part of the palette.

Parameters:
startDstWhere to start in the destination palette (offset in color elements).
startSrcWhere to start in the src palette (offset in bytes);
numHow many colors should be set.
srcThe source palette on the format, in bytes, RGBRGB... (note that if FLAG_RGB666 is set then each color component is only 6 bits).
flagsIf FLAG_RGB666 then 6 bits will be used per component.
void FrameBuffer_setPaletteEntry ( int  i,
int  r,
int  g,
int  b,
int  flags 
)

Sets a single palette entry.

Parameters:
iThe index of the color to be set.
rThe red color component.
gThe green color component.
bThe blue color component.
flagsIf FLAG_RGB666 then 6 bits will be used per component.
void FrameBuffer_getPaletteEntry ( int  i,
byte dst,
int  flags 
)

Gets a single palette entry.

Parameters:
iThe index of the color to be recieved.
dstA pointer to the destination memory. (3 bytes)
flagsIf FLAG_RGB666 then 6 bits will be used per component.
void FrameBuffer_copyRect ( short  x,
short  y,
short  w,
short  h,
int  dstx,
int  dsty,
const byte buf,
int  pitch 
)

Blits a part of the the framebuffer to the screen.

Parameters:
xThe topleft x-coordinate of the rectangle to be copied to screen.
yThe topleft y-coordinate of the rectangle to be copied to screen.
wThe width of the rectangle to be copied to screen.
hThe height of the rectangle to be copied to screen.
dstxThe topleft x-coordinate of the destination (in the same coordinate system as x and y).
dstyThe topleft y-coordinate of the destination (in the same coordinate system as x and y).
bufPointer to the source framebuffer.
pitchThe pitch of the source framebuffer.

Function to rotate the arrow keys depending on the orientation.

Parameters:
makThe mak keycode of the arrow key.
int FrameBuffer_getArrowKeyForOrientationInitial ( int  mak,
int  initial 
)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines