libtonc
|
Modules | |
Bitmaps | |
Tiled Backgrounds | |
Additional colors | |
void | clr_rotate (COLOR *clrs, uint nclrs, int ror) |
Rotate nclrs colors at clrs to the right by ror. | |
void | clr_blend (const COLOR *srca, const COLOR *srcb, COLOR *dst, uint nclrs, u32 alpha) |
Blends color arrays srca and srcb into dst. | |
void | clr_fade (const COLOR *src, COLOR clr, COLOR *dst, uint nclrs, u32 alpha) |
Fades color arrays srca to clr into dst. | |
void | clr_grayscale (COLOR *dst, const COLOR *src, uint nclrs) |
Transform colors to grayscale. | |
void | clr_rgbscale (COLOR *dst, const COLOR *src, uint nclrs, COLOR clr) |
Transform colors to an rgb-scale. | |
void | clr_adj_brightness (COLOR *dst, const COLOR *src, uint nclrs, FIXED bright) |
Adjust brightness by bright. | |
void | clr_adj_contrast (COLOR *dst, const COLOR *src, uint nclrs, FIXED contrast) |
Adjust contrast by contrast. | |
void | clr_adj_intensity (COLOR *dst, const COLOR *src, uint nclrs, FIXED intensity) |
Adjust intensity by intensity. | |
void | pal_gradient (COLOR *pal, int first, int last) |
Create a gradient between pal[first] and pal[last]. | |
void | pal_gradient_ex (COLOR *pal, int first, int last, COLOR clr_first, COLOR clr_last) |
Create a gradient between pal[first] and pal[last]. | |
IWRAM_CODE void | clr_blend_fast (COLOR *srca, COLOR *srcb, COLOR *dst, uint nclrs, u32 alpha) |
Blends color arrays srca and srcb into dst. | |
IWRAM_CODE void | clr_fade_fast (COLOR *src, COLOR clr, COLOR *dst, uint nclrs, u32 alpha) |
Fades color arrays srca to clr into dst. | |
INLINE COLOR | RGB15 (int red, int green, int blue) |
Create a 15bit BGR color. | |
INLINE COLOR | RGB15_SAFE (int red, int green, int blue) |
Create a 15bit BGR color, with proper masking of R,G,B components. | |
INLINE COLOR | RGB8 (u8 red, u8 green, u8 blue) |
Create a 15bit BGR color, using 8bit components. | |
#define | CLR_DEAD 0xDEAD |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_MAROON 0x0010 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_GREEN 0x0200 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_OLIVE 0x0210 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_ORANGE 0x021F |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_NAVY 0x4000 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_PURPLE 0x4010 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_TEAL 0x4200 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_GRAY 0x4210 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_MEDGRAY 0x5294 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_SILVER 0x6318 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_MONEYGREEN 0x6378 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_FUCHSIA 0x7C1F |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_SKYBLUE 0x7B34 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_CREAM 0x7BFF |
Rotate nclrs colors at clrs to the right by ror. | |
#define | CLR_MASK 0x001F |
Rotate nclrs colors at clrs to the right by ror. | |
#define | RED_MASK 0x001F |
Rotate nclrs colors at clrs to the right by ror. | |
#define | RED_SHIFT 0 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | GREEN_MASK 0x03E0 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | GREEN_SHIFT 5 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | BLUE_MASK 0x7C00 |
Rotate nclrs colors at clrs to the right by ror. | |
#define | BLUE_SHIFT 10 |
Rotate nclrs colors at clrs to the right by ror. | |
Generic 8bpp bitmaps | |
void | bmp8_plot (int x, int y, u32 clr, void *dstBase, uint dstP) |
Plot a single pixel on a 8-bit buffer. | |
void | bmp8_hline (int x1, int y, int x2, u32 clr, void *dstBase, uint dstP) |
Draw a horizontal line on an 8bit buffer. | |
void | bmp8_vline (int x, int y1, int y2, u32 clr, void *dstBase, uint dstP) |
Draw a vertical line on an 8bit buffer. | |
void | bmp8_line (int x1, int y1, int x2, int y2, u32 clr, void *dstBase, uint dstP) |
Draw a line on an 8bit buffer. | |
void | bmp8_rect (int left, int top, int right, int bottom, u32 clr, void *dstBase, uint dstP) |
Draw a rectangle in 8bit mode; internal routine. | |
void | bmp8_frame (int left, int top, int right, int bottom, u32 clr, void *dstBase, uint dstP) |
Draw a rectangle in 8bit mode; internal routine. | |
Generic 16bpp bitmaps | |
void | bmp16_plot (int x, int y, u32 clr, void *dstBase, uint dstP) |
Plot a single pixel on a 16-bit buffer. | |
void | bmp16_hline (int x1, int y, int x2, u32 clr, void *dstBase, uint dstP) |
Draw a horizontal line on an 16bit buffer. | |
void | bmp16_vline (int x, int y1, int y2, u32 clr, void *dstBase, uint dstP) |
Draw a vertical line on an 16bit buffer. | |
void | bmp16_line (int x1, int y1, int x2, int y2, u32 clr, void *dstBase, uint dstP) |
Draw a line on an 16bit buffer. | |
void | bmp16_rect (int left, int top, int right, int bottom, u32 clr, void *dstBase, uint dstP) |
Draw a rectangle in 16bit mode; internal routine. | |
void | bmp16_frame (int left, int top, int right, int bottom, u32 clr, void *dstBase, uint dstP) |
Draw a rectangle in 16bit mode; internal routine. | |
#define BLUE_MASK 0x7C00 |
Rotate nclrs colors at clrs to the right by ror.
#define BLUE_SHIFT 10 |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_CREAM 0x7BFF |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_DEAD 0xDEAD |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_FUCHSIA 0x7C1F |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_GRAY 0x4210 |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_GREEN 0x0200 |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_MAROON 0x0010 |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_MASK 0x001F |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_MEDGRAY 0x5294 |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_MONEYGREEN 0x6378 |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_NAVY 0x4000 |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_OLIVE 0x0210 |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_ORANGE 0x021F |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_PURPLE 0x4010 |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_SILVER 0x6318 |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_SKYBLUE 0x7B34 |
Rotate nclrs colors at clrs to the right by ror.
#define CLR_TEAL 0x4200 |
Rotate nclrs colors at clrs to the right by ror.
#define GREEN_MASK 0x03E0 |
Rotate nclrs colors at clrs to the right by ror.
#define GREEN_SHIFT 5 |
Rotate nclrs colors at clrs to the right by ror.
#define RED_MASK 0x001F |
Rotate nclrs colors at clrs to the right by ror.
#define RED_SHIFT 0 |
Rotate nclrs colors at clrs to the right by ror.
void bmp16_frame | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom, | ||
u32 | clr, | ||
void * | dstBase, | ||
uint | dstP | ||
) |
Draw a rectangle in 16bit mode; internal routine.
left | Left side of rectangle; |
top | Top side of rectangle. |
right | Right side of rectangle. |
bottom | Bottom side of rectangle. |
clr | Color. |
dstBase | Canvas pointer. |
dstP | Canvas pitch in bytes |
References memset16().
Referenced by m3_frame(), m5_frame(), and se_frame().
void bmp16_hline | ( | int | x1, |
int | y, | ||
int | x2, | ||
u32 | clr, | ||
void * | dstBase, | ||
uint | dstP | ||
) |
Draw a horizontal line on an 16bit buffer.
x1 | First X-coord. |
y | Y-coord. |
x2 | Second X-coord. |
clr | Color. |
dstBase | Canvas pointer (halfword-aligned plz). |
dstP | Canvas pitch in bytes. |
References memset16().
Referenced by m3_hline(), m5_hline(), and se_hline().
void bmp16_line | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
u32 | clr, | ||
void * | dstBase, | ||
uint | dstP | ||
) |
void bmp16_plot | ( | int | x, |
int | y, | ||
u32 | clr, | ||
void * | dstBase, | ||
uint | dstP | ||
) |
Plot a single pixel on a 16-bit buffer.
x | X-coord. |
y | Y-coord. |
clr | Color. |
dstBase | Canvas pointer (halfword-aligned plz). |
dstP | Canvas pitch in bytes. |
void bmp16_rect | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom, | ||
u32 | clr, | ||
void * | dstBase, | ||
uint | dstP | ||
) |
Draw a rectangle in 16bit mode; internal routine.
left | Left side of rectangle; |
top | Top side of rectangle. |
right | Right side of rectangle. |
bottom | Bottom side of rectangle. |
clr | Color. |
dstBase | Canvas pointer. |
dstP | Canvas pitch in bytes |
References memset16().
void bmp16_vline | ( | int | x, |
int | y1, | ||
int | y2, | ||
u32 | clr, | ||
void * | dstBase, | ||
uint | dstP | ||
) |
Draw a vertical line on an 16bit buffer.
x | X-coord. |
y1 | First Y-coord. |
y2 | Second Y-coord. |
clr | Color. |
dstBase | Canvas pointer (halfword-aligned plz). |
dstP | Canvas pitch in bytes. |
Referenced by m3_vline(), m5_vline(), and se_vline().
void bmp8_frame | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom, | ||
u32 | clr, | ||
void * | dstBase, | ||
uint | dstP | ||
) |
Draw a rectangle in 8bit mode; internal routine.
left | Left side of rectangle; |
top | Top side of rectangle. |
right | Right side of rectangle. |
bottom | Bottom side of rectangle. |
clr | Color-index. |
dstBase | Canvas pointer. |
dstP | Canvas pitch in bytes |
References bmp8_hline(), and bmp8_vline().
Referenced by m4_frame().
void bmp8_hline | ( | int | x1, |
int | y, | ||
int | x2, | ||
u32 | clr, | ||
void * | dstBase, | ||
uint | dstP | ||
) |
Draw a horizontal line on an 8bit buffer.
x1 | First X-coord. |
y | Y-coord. |
x2 | Second X-coord. |
clr | Color index. |
dstBase | Canvas pointer (halfword-aligned plz). |
dstP | canvas pitch in bytes. |
References dup8(), and memset16().
Referenced by bmp8_frame(), bmp8_line(), and m4_hline().
void bmp8_line | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
u32 | clr, | ||
void * | dstBase, | ||
uint | dstP | ||
) |
Draw a line on an 8bit buffer.
x1 | First X-coord. |
y1 | First Y-coord. |
x2 | Second X-coord. |
y2 | Second Y-coord. |
clr | Color index. |
dstBase | Canvas pointer (halfword-aligned plz). |
dstP | Canvas pitch in bytes. |
References bmp8_hline(), bmp8_plot(), and bmp8_vline().
Referenced by m4_line().
void bmp8_plot | ( | int | x, |
int | y, | ||
u32 | clr, | ||
void * | dstBase, | ||
uint | dstP | ||
) |
Plot a single pixel on a 8-bit buffer.
x | X-coord. |
y | Y-coord. |
clr | Color. |
dstBase | Canvas pointer (halfword-aligned plz). |
dstP | Canvas pitch in bytes. |
Referenced by bmp8_line().
void bmp8_rect | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom, | ||
u32 | clr, | ||
void * | dstBase, | ||
uint | dstP | ||
) |
Draw a rectangle in 8bit mode; internal routine.
left | Left side of rectangle; |
top | Top side of rectangle. |
right | Right side of rectangle. |
bottom | Bottom side of rectangle. |
clr | Color-index. |
dstBase | Canvas pointer. |
dstP | Canvas pitch in bytes |
References memset16().
Referenced by m4_rect().
void bmp8_vline | ( | int | x, |
int | y1, | ||
int | y2, | ||
u32 | clr, | ||
void * | dstBase, | ||
uint | dstP | ||
) |
Draw a vertical line on an 8bit buffer.
x | X-coord. |
y1 | First Y-coord. |
y2 | Second Y-coord. |
clr | Color index. |
dstBase | Canvas pointer (halfword-aligned plz). |
dstP | canvas pitch in bytes. |
Referenced by bmp8_frame(), bmp8_line(), and m4_vline().
Adjust brightness by bright.
Operation: color= color+dB;
dst | Destination color array |
src | Source color array. |
nclrs | Number of colors. |
bright | Brightness difference, dB (in .8f) |
References bf_clamp(), and RGB15().
Adjust contrast by contrast.
Operation: color = color*(1+dC) - MAX*dC/2
dst | Destination color array |
src | Source color array. |
nclrs | Number of colors. |
contrast | Contrast differencem dC (in .8f) |
References bf_clamp(), FIX_ONE, and RGB15().
Adjust intensity by intensity.
Operation: color = (1+dI)*color.
dst | Destination color array |
src | Source color array. |
nclrs | Number of colors. |
intensity | Intensity difference, dI (in .8f) |
References bf_clamp(), FIX_ONE, and RGB15().
Blends color arrays srca and srcb into dst.
Specific transitional blending effects can be created by making a 'target' color array with other routines, then using alpha to morph into it.
srca | Source array A. |
srcb | Source array B |
dst | Destination array. |
nclrs | Number of colors. |
alpha | Blend weight (range: 0-32). 0 Means full srca |
References BLUE_MASK, GREEN_MASK, and RED_MASK.
IWRAM_CODE void clr_blend_fast | ( | COLOR * | srca, |
COLOR * | srcb, | ||
COLOR * | dst, | ||
uint | nclrs, | ||
u32 | alpha | ||
) |
Blends color arrays srca and srcb into dst.
srca | Source array A. |
srcb | Source array B |
dst | Destination array. |
nclrs | Number of colors. |
alpha | Blend weight (range: 0-32). |
Fades color arrays srca to clr into dst.
src | Source array. |
clr | Final color (at alpha=32). |
dst | Destination array. |
nclrs | Number of colors. |
alpha | Blend weight (range: 0-32). 0 Means full srca |
References BLUE_MASK, GREEN_MASK, and RED_MASK.
IWRAM_CODE void clr_fade_fast | ( | COLOR * | src, |
COLOR | clr, | ||
COLOR * | dst, | ||
uint | nclrs, | ||
u32 | alpha | ||
) |
Fades color arrays srca to clr into dst.
src | Source array. |
clr | Final color (at alpha=32). |
dst | Destination array. |
nclrs | Number of colors. |
alpha | Blend weight (range: 0-32). |
Transform colors to grayscale.
dst | Destination color array |
src | Source color array. |
nclrs | Number of colors. |
References RGB15().
Referenced by clr_rgbscale().
Transform colors to an rgb-scale.
clr indicates a color vector in RGB-space. Each source color is converted to a brightness value (i.e., grayscale) and then mapped onto that color vector. A grayscale is a special case of this, using a color with R=G=B.
dst | Destination color array |
src | Source color array. |
nclrs | Number of colors. |
clr | Destination color vector. |
References clr_grayscale(), lu_div(), max(), and RGB15().
void clr_rotate | ( | COLOR * | clrs, |
uint | nclrs, | ||
int | ror | ||
) |
Rotate nclrs colors at clrs to the right by ror.
References Mod().
void pal_gradient | ( | COLOR * | pal, |
int | first, | ||
int | last | ||
) |
Create a gradient between pal[first] and pal[last].
pal | Palette to work on. |
first | First index of gradient. |
last | Last index of gradient. |
Referenced by pal_gradient_ex().
Create a gradient between pal[first] and pal[last].
pal | Palette to work on. |
first | First index of gradient. |
last | Last index of gradient. |
clr_first | Color of first index. |
clr_last | Color of last index. |
References pal_gradient().