libg15render
|
Go to the source code of this file.
Functions | |
void | g15r_drawBar (g15canvas *canvas, int x1, int y1, int x2, int y2, int color, int num, int max, int type) |
Draws a completion bar. | |
void | g15r_drawBigNum (g15canvas *canvas, unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, int color, int num) |
Draw a large number. | |
void | g15r_drawCircle (g15canvas *canvas, int x, int y, int r, int fill, int color) |
Draws a circle centered at (x, y) with a radius of r. | |
void | g15r_drawIcon (g15canvas *canvas, char *buf, int my_x, int my_y, int width, int height) |
Draw an icon to the screen from a wbmp buffer. | |
void | g15r_drawLine (g15canvas *canvas, int px1, int py1, int px2, int py2, const int color) |
Draws a line from (px1, py1) to (px2, py2) | |
void | g15r_drawRoundBox (g15canvas *canvas, int x1, int y1, int x2, int y2, int fill, int color) |
Draws a box with rounded corners bounded by (x1, y1) and (x2, y2) | |
void | g15r_drawSprite (g15canvas *canvas, char *buf, int my_x, int my_y, int width, int height, int start_x, int start_y, int total_width) |
Draw a sprite to the screen from a wbmp buffer. | |
int | g15r_loadWbmpSplash (g15canvas *canvas, char *filename) |
Draw a splash screen from 160x43 wbmp file. | |
char * | g15r_loadWbmpToBuf (char *filename, int *img_width, int *img_height) |
Load a wbmp file into a buffer. | |
void | g15r_pixelBox (g15canvas *canvas, int x1, int y1, int x2, int y2, int color, int thick, int fill) |
Draws a box bounded by (x1, y1) and (x2, y2) | |
void | g15r_pixelOverlay (g15canvas *canvas, int x1, int y1, int width, int height, short colormap[]) |
Overlays a bitmap of size width x height starting at (x1, y1) | |
void | g15r_pixelReverseFill (g15canvas *canvas, int x1, int y1, int x2, int y2, int fill, int color) |
Fills an area bounded by (x1, y1) and (x2, y2) | |
void | swap (int *x, int *y) |
void g15r_drawBar | ( | g15canvas * | canvas, |
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | color, | ||
int | num, | ||
int | max, | ||
int | type | ||
) |
Draws a completion bar.
Given a maximum value, and a value between 0 and that maximum value, calculate and draw a bar showing that percentage.
canvas | A pointer to a g15canvas struct in which the buffer to be operated on is found. |
x1 | Defines leftmost bound of the bar. |
y1 | Defines uppermost bound of the bar. |
x2 | Defines rightmost bound of the bar. |
y2 | Defines bottommost bound of the bar. |
color | The bar will be drawn this color. |
num | Number of units relative to max filled. |
max | Number of units equal to 100% filled. |
type | Type of bar. 1=solid bar, 2=solid bar with border, 3 = solid bar with I-frame. |
Definition at line 337 of file pixel.c.
References g15r_drawLine(), and g15r_pixelBox().
void g15r_drawBigNum | ( | g15canvas * | canvas, |
unsigned int | x1, | ||
unsigned int | y1, | ||
unsigned int | x2, | ||
unsigned int | y2, | ||
int | color, | ||
int | num | ||
) |
Draw a large number.
Draw a large number to a canvas
canvas | A pointer to a g15canvas struct in which the buffer to be operated on is found. |
x1 | Defines leftmost bound of the number. |
y1 | Defines uppermost bound of the number. |
x2 | Defines rightmost bound of the number. |
y2 | Defines bottommost bound of the number. |
num | The number to be drawn. |
Definition at line 545 of file pixel.c.
References g15r_pixelBox().
void g15r_drawCircle | ( | g15canvas * | canvas, |
int | x, | ||
int | y, | ||
int | r, | ||
int | fill, | ||
int | color | ||
) |
Draws a circle centered at (x, y) with a radius of r.
Draws a circle centered at (x, y) with a radius of r.
The circle will be filled if fill != 0.
canvas | A pointer to a g15canvas struct in which the buffer to be operated on is found. |
x | Defines horizontal center of the circle. |
y | Defines vertical center of circle. |
r | Defines radius of circle. |
fill | The circle will be filled with color if fill != 0. |
color | Lines defining the circle will be drawn this color. |
Definition at line 203 of file pixel.c.
References g15r_drawLine(), and g15r_setPixel().
void g15r_drawIcon | ( | g15canvas * | canvas, |
char * | buf, | ||
int | my_x, | ||
int | my_y, | ||
int | width, | ||
int | height | ||
) |
Draw an icon to the screen from a wbmp buffer.
Draw an icon to a canvas
canvas | A pointer to a g15canvas struct in which the buffer to be operated in is found. |
buf | A pointer to the buffer holding the icon to be displayed. |
my_x | Leftmost boundary of image. |
my_y | Topmost boundary of image. |
width | Width of the image in buf. |
height | Height of the image in buf. |
Definition at line 411 of file pixel.c.
References BYTE_SIZE, and g15r_setPixel().
void g15r_drawLine | ( | g15canvas * | canvas, |
int | px1, | ||
int | py1, | ||
int | px2, | ||
int | py2, | ||
const int | color | ||
) |
Draws a line from (px1, py1) to (px2, py2)
A line of color is drawn from (px1, py1) to (px2, py2).
canvas | A pointer to a g15canvas struct in which the buffer to be operated on is found. |
px1 | X component of point 1. |
py1 | Y component of point 1. |
px2 | X component of point 2. |
py2 | Y component of point 2. |
color | Line will be drawn this color. |
Definition at line 99 of file pixel.c.
References g15r_setPixel(), and swap().
Referenced by g15r_drawBar(), g15r_drawCircle(), g15r_drawRoundBox(), and g15r_pixelBox().
void g15r_drawRoundBox | ( | g15canvas * | canvas, |
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | fill, | ||
int | color | ||
) |
Draws a box with rounded corners bounded by (x1, y1) and (x2, y2)
Draws a rounded box around the area bounded by (x1, y1) and (x2, y2).
The box will be filled if fill != 0.
canvas | A pointer to a g15canvas struct in which the buffer to be operated on is found. |
x1 | Defines leftmost bound of the box. |
y1 | Defines uppermost bound of the box. |
x2 | Defines rightmost bound of the box. |
y2 | Defines bottommost bound of the box. |
fill | The box will be filled with color if fill != 0. |
color | Lines defining the box will be drawn this color. |
Definition at line 252 of file pixel.c.
References G15_COLOR_BLACK, G15_COLOR_WHITE, g15r_drawLine(), and g15r_setPixel().
void g15r_drawSprite | ( | g15canvas * | canvas, |
char * | buf, | ||
int | my_x, | ||
int | my_y, | ||
int | width, | ||
int | height, | ||
int | start_x, | ||
int | start_y, | ||
int | total_width | ||
) |
Draw a sprite to the screen from a wbmp buffer.
Draw a sprite to a canvas
canvas | A pointer to a g15canvas struct in which the buffer to be operated in is found. |
buf | A pointer to the buffer holding a set of sprites. |
my_x | Leftmost boundary of image. |
my_y | Topmost boundary of image. |
width | Width of the sprite. |
height | Height of the sprite. |
start_x | X offset for reading sprite from buf. |
start_y | Y offset for reading sprite from buf. |
total_width | Width of the set of sprites held in buf. |
Definition at line 443 of file pixel.c.
References BYTE_SIZE, and g15r_setPixel().
int g15r_loadWbmpSplash | ( | g15canvas * | canvas, |
char * | filename | ||
) |
Draw a splash screen from 160x43 wbmp file.
wbmp splash screen loader - assumes image is 160x43
canvas | A pointer to a g15canvas struct in which the buffer to be operated on is found. |
filename | A string holding the path to the wbmp to be displayed. |
Definition at line 387 of file pixel.c.
References g15canvas::buffer, G15_BUFFER_LEN, and g15r_loadWbmpToBuf().
char* g15r_loadWbmpToBuf | ( | char * | filename, |
int * | img_width, | ||
int * | img_height | ||
) |
Load a wbmp file into a buffer.
basic wbmp loader - loads a wbmp image into a buffer.
filename | A string holding the path to the wbmp to be loaded. |
img_width | A pointer to an int that will hold the image width on return. |
img_height | A pointer to an int that will hold the image height on return. |
Definition at line 469 of file pixel.c.
References BYTE_SIZE.
Referenced by g15r_loadWbmpSplash().
void g15r_pixelBox | ( | g15canvas * | canvas, |
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | color, | ||
int | thick, | ||
int | fill | ||
) |
Draws a box bounded by (x1, y1) and (x2, y2)
Draws a box around the area bounded by (x1, y1) and (x2, y2).
The box will be filled if fill != 0 and the sides will be thick pixels wide.
canvas | A pointer to a g15canvas struct in which the buffer to be operated on is found. |
x1 | Defines leftmost bound of the box. |
y1 | Defines uppermost bound of the box. |
x2 | Defines rightmost bound of the box. |
y2 | Defines bottommost bound of the box. |
color | Lines defining the box will be drawn this color. |
thick | Lines defining the box will be this many pixels thick. |
fill | The box will be filled with color if fill != 0. |
Definition at line 163 of file pixel.c.
References g15r_drawLine(), and g15r_setPixel().
Referenced by g15r_drawBar(), and g15r_drawBigNum().
void g15r_pixelOverlay | ( | g15canvas * | canvas, |
int | x1, | ||
int | y1, | ||
int | width, | ||
int | height, | ||
short | colormap[] | ||
) |
Overlays a bitmap of size width x height starting at (x1, y1)
A 1-bit bitmap defined in colormap[] is drawn to the canvas with an upper left corner at (x1, y1) and a lower right corner at (x1+width, y1+height).
canvas | A pointer to a g15canvas struct in which the buffer to be operated on is found. |
x1 | Defines the leftmost bound of the area to be drawn. |
y1 | Defines the uppermost bound of the area to be drawn. |
width | Defines the width of the bitmap to be drawn. |
height | Defines the height of the bitmap to be drawn. |
colormap | An array containing width*height entries of value 0 for pixel off or != 0 for pixel on. |
Definition at line 74 of file pixel.c.
References G15_COLOR_BLACK, G15_COLOR_WHITE, and g15r_setPixel().
void g15r_pixelReverseFill | ( | g15canvas * | canvas, |
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
int | fill, | ||
int | color | ||
) |
Fills an area bounded by (x1, y1) and (x2, y2)
The area with an upper left corner at (x1, y1) and lower right corner at (x2, y2) will be filled with color if fill>0 or the current contents of the area will be reversed if fill==0.
canvas | A pointer to a g15canvas struct in which the buffer to be operated on is found. |
x1 | Defines leftmost bound of area to be filled. |
y1 | Defines uppermost bound of area to be filled. |
x2 | Defines rightmost bound of area to be filled. |
y2 | Defines bottommost bound of area to be filled. |
fill | Area will be filled with color if fill != 0, else contents of area will have color values reversed. |
color | If fill != 0, then area will be filled if color == 1 and emptied if color == 0. |
Definition at line 45 of file pixel.c.
References g15r_getPixel(), and g15r_setPixel().
void swap | ( | int * | x, |
int * | y | ||
) |
Definition at line 23 of file pixel.c.
Referenced by g15r_drawLine().