include/nds/arm9/PA_Draw.h File Reference

Bitmap mode, for drawing, loading images in 8 or 16 bit mode... More...

#include "PA9.h"
#include "PA_Interrupt.h"
#include "PA_Palette.h"
#include "PA_Gif.h"

Data Structures

struct  __PACKED
struct  BMP_Headers

Defines

#define PA_RGB8(r, g, b)   ((((b)>>3)<<10)|(((g)>>3)<<5)|((r)>>3)|(1 << 15))
#define __PACKED
#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 (u8 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_InitBig8bitBg (u8 screen, u8 bg_priority)
 Same as PA_Init8bitBg, but with an available size of 256x256. Takes up a little more space but allows correct vertical scrolling...
void PA_8bitSwapBuffer (u8 screen)
void PA_Init8bitDblBuffer (u8 screen, u8 bg_priority)
void PA_Init16bitBg (u8 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_Init16bitDblBuffer (u8 screen, u8 bg_priority)
void PA_16bitSwapBuffer (u8 screen)
void PA_Put8bitPixel (u8 screen, s16 x, s16 y, u8 color)
 Draw a pixel on screen, on an 8 bit background.
void PA_Put2_8bitPixels (u8 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 (u8 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 (u8 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 (u8 screen, u8 x, u8 y)
 Get the pixel's color in 8 bit Draw mode...
void PA_Put16bitPixel (u8 screen, s16 x, s16 y, u16 color)
 Draw a pixel on screen, on an 16 bit background.
void PA_Draw8bitLine (u8 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 (u8 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 (u8 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 (u8 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 (u8 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 (u8 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 (u8 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 (u8 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 (u8 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 (u8 screen, void *bmp)
 Load a BMP on a 16 bit background... Don't forget to Init the background !
u16 PA_GetBmpWidth (void *bmpdata)
 Get a BMP's width in pixels.
u16 PA_GetBmpHeight (void *bmpdata)
 Get a BMP's height in pixels.
void PA_8bit8x8Image (u8 screen, u16 basex, u16 basey, u8 *data)

Variables

u8 PA_nBit [2]
u16 tempvar
u16 PA_oldx [2]
u16 PA_oldy [2]
s16 PA_olddowntime [2]
u8 PA_drawsize [2]
u16 * PA_DrawBg [2]
u32 * PA_DrawBg32 [2]
u16 PA_temppal [256]


Detailed Description

Bitmap mode, for drawing, loading images in 8 or 16 bit mode...

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


Define Documentation

#define __PACKED

#define PA_RGB8 ( r,
g,
 )     ((((b)>>3)<<10)|(((g)>>3)<<5)|((r)>>3)|(1 << 15))


Function Documentation

void PA_8bit8x8Image ( u8  screen,
u16  basex,
u16  basey,
u8 *  data 
) [inline]


Variable Documentation

u16* PA_DrawBg[2]

u32* PA_DrawBg32[2]

u8 PA_drawsize[2]

u8 PA_nBit

u16 PA_oldx[2]

u16 PA_oldy[2]

u16 PA_temppal[256]

u16 tempvar


Generated on Sat Jun 13 12:55:13 2009 for PAlib - Programmer's Arsenal by  doxygen 1.5.8