PAlib: Bitmap mode, for any screen...

Main Page | Modules | File List | Globals | Search for

# Bitmap mode, for any screen...

## Defines

#define | PA_Get16bitPixel(screen, x, y) PA_DrawBg[screen][x + (y << 8)]
| Get the pixel's color in 16 bit Draw mode...
#define | PA_SetDrawSize(screen, draw_size) PA_drawsize[screen] = draw_size;
| Set the size of the pen when drawing.
#define | PA_Load8bitBitmap(screen, bitmap) DMA_Copy(bitmap, (void*)PA_DrawBg[screen], 256*96, DMA_16NOW);
| Load a bitmap on the screen for an 8 bit drawable background
#define | PA_Load16bitBitmap(screen, bitmap)
| Load a bitmap on the screen for an 16 bit drawable background
#define | PA_Clear8bitBg(screen) DMA_Copy(Blank, (void*)PA_DrawBg[screen], 256*96, DMA_16NOW);
| Clears the screen... for an 8 bit drawable background
#define | PA_Clear16bitBg(screen) DMA_Copy(Blank, (void*)PA_DrawBg[screen], 256*192, DMA_16NOW)
| Clears the screen... for an 16 bit drawable background

## Functions

void | PA_Init8bitBg (bool screen, u8 bg_priority)
| Initialise 8 bit draw mode (palette mode)... Chose the screen and the background priority (0-3). This drawable background will replace Background 3, and must be loaded before all other backgrounds. Takes about 3/8 of the VRAM.
void | PA_Init16bitBg (bool screen, u8 bg_priority)

Initialise 16 bit draw mode (no palette mode, true colors)... Chose the screen and the background priority (0-3). This drawable background will replace Background 3, and must be loaded before all other backgrounds. Takes about 6/8 of the VRAM, so almost all the space !

void | PA_Put8bitPixel (bool screen, s16 x, s16 y, u8 color)
| Draw a pixel on screen, on an 8 bit background
void | PA_Put2_8bitPixels (bool screen, s16 x, s16 y, u16 colors)
| Draw 2 pixels on screen, on an 8 bit background. These pixels are next to another, and the first pixel must be with a pair X. WAY faster than drawing both pixels separately
void | PA_PutDouble8bitPixels (bool screen, s16 x, s16 y, u8 color1, u8 color2)
| Draw 2 pixels on screen, on an 8 bit background. These pixels are next to another, and the first pixel must be with a pair X. WAY faster than drawing both pixels separately
void | PA_Put4_8bitPixels (bool screen, s16 x, s16 y, u32 colors)
| Draw 4 pixels on screen, on an 8 bit background. These pixels are next to another, and the first pixel must be with a pair X. Fastest way to draw on the screen...
u8 | PA_Get8bitPixel (bool screen, u8 x, u8 y)
| Get the pixel's color in 8 bit Draw mode...
void | PA_Put16bitPixel (bool screen, s16 x, s16 y, u16 color)
| Draw a pixel on screen, on an 16 bit background
void | PA_Draw8bitLine (bool screen, u16 x1, u16 y1, u16 x2, u16 y2, u8 color)
| Draw a line in Draw mode... for 8 bit drawable background
void | PA_Draw16bitLine (bool screen, u16 x1, u16 y1, u16 x2, u16 y2, u16 color)
| Draw a line in Draw mode... for 16 bit drawable background
void | PA_Draw16bitLineEx (bool screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color, s8 size)
| Draw a thick line in Draw mode... for 16 bit drawable background
void | PA_Draw8bitLineEx (bool screen, s16 basex, s16 basey, s16 endx, s16 endy, u8 color, s8 size)
| Draw a thick line in Draw mode... for 8 bit drawable background
void | PA_Draw16bitRect (bool screen, s16 basex, s16 basey, s16 endx, s16 endy, u16 color)
| Draw a rectangle in Draw mode... for 16 bit drawable background
void | PA_8bitDraw (bool screen, u8 color)

For 8 bit background : Nice little function that draws on screen ! All you need to do is chose the color, it'll do the rest. If the PA VBL isn't initialised, don't forget to update the stylus position every frame... Juste execute PA_Draw every cycle...

void | PA_16bitDraw (bool screen, u16 color)

For 16 bit : Nice little function that draws on screen ! All you need to do is chose the color, it'll do the rest. If the PA VBL isn't initialised, don't forget to update the stylus position every frame... Juste execute PA_Draw every cycle...

void | PA_LoadJpeg (bool screen, void *jpeg)
| Load a jpeg on a 16 bit background... Don't forget to Init the background !
void | PA_LoadBmpToBuffer (u16 *Buffer, s16 x, s16 y, void *bmp, s16 SWidth)
| Load a BMP in a 16 bit Buffer
void | PA_LoadBmpEx (bool screen, s16 x, s16 y, void *bmp)
| Load a BMP on a 16 bit background... Don't forget to Init the background !
void | PA_LoadBmp (bool screen, void *bmp)
| Load a BMP on a 16 bit background... Don't forget to Init the background !
u16 | PA_GetGifWidth (void *gif)
| Get a Gif's width in pixels
u16 | PA_GetGifHeight (void *gif)
| Get a Gif's height in pixels
void | PA_LoadGif (bool screen, void *gif)
| Load a Gif on a 16 bit background... Don't forget to Init the background !
void | PA_LoadGBFSImage (bool screen, s16 GBFSImage)
| Load any image from GBFS on the screen (16 bit). Currently supports Gif, Jpeg, and BMP
void | PA_LoadGBFSImageToBuffer (void *Buffer, s16 GBFSImage, s16 Width)
u16 | PA_GetBmpWidth (void *bmp)
| Get a BMP's width in pixels
u16 | PA_GetBmpHeight (void *bmp)
| Get a BMP's height in pixels

## Detailed Description

Draw on screen, either a pixel or a line, or anything ! Load a Bitmap, a Jpeg...

## Define Documentation

#define PA_Clear16bitBg | ( | screen |  | ) | DMA_Copy(Blank, (void*)PA_DrawBg[screen], 256*192, DMA_16NOW)

Clears the screen... for an 16 bit drawable background

Parameters:

  | screen | Chose de screen (0 or 1)

#define PA_Clear8bitBg | ( | screen |  | ) | DMA_Copy(Blank, (void*)PA_DrawBg[screen], 256*96, DMA_16NOW);

Clears the screen... for an 8 bit drawable background

Parameters:

  | screen | Chose de screen (0 or 1)

#define PA_Get16bitPixel | ( | screen,
|  | x,
|  | y |  | ) | PA_DrawBg[screen][x + (y << 8)]

Get the pixel's color in 16 bit Draw mode...

Parameters:

  | screen | Chose de screen (0 or 1)
  | x | X position. Be carefull, if X is not between 0 and 255, it'll give unwanted results
  | y | Y position. Be carefull, if Y is not between 0 and 191, it'll give unwanted results

#define PA_Load16bitBitmap | ( | screen,
|  | bitmap |  | ) |

Value:

    {u32 PA_temp; \
    for (PA_temp = 0; PA_temp < 256*192; PA_temp++)\
    PA_DrawBg[screen][PA_temp] = bitmap[PA_temp] | (1 << 15);}

Load a bitmap on the screen for an 16 bit drawable background

Parameters:

  | screen | Chose de screen (0 or 1)
  | bitmap | Bitmap name

#define PA_Load8bitBitmap | ( | screen,
|  | bitmap |  | ) | DMA_Copy(bitmap, (void*)PA_DrawBg[screen], 256*96, DMA_16NOW);

Load a bitmap on the screen for an 8 bit drawable background

Parameters:

  | screen | Chose de screen (0 or 1)
  | bitmap | Bitmap name

#define PA_SetDrawSize | ( | screen,
|  | draw_size |  | ) | PA_drawsize[screen] = draw_size;

Set the size of the pen when drawing.

Parameters:

  | screen | Chose de screen (0 or 1)
  | draw_size | Size...

## Function Documentation

PA_16bitDraw | ( | bool | screen,
|  | u16 | color
| ) |

For 16 bit : Nice little function that draws on screen ! All you need to do is chose the color, it'll do the rest. If the PA VBL isn't initialised, don't forget to update the stylus position every frame... Juste execute PA_Draw every cycle...

Parameters:

  | screen | Chose de screen (0 or 1)
  | color | 15 bits color. You can use the PA_RGB macro to set the RGB values...

PA_8bitDraw | ( | bool | screen,
|  | u8 | color
| ) |

For 8 bit background : Nice little function that draws on screen ! All you need to do is chose the color, it'll do the rest. If the PA VBL isn't initialised, don't forget to update the stylus position every frame... Juste execute PA_Draw every cycle...

Parameters:

  | screen | Chose de screen (0 or 1)
  | color | 15 bits color. You can use the PA_RGB macro to set the RGB values...

void PA_Draw16bitLine | ( | bool | screen,
|  | u16 | x1,
|  | u16 | y1,
|  | u16 | x2,
|  | u16 | y2,
|  | u16 | color
| ) |

Draw a line in Draw mode... for 16 bit drawable background

Parameters:

  | screen | Chose de screen (0 or 1)
  | x1 | X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results
  | y1 | Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results
  | x2 | X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results
  | y2 | Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results
  | color | 15 bits color. You can use the PA_RGB macro to set the RGB values...

void PA_Draw16bitLineEx | ( | bool | screen,
|  | s16 | basex,
|  | s16 | basey,
|  | s16 | endx,
|  | s16 | endy,
|  | u16 | color,
|  | s8 | size
| ) |

Draw a thick line in Draw mode... for 16 bit drawable background

Parameters:

  | screen | Chose de screen (0 or 1)
  | basex | X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results
  | basey | Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results
  | endx | X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results
  | endy | Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results
  | color | 15 bits color. You can use the PA_RGB macro to set the RGB values...
  | size | Width of the line, in pixels

void PA_Draw16bitRect | ( | bool | screen,
|  | s16 | basex,
|  | s16 | basey,
|  | s16 | endx,
|  | s16 | endy,
|  | u16 | color
| ) |

Draw a rectangle in Draw mode... for 16 bit drawable background

Parameters:

  | screen | Chose de screen (0 or 1)
  | basex | X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results
  | basey | Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results
  | endx | X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results
  | endy | Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results
  | color | 15 bits color. You can use the PA_RGB macro to set the RGB values...

void PA_Draw8bitLine | ( | bool | screen,
|  | u16 | x1,
|  | u16 | y1,
|  | u16 | x2,
|  | u16 | y2,
|  | u8 | color
| ) |

Draw a line in Draw mode... for 8 bit drawable background

Parameters:

  | screen | Chose de screen (0 or 1)
  | x1 | X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results
  | y1 | Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results
  | x2 | X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results
  | y2 | Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results
  | color | Color in the background palette (0-255)

void PA_Draw8bitLineEx | ( | bool | screen,
|  | s16 | basex,
|  | s16 | basey,
|  | s16 | endx,
|  | s16 | endy,
|  | u8 | color,
|  | s8 | size
| ) |

Draw a thick line in Draw mode... for 8 bit drawable background

Parameters:

  | screen | Chose de screen (0 or 1)
  | basex | X position of the first point. Be carefull, if X is not between 0 and 255, it'll give unwanted results
  | basey | Y position of the first point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results
  | endx | X position of the second point. Be carefull, if X is not between 0 and 255, it'll give unwanted results
  | endy | Y position of the second point. Be carefull, if Y is not between 0 and 191, it'll give unwanted results
  | color | 15 bits color. You can use the PA_RGB macro to set the RGB values...
  | size | Width of the line, in pixels

inline u8 PA_Get8bitPixel | ( | bool | screen,
|  | u8 | x,
|  | u8 | y
| ) | `[inline]`

Get the pixel's color in 8 bit Draw mode...

Parameters:

  | screen | Chose de screen (0 or 1)
  | x | X position. Be carefull, if X is not between 0 and 255, it'll give unwanted results
  | y | Y position. Be carefull, if Y is not between 0 and 191, it'll give unwanted results

inline u16 PA_GetBmpHeight | ( | void * | bmp | ) | `[inline]`

Get a BMP's height in pixels

Parameters:

  | bmp | BMP image...

inline u16 PA_GetBmpWidth | ( | void * | bmp | ) | `[inline]`

Get a BMP's width in pixels

Parameters:

  | bmp | BMP image...

inline u16 PA_GetGifHeight | ( | void * | gif | ) | `[inline]`

Get a Gif's height in pixels

Parameters:

  | gif | Gif image...

inline u16 PA_GetGifWidth | ( | void * | gif | ) | `[inline]`

Get a Gif's width in pixels

Parameters:

  | gif | Gif image...

void PA_Init16bitBg | ( | bool | screen,
|  | u8 | bg_priority
| ) |

Initialise 16 bit draw mode (no palette mode, true colors)... Chose the screen and the background priority (0-3). This drawable background will replace Background 3, and must be loaded before all other backgrounds. Takes about 6/8 of the VRAM, so almost all the space !

Parameters:

  | screen | Chose de screen (0 or 1)
  | bg_priority | Background priority (0-3) Background priority (0-3)

void PA_Init8bitBg | ( | bool | screen,
|  | u8 | bg_priority
| ) |

Initialise 8 bit draw mode (palette mode)... Chose the screen and the background priority (0-3). This drawable background will replace Background 3, and must be loaded before all other backgrounds. Takes about 3/8 of the VRAM.

Parameters:

  | screen | Chose de screen (0 or 1)
  | bg_priority | Background priority (0-3) Background priority (0-3)

inline void PA_LoadBmp | ( | bool | screen,
|  | void * | bmp
| ) | `[inline]`

Load a BMP on a 16 bit background... Don't forget to Init the background !

Parameters:

  | screen | Chose de screen (0 or 1)
  | bmp | BMP image...

inline void PA_LoadBmpEx | ( | bool | screen,
|  | s16 | x,
|  | s16 | y,
|  | void * | bmp
| ) | `[inline]`

Load a BMP on a 16 bit background... Don't forget to Init the background !

Parameters:

  | screen | Chose de screen (0 or 1)
  | x | X position of the top left corner
  | y | Y position of the top left corner
  | bmp | BMP image...

void PA_LoadBmpToBuffer | ( | u16 * | Buffer,
|  | s16 | x,
|  | s16 | y,
|  | void * | bmp,
|  | s16 | SWidth
| ) |

Load a BMP in a 16 bit Buffer

Parameters:

  | Buffer | Buffer...
  | x | X position of the top left corner
  | y | Y position of the top left corner
  | bmp | BMP image...
  | SWidth | Buffer width to use (256 for screen width...)

inline void PA_LoadGBFSImage | ( | bool | screen,
|  | s16 | GBFSImage
| ) | `[inline]`

Load any image from GBFS on the screen (16 bit). Currently supports Gif, Jpeg, and BMP

Parameters:

  | screen | Chose de screen (0 or 1)
  | GBFSImage | GBFS Image number

inline void PA_LoadGif | ( | bool | screen,
|  | void * | gif
| ) | `[inline]`

Load a Gif on a 16 bit background... Don't forget to Init the background !

Parameters:

  | screen | Chose de screen (0 or 1)
  | gif | Gif image...

inline void PA_LoadJpeg | ( | bool | screen,
|  | void * | jpeg
| ) | `[inline]`

Load a jpeg on a 16 bit background... Don't forget to Init the background !

Parameters:

  | screen | Chose de screen (0 or 1)
  | jpeg | jpeg image...

inline void PA_Put16bitPixel | ( | bool | screen,
|  | s16 | x,
|  | s16 | y,
|  | u16 | color
| ) | `[inline]`

Draw a pixel on screen, on an 16 bit background

Parameters:

  | screen | Chose de screen (0 or 1)
  | x | X position (0-255)
  | y | Y position (0-191)
  | color | 16 bit color, obtained using PA_RGB(red, green, blue)

inline void PA_Put2_8bitPixels | ( | bool | screen,
|  | s16 | x,
|  | s16 | y,
|  | u16 | colors
| ) | `[inline]`

Draw 2 pixels on screen, on an 8 bit background. These pixels are next to another, and the first pixel must be with a pair X. WAY faster than drawing both pixels separately

Parameters:

  | screen | Chose de screen (0 or 1)
  | x | X position (0-254), must be PAIR
  | y | Y position (0-191)
  | colors | Colors of the first and second pixels (*256 for the second)

inline void PA_Put4_8bitPixels | ( | bool | screen,
|  | s16 | x,
|  | s16 | y,
|  | u32 | colors
| ) | `[inline]`

Draw 4 pixels on screen, on an 8 bit background. These pixels are next to another, and the first pixel must be with a pair X. Fastest way to draw on the screen...

Parameters:

  | screen | Chose de screen (0 or 1)
  | x | X position (0-254), must be PAIR
  | y | Y position (0-191)
  | colors | Colors of the 4 pixels

inline void PA_Put8bitPixel | ( | bool | screen,
|  | s16 | x,
|  | s16 | y,
|  | u8 | color
| ) | `[inline]`

Draw a pixel on screen, on an 8 bit background

Parameters:

  | screen | Chose de screen (0 or 1)
  | x | X position (0-255)
  | y | Y position (0-191)
  | color | Color in the background palette (0-255)

inline void PA_PutDouble8bitPixels | ( | bool | screen,
|  | s16 | x,
|  | s16 | y,
|  | u8 | color1,
|  | u8 | color2
| ) | `[inline]`

Draw 2 pixels on screen, on an 8 bit background. These pixels are next to another, and the first pixel must be with a pair X. WAY faster than drawing both pixels separately

Parameters:

  | screen | Chose de screen (0 or 1)
  | x | X position (0-254), must be PAIR
  | y | Y position (0-191)
  | color1 | Color of the first pixel, in the background palette (0-255)
  | color2 | Color of the second pixel, in the background palette (0-255)