Macros
SERDISP_COLOUR

Macros

#define serdisp_pack2ARGB(_a, _r, _g, _b)
 packs alpha/red/green/blue values to a 0xAARRGGBB colour value More...
 
#define serdisp_ARGB2GREY(_col)
 converts a colour value to a grey value More...
 
#define serdisp_GREY2ARGB(_grey)
 converts a grey value to a 0xAARRGGBB colour value More...
 

Colour set/get functions

void serdisp_setsdcol (serdisp_t *dd, int x, int y, SDCol sdcol)
 set a colour in the display buffer More...
 
void serdisp_setsdgrey (serdisp_t *dd, int x, int y, byte grey)
 set grey value in the display buffer More...
 
SDCol serdisp_getsdcol (serdisp_t *dd, int x, int y)
 gets colour value at position (x/y) More...
 
byte serdisp_getsdgrey (serdisp_t *dd, int x, int y)
 gets grey value at position (x/y) More...
 
int serdisp_setarea (serdisp_t *dd, int x, int y, int w, int h, int inpmode, byte *content)
 copies an external buffer into the screen buffer More...
 
int serdisp_cliparea (serdisp_t *dd, int x, int y, int w, int h, int sx, int sy, int cw, int ch, int inpmode, byte *content)
 copies a clip from an external buffer into the screen buffer More...
 

Colour conversion functions

int serdisp_sdcol_init (serdisp_t *dd)
 initialises colour conversion function pointers More...
 
SDCol serdisp_transsdcol (serdisp_t *dd, SDCol sdcol)
 translates a colour value to the hardware dependent value More...
 
SDCol serdisp_transsdgrey (serdisp_t *dd, byte greyvalue)
 translates a grey value to the hardware dependent value More...
 
SDCol serdisp_lookupsdcol (serdisp_t *dd, SDCol sdcol)
 looks up hardware independent colour value to the hardware dependent value More...
 
byte serdisp_lookupsdgrey (serdisp_t *dd, SDCol sdcol)
 looks up hardware independent grey value to the hardware dependent colour value More...
 
void serdisp_setsdcoltabentry (serdisp_t *dd, int idx, SDCol sdcol)
 
SDCol serdisp_getsdcoltabentry (serdisp_t *dd, int idx)
 

Backward Compatibility functions

void serdisp_setcolour (serdisp_t *dd, int x, int y, long colour)
 set a colour in the display buffer More...
 
void serdisp_setgrey (serdisp_t *dd, int x, int y, byte grey)
 set grey value in the display buffer More...
 
long serdisp_getcolour (serdisp_t *dd, int x, int y)
 gets colour value at position (x/y) More...
 
byte serdisp_getgrey (serdisp_t *dd, int x, int y)
 gets grey value at position (x/y) More...
 
long serdisp_transcolour (serdisp_t *dd, long colour)
 translates a colour value to the hardware dependent value More...
 
long serdisp_transgrey (serdisp_t *dd, byte greyvalue)
 translates a grey value to the hardware dependent value More...
 
long serdisp_lookupcolour (serdisp_t *dd, long colour)
 looks up hardware independent colour value to the hardware dependent value More...
 
byte serdisp_lookupgrey (serdisp_t *dd, long colour)
 looks up hardware independent grey value to the hardware dependent colour value More...
 
void serdisp_setcoltabentry (serdisp_t *dd, int idx, long colour)
 
long serdisp_getcoltabentry (serdisp_t *dd, int idx)
 

Detailed Description

Introduction

All hardware-independend pixel manipulating functions are defined here.

Attention
serdisp_getpixel() / serdisp_setpixel() are hardware dependend functions, and serdisp_getcolour() / serdisp_setcolour() are architecture dependend functions.

To obtain hardware and architecture independend code, serdisp_getsdcol() / serdisp_setsdcol(), which are defined in here, should be used!

No descriptor fields or internal functions should be accessed directly as these are subject to change.

Macro Definition Documentation

#define serdisp_ARGB2GREY (   _col)

Converts an 0xAARRGGBB colour value to a grey value

Parameters
_colcolour value, format: 0xAARRGGBB, AA .. alpha, RR .. red, GG .. green, BB .. blue
Returns
grey value, format: [0 .. 255]
#define serdisp_GREY2ARGB (   _grey)

Converts a grey value to a 0xAARRGGBB colour value

Parameters
_greycolour value, format: [0 .. 255]
Returns
colour value, format: 0xAARRGGBB, AA .. alpha, RR .. red, GG .. green, BB .. blue
#define serdisp_pack2ARGB (   _a,
  _r,
  _g,
  _b 
)

Packs an alpha/red/green/blue-representation to a colour representation suitable for serdisplib.

Parameters
_aalpha-channel
_rred-channel
_ggreen-channel
_bblue-channel
Returns
hardware independend colour value,
format: 0xAARRGGBB, AA .. alpha, RR .. red, GG .. green, BB .. blue

Examples:
set a red pixel in the display buffer at position (10/20)

1 int r = 0xFF;
2 int g = 0x00;
3 int b = 0x00;
4 serdisp_setsdcol(dd, 10, 20, serdisp_pack2ARGB("0xFF", r, g, b));

Function Documentation

int serdisp_cliparea ( serdisp_t *  dd,
int  x,
int  y,
int  w,
int  h,
int  sx,
int  sy,
int  cw,
int  ch,
int  inpmode,
byte *  content 
)
Parameters
dddevice descriptor
xx start position in display buffer
yy start position in display buffer
wwidth of clip section to copy
hheight of clip section to copy
sxx start position in source clip
syy start position in source clip
cwtotal width of source clip
chtotal height of source clip
inpmode(inpmode & 0x00FF): input depth (either 24 or 32 bit)
(inpmode & 0xFF00): flags:
bit 0:
  • 0: RGB
  • 1: BGR
contentimage data to fill into given area
Return values
0no error occured
-1inpmode not supported
-2not initialised or erraneous parameters
-3position / dimension parameters out of bounds

Example:
copy a clip from <content> starting at position 50/50, size 100x100 into the screen buffer of <dd> at position 10/10. the dimension of the image stored in <content> is 200x200 (altogether), its depth is 24 and colour scheme is BGR.

1 byte* content = <some image byte stream>;
2 serdisp_cliparea(dd, 10, 10, 100, 100, 50, 50, 200, 200, (1 << 8) | 24, content);
Since
1.97.9
long serdisp_getcolour ( serdisp_t *  dd,
int  x,
int  y 
)

Gets the hardware independent colour value at position (x/y)

Parameters
dddevice descriptor
xx-position
yy-position
Returns
hardware independent colour value at (x/y)
format: 0xAARRGGBB, AA .. alpha, RR .. red, GG .. green, BB .. blue
Deprecated:
The byte size of colour is architecture dependent.
Architecture independent function serdisp_getsdcol() should be used instead.
byte serdisp_getgrey ( serdisp_t *  dd,
int  x,
int  y 
)

Gets the grey value at position (x/y). colour values are converted to the corresponding greyscale values.

Parameters
dddevice descriptor
xx-position
yy-position
Returns
grey value ,format: [0 .. 255]
Deprecated:
Old naming scheme for architecture dependent colour functions.
serdisp_getsdgrey() should be used instead.
SDCol serdisp_getsdcol ( serdisp_t *  dd,
int  x,
int  y 
)

Gets the hardware independent colour value at position (x/y)

Parameters
dddevice descriptor
xx-position
yy-position
Returns
hardware independent colour value at (x/y)
format: 0xAARRGGBB, AA .. alpha, RR .. red, GG .. green, BB .. blue
Since
1.98.0
byte serdisp_getsdgrey ( serdisp_t *  dd,
int  x,
int  y 
)

Gets the grey value at position (x/y). colour values are converted to the corresponding greyscale values.

Parameters
dddevice descriptor
xx-position
yy-position
Returns
grey value ,format: [0 .. 255]
Since
1.98.0
long serdisp_lookupcolour ( serdisp_t *  dd,
long  colour 
)

Looks up the corresponding 0xAARRGGBB colour value to a serdisp_setpixel()-compliant colour value.

Parameters
dddevice descriptor
colourserdisp_setpixel()-compliant, hardware dependent colour value
Returns
translated hardware independent colour value, format: 0xAARRGGBB
Deprecated:
The byte size of colour is architecture dependent.
Architecture independent function serdisp_lookupsdcol() should be used instead.
byte serdisp_lookupgrey ( serdisp_t *  dd,
long  colour 
)

Looks up the corresponding grey value to a serdisp_setpixel()-compliant colour value.

Parameters
dddevice descriptor
colourserdisp_setpixel()-compliant, hardware dependent colour value
Returns
translated grey value, format [0 .. 255]
Deprecated:
The byte size of colour is architecture dependent.
Architecture independent function serdisp_lookupsdgrey() should be used instead.
SDCol serdisp_lookupsdcol ( serdisp_t *  dd,
SDCol  sdcol 
)

Looks up the corresponding 0xAARRGGBB colour value to a serdisp_setpixel()-compliant colour value.

Parameters
dddevice descriptor
sdcolserdisp_setsdpixel()-compliant, hardware dependent colour value
Returns
translated hardware independent colour value, format: 0xAARRGGBB
Since
1.98.0
byte serdisp_lookupsdgrey ( serdisp_t *  dd,
SDCol  sdcol 
)

Looks up the corresponding grey value to a serdisp_setsdpixel()-compliant colour value.

Parameters
dddevice descriptor
sdcolserdisp_setsdpixel()-compliant, hardware dependent colour value
Returns
translated grey value, format [0 .. 255]
Since
1.98.0
int serdisp_sdcol_init ( serdisp_t *  dd)
Parameters
dddevice descriptor
Return values
0no error occured
-1depth/colour-space combination not supported
Since
1.97.9
int serdisp_setarea ( serdisp_t *  dd,
int  x,
int  y,
int  w,
int  h,
int  inpmode,
byte *  content 
)
Parameters
dddevice descriptor
xx start position
yy start position
wwidth
hheight
inpmode(inpmode & 0x00FF): input depth (either 24 or 32 bit)
(inpmode & 0xFF00): flags:
bit 0:
  • 0: RGB
  • 1: BGR
contentimage data to fill into given area
Return values
0no error occured
-1inpmode not supported
-2not initialised or erraneous parameters
-3position / dimension parameters out of bounds

Example:
copy the image data from <content> into the screen buffer of <dd> at position 10/10, dimension 50x50. Its depth is 32 and colour scheme is RGB.
The dimension of the image stored in <content> must match parameters w and h!

1 byte* content = <some image byte stream>;
2 serdisp_setarea(dd, 10, 10, 50, 50, 32, content);
Since
1.97.9
void serdisp_setcolour ( serdisp_t *  dd,
int  x,
int  y,
long  colour 
)

This function sets the colour information hardware independently.
The information is changed in the display buffer only.

Parameters
dddevice descriptor
xx-position
yy-position
colourcolour
format: 0xAARRGGBB , AA .. alpha, RR .. red, GG .. green, BB .. blue

Examples:
both set a red pixel in the display buffer at position (10/20)

1 serdisp_setcolour(dd, 10, 20, 0xFFFF0000);
2 serdisp_setcolour(dd, 10, 20, SD_COL_RED);
Deprecated:
The byte size of colour is architecture dependent.
Architecture independent function serdisp_setsdcol() should be used instead.
void serdisp_setgrey ( serdisp_t *  dd,
int  x,
int  y,
byte  grey 
)

This function sets the grey value hardware independently.
The information is changed in the display buffer only.

Parameters
dddevice descriptor
xx-position
yy-position
greygrey value; format: [0 .. 255]

Examples:
set a grey value in the display buffer at position (10/20)

1 serdisp_setgrey(dd, 10, 20, 0xCC);
Deprecated:
Old naming scheme for architecture dependent colour functions.
serdisp_setsdgrey() should be used instead.
void serdisp_setsdcol ( serdisp_t *  dd,
int  x,
int  y,
SDCol  sdcol 
)

This function sets the colour information hardware independently.
The information is changed in the display buffer only.

Parameters
dddevice descriptor
xx-position
yy-position
sdcolcolour
format: 0xAARRGGBB , AA .. alpha, RR .. red, GG .. green, BB .. blue

Examples:
both set a red pixel in the display buffer at position (10/20)

1 serdisp_setsdcol(dd, 10, 20, 0xFFFF0000);
2 serdisp_setsdcol(dd, 10, 20, SD_COL_RED);
Since
1.98.0
void serdisp_setsdgrey ( serdisp_t *  dd,
int  x,
int  y,
byte  grey 
)

This function sets the grey value hardware independently.
The information is changed in the display buffer only.

Parameters
dddevice descriptor
xx-position
yy-position
greygrey value; format: [0 .. 255]

Examples:
set a grey value in the display buffer at position (10/20)

1 serdisp_setgrey(dd, 10, 20, 0xCC);
Since
1.98.0
long serdisp_transcolour ( serdisp_t *  dd,
long  colour 
)

Translates an 0xAARRGGBB colour value to a hardware dependent value that is suitable for serdisp_setpixel().

Parameters
dddevice descriptor
colour0xAARRGGBB colour value
Returns
translated, serdisp_setpixel()-compliant, hardware dependent colour value
Deprecated:
The byte size of colour is architecture dependent.
Architecture independent function serdisp_transsdcol() should be used instead.
long serdisp_transgrey ( serdisp_t *  dd,
byte  greyvalue 
)

Translates a grey value to a hardware dependent value that is suitable for serdisp_setpixel()

Parameters
dddevice descriptor
greyvaluegrey value
Returns
translated, serdisp_setpixel()-compliant, hardware dependent colour value
Deprecated:
The byte size of colour is architecture dependent.
Architecture independent function serdisp_transsdgrey() should be used instead.
SDCol serdisp_transsdcol ( serdisp_t *  dd,
SDCol  sdcol 
)

Translates an 0xAARRGGBB colour value to a hardware dependent value that is suitable for serdisp_setsdpixel().

Parameters
dddevice descriptor
sdcol0xAARRGGBB colour value
Returns
translated, serdisp_setsdpixel()-compliant, hardware dependent colour value
Since
1.98.0
SDCol serdisp_transsdgrey ( serdisp_t *  dd,
byte  greyvalue 
)

Translates a grey value to a hardware dependent value that is suitable for serdisp_setsdpixel()

Parameters
dddevice descriptor
greyvaluegrey value
Returns
translated, serdisp_setsdpixel()-compliant, hardware dependent colour value
Since
1.98.0