.TH "libg15render.h" 3 "21 Apr 2009" "libg15render" \" -*- nroff -*- .ad l .nh .SH NAME libg15render \- Render text and graphics to a buffer usable by .BR libg15 (3) or .BR g15daemon (1). .SH SYNOPSIS .br .PP \fC#include \fP .br .SS "Data Structures" .in +1c .ti -1c .RI "struct \fBg15canvas\fP" .br .RI "\fIThis structure holds the data need to render objects to the LCD screen. \fP" .ti -1c .RI "struct \fBg15font\fP" .br .RI "\fIStructure holding a single font. \fP" .ti -1c .RI "struct \fBg15glyph\fP" .br .RI "\fIStructure holding glyph data for g15render font types. \fP" .in -1c .SS "Defines" .in +1c .ti -1c .RI "#define \fBBYTE_SIZE\fP 8" .br .ti -1c .RI "#define \fBG15_BUFFER_LEN\fP 1048" .br .ti -1c .RI "#define \fBG15_CHAR_HEADER_SIZE\fP 4" .br .ti -1c .RI "#define \fBG15_COLOR_BLACK\fP 1" .br .ti -1c .RI "#define \fBG15_COLOR_WHITE\fP 0" .br .ti -1c .RI "#define \fBG15_FONT_HEADER_SIZE\fP 15" .br .ti -1c .RI "#define \fBG15_LCD_HEIGHT\fP 43" .br .ti -1c .RI "#define \fBG15_LCD_OFFSET\fP 32" .br .ti -1c .RI "#define \fBG15_LCD_WIDTH\fP 160" .br .ti -1c .RI "#define \fBG15_MAX_FACE\fP 5" .br .ti -1c .RI "#define \fBG15_MAX_GLYPH\fP 256" .br .ti -1c .RI "#define \fBG15_PIXEL_FILL\fP 1" .br .ti -1c .RI "#define \fBG15_PIXEL_NOFILL\fP 0" .br .ti -1c .RI "#define \fBG15_TEXT_HUGE\fP 3" .br .ti -1c .RI "#define \fBG15_TEXT_LARGE\fP 2" .br .ti -1c .RI "#define \fBG15_TEXT_MED\fP 1" .br .ti -1c .RI "#define \fBG15_TEXT_SMALL\fP 0" .br .ti -1c .RI "#define \fBG15R_FONT_SUPPORT\fP 1" .br .in -1c .SS "Functions" .in +1c .ti -1c .RI "void \fBg15r_clearScreen\fP (\fBg15canvas\fP *canvas, int color)" .br .RI "\fIFills the screen with pixels of color. \fP" .ti -1c .RI "void \fBg15r_deleteG15Font\fP (\fBg15font\fP *font)" .br .RI "\fIDe-allocate memory associated with font. \fP" .ti -1c .RI "void \fBg15r_drawBar\fP (\fBg15canvas\fP *canvas, int x1, int y1, int x2, int y2, int color, int num, int max, int type)" .br .RI "\fIDraws a completion bar. \fP" .ti -1c .RI "void \fBg15r_drawBigNum\fP (\fBg15canvas\fP *canvas, unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, int color, int num)" .br .RI "\fIDraw a large number. \fP" .ti -1c .RI "void \fBg15r_drawCircle\fP (\fBg15canvas\fP *canvas, int x, int y, int r, int fill, int color)" .br .RI "\fIDraws a circle centered at (x, y) with a radius of r. \fP" .ti -1c .RI "void \fBg15r_drawIcon\fP (\fBg15canvas\fP *canvas, char *buf, int my_x, int my_y, int width, int height)" .br .RI "\fIDraw an icon to the screen from a wbmp buffer. \fP" .ti -1c .RI "void \fBg15r_drawLine\fP (\fBg15canvas\fP *canvas, int px1, int py1, int px2, int py2, const int color)" .br .RI "\fIDraws a line from (px1, py1) to (px2, py2). \fP" .ti -1c .RI "void \fBg15r_drawRoundBox\fP (\fBg15canvas\fP *canvas, int x1, int y1, int x2, int y2, int fill, int color)" .br .RI "\fIDraws a box with rounded corners bounded by (x1, y1) and (x2, y2). \fP" .ti -1c .RI "void \fBg15r_drawSprite\fP (\fBg15canvas\fP *canvas, char *buf, int my_x, int my_y, int width, int height, int start_x, int start_y, int total_width)" .br .RI "\fIDraw a sprite to the screen from a wbmp buffer. \fP" .ti -1c .RI "void \fBg15r_drawXBM\fP (\fBg15canvas\fP *canvas, unsigned char *data, int width, int height, int pos_x, int pos_y)" .br .RI "\fIDraw an XBM image. \fP" .ti -1c .RI "void \fBg15r_G15FontRenderString\fP (\fBg15canvas\fP *canvas, \fBg15font\fP *font, char *string, int row, unsigned int sx, unsigned int sy, int colour, int paint_bg)" .br .RI "\fIRender a string in font 'font' to canvas. \fP" .ti -1c .RI "void \fBg15r_G15FPrint\fP (\fBg15canvas\fP *canvas, char *string, int x, int y, int size, int center, int colour, int row)" .br .RI "\fIPrint a string using the G15 default font at size 'size'. \fP" .ti -1c .RI "int \fBg15r_getPixel\fP (\fBg15canvas\fP *canvas, unsigned int x, unsigned int y)" .br .RI "\fIGets the value of the pixel at (x, y). \fP" .ti -1c .RI "void \fBg15r_initCanvas\fP (\fBg15canvas\fP *canvas)" .br .RI "\fIClears the canvas and resets the mode switches. \fP" .ti -1c .RI "\fBg15font\fP * \fBg15r_loadG15Font\fP (char *filename)" .br .RI "\fILoad G15 font and return it in \fBg15font\fP struct. \fP" .ti -1c .RI "int \fBg15r_loadWbmpSplash\fP (\fBg15canvas\fP *canvas, char *filename)" .br .RI "\fIDraw a splash screen from 160x43 wbmp file. \fP" .ti -1c .RI "char * \fBg15r_loadWbmpToBuf\fP (char *filename, int *img_width, int *img_height)" .br .RI "\fILoad a wbmp file into a buffer. \fP" .ti -1c .RI "void \fBg15r_pixelBox\fP (\fBg15canvas\fP *canvas, int x1, int y1, int x2, int y2, int color, int thick, int fill)" .br .RI "\fIDraws a box bounded by (x1, y1) and (x2, y2). \fP" .ti -1c .RI "void \fBg15r_pixelOverlay\fP (\fBg15canvas\fP *canvas, int x1, int y1, int width, int height, short colormap[])" .br .RI "\fIOverlays a bitmap of size width x height starting at (x1, y1). \fP" .ti -1c .RI "void \fBg15r_pixelReverseFill\fP (\fBg15canvas\fP *canvas, int x1, int y1, int x2, int y2, int fill, int color)" .br .RI "\fIFills an area bounded by (x1, y1) and (x2, y2). \fP" .ti -1c .RI "void \fBg15r_renderCharacterLarge\fP (\fBg15canvas\fP *canvas, int x, int y, unsigned char character, unsigned int sx, unsigned int sy)" .br .RI "\fIRenders a character in the large font at (x, y). \fP" .ti -1c .RI "void \fBg15r_renderCharacterMedium\fP (\fBg15canvas\fP *canvas, int x, int y, unsigned char character, unsigned int sx, unsigned int sy)" .br .RI "\fIRenders a character in the meduim font at (x, y). \fP" .ti -1c .RI "void \fBg15r_renderCharacterSmall\fP (\fBg15canvas\fP *canvas, int x, int y, unsigned char character, unsigned int sx, unsigned int sy)" .br .RI "\fIRenders a character in the small font at (x, y). \fP" .ti -1c .RI "int \fBg15r_renderG15Glyph\fP (\fBg15canvas\fP *canvas, \fBg15font\fP *font, unsigned char character, int top_left_pixel_x, int top_left_pixel_y, int colour, int paint_bg)" .br .RI "\fIrender glyph 'character' from loaded font struct 'font'. Returns width (in pixels) of rendered glyph \fP" .ti -1c .RI "void \fBg15r_renderString\fP (\fBg15canvas\fP *canvas, unsigned char stringOut[], int row, int size, unsigned int sx, unsigned int sy)" .br .RI "\fIRenders a string with font size in row. \fP" .ti -1c .RI "int \fBg15r_saveG15Font\fP (char *oFilename, \fBg15font\fP *font)" .br .RI "\fISave font in font struct to given file, return 0 on success. \fP" .ti -1c .RI "void \fBg15r_setPixel\fP (\fBg15canvas\fP *canvas, unsigned int x, unsigned int y, int val)" .br .RI "\fISets the value of the pixel at (x, y). \fP" .ti -1c .RI "int \fBg15r_testG15FontWidth\fP (\fBg15font\fP *font, char *string)" .br .RI "\fIReturns length (in pixels) of string if rendered in font 'font'. \fP" .ti -1c .RI "void \fBg15r_ttfLoad\fP (\fBg15canvas\fP *canvas, char *fontname, int fontsize, int face_num)" .br .RI "\fILoads a font through the FreeType2 library. \fP" .ti -1c .RI "void \fBg15r_ttfPrint\fP (\fBg15canvas\fP *canvas, int x, int y, int fontsize, int face_num, int color, int center, char *print_string)" .br .RI "\fIPrints a string in a given font. \fP" .in -1c .SS "Variables" .in +1c .ti -1c .RI "unsigned char \fBfontdata_6x4\fP []" .br .RI "\fIFont data for the small (6x4) font. \fP" .ti -1c .RI "unsigned char \fBfontdata_7x5\fP []" .br .RI "\fIFont data for the medium (7x5) font. \fP" .ti -1c .RI "unsigned char \fBfontdata_8x8\fP []" .br .RI "\fIFont data for the large (8x8) font. \fP" .in -1c .SH "Define Documentation" .PP .SS "#define BYTE_SIZE 8" .PP Definition at line 23 of file libg15render.h. .PP Referenced by g15r_drawIcon(), g15r_drawSprite(), g15r_getPixel(), g15r_loadWbmpToBuf(), and g15r_setPixel(). .SS "#define G15_BUFFER_LEN 1048" .PP Definition at line 24 of file libg15render.h. .PP Referenced by g15r_clearScreen(), g15r_initCanvas(), and g15r_loadWbmpSplash(). .SS "#define G15_CHAR_HEADER_SIZE 4" .PP Definition at line 38 of file libg15render.h. .PP Referenced by g15r_loadG15Font(), and g15r_saveG15Font(). .SS "#define G15_COLOR_BLACK 1" .PP Definition at line 29 of file libg15render.h. .PP Referenced by g15r_drawRoundBox(), g15r_drawXBM(), g15r_pixelOverlay(), g15r_renderCharacterLarge(), g15r_renderCharacterMedium(), g15r_renderCharacterSmall(), and g15r_renderString(). .SS "#define G15_COLOR_WHITE 0" .PP Definition at line 28 of file libg15render.h. .PP Referenced by g15r_drawRoundBox(), and g15r_pixelOverlay(). .SS "#define G15_FONT_HEADER_SIZE 15" .PP Definition at line 37 of file libg15render.h. .PP Referenced by g15r_loadG15Font(), and g15r_saveG15Font(). .SS "#define G15_LCD_HEIGHT 43" .PP Definition at line 26 of file libg15render.h. .PP Referenced by g15r_getPixel(), and g15r_setPixel(). .SS "#define G15_LCD_OFFSET 32" .PP Definition at line 25 of file libg15render.h. .SS "#define G15_LCD_WIDTH 160" .PP Definition at line 27 of file libg15render.h. .PP Referenced by g15r_getPixel(), and g15r_setPixel(). .SS "#define G15_MAX_FACE 5" .PP Definition at line 36 of file libg15render.h. .PP Referenced by g15r_ttfLoad(). .SS "#define G15_MAX_GLYPH 256" .PP Definition at line 39 of file libg15render.h. .PP Referenced by g15r_saveG15Font(). .SS "#define G15_PIXEL_FILL 1" .PP Definition at line 35 of file libg15render.h. .SS "#define G15_PIXEL_NOFILL 0" .PP Definition at line 34 of file libg15render.h. .SS "#define G15_TEXT_HUGE 3" .PP Definition at line 33 of file libg15render.h. .SS "#define G15_TEXT_LARGE 2" .PP Definition at line 32 of file libg15render.h. .PP Referenced by g15r_renderCharacterLarge(). .SS "#define G15_TEXT_MED 1" .PP Definition at line 31 of file libg15render.h. .PP Referenced by g15r_renderCharacterMedium(). .SS "#define G15_TEXT_SMALL 0" .PP Definition at line 30 of file libg15render.h. .PP Referenced by g15r_renderCharacterSmall(). .SS "#define G15R_FONT_SUPPORT 1" .PP Definition at line 21 of file libg15render.h. .SH "Function Documentation" .PP .SS "void g15r_clearScreen (\fBg15canvas\fP * canvas, int color)" .PP Fills the screen with pixels of color. .PP Clears the screen and fills it with pixels of color .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIcolor\fP Screen will be filled with this color. .RE .PP .PP Definition at line 80 of file screen.c. .PP References g15canvas::buffer, and G15_BUFFER_LEN. .PP .SS "void g15r_deleteG15Font (\fBg15font\fP * font)" .PP De-allocate memory associated with font. .PP De-allocate memory associated with \fBg15font\fP struct, including glyph buffers .PP \fBParameters:\fP .RS 4 \fIfont\fP \fBg15font\fP structure containing glyphs. .RE .PP .PP Definition at line 424 of file text.c. .PP References g15font::glyph_buffer. .PP .SS "void g15r_drawBar (\fBg15canvas\fP * canvas, int x1, int y1, int x2, int y2, int color, int num, int max, int type)" .PP Draws a completion bar. .PP Given a maximum value, and a value between 0 and that maximum value, calculate and draw a bar showing that percentage. .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIx1\fP Defines leftmost bound of the bar. .br \fIy1\fP Defines uppermost bound of the bar. .br \fIx2\fP Defines rightmost bound of the bar. .br \fIy2\fP Defines bottommost bound of the bar. .br \fIcolor\fP The bar will be drawn this color. .br \fInum\fP Number of units relative to max filled. .br \fImax\fP Number of units equal to 100% filled. .br \fItype\fP Type of bar. 1=solid bar, 2=solid bar with border, 3 = solid bar with I-frame. .RE .PP .PP Definition at line 340 of file pixel.c. .PP References g15r_drawLine(), and g15r_pixelBox(). .PP .SS "void g15r_drawBigNum (\fBg15canvas\fP * canvas, unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, int color, int num)" .PP Draw a large number. .PP Draw a large number to a canvas .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIx1\fP Defines leftmost bound of the number. .br \fIy1\fP Defines uppermost bound of the number. .br \fIx2\fP Defines rightmost bound of the number. .br \fIy2\fP Defines bottommost bound of the number. .br \fIcolor\fP The number will be drawn this color. .br \fInum\fP The number to be drawn. .RE .PP .PP Definition at line 548 of file pixel.c. .PP References g15r_pixelBox(). .PP .SS "void g15r_drawCircle (\fBg15canvas\fP * canvas, int x, int y, int r, int fill, int color)" .PP Draws a circle centered at (x, y) with a radius of r. .PP Draws a circle centered at (x, y) with a radius of r. .PP The circle will be filled if fill != 0. .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIx\fP Defines horizontal center of the circle. .br \fIy\fP Defines vertical center of circle. .br \fIr\fP Defines radius of circle. .br \fIfill\fP The circle will be filled with color if fill != 0. .br \fIcolor\fP Lines defining the circle will be drawn this color. .RE .PP .PP Definition at line 206 of file pixel.c. .PP References g15r_drawLine(), and g15r_setPixel(). .PP .SS "void g15r_drawIcon (\fBg15canvas\fP * canvas, char * buf, int my_x, int my_y, int width, int height)" .PP Draw an icon to the screen from a wbmp buffer. .PP Draw an icon to a canvas .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated in is found. .br \fIbuf\fP A pointer to the buffer holding the icon to be displayed. .br \fImy_x\fP Leftmost boundary of image. .br \fImy_y\fP Topmost boundary of image. .br \fIwidth\fP Width of the image in buf. .br \fIheight\fP Height of the image in buf. .RE .PP .PP Definition at line 413 of file pixel.c. .PP References BYTE_SIZE, and g15r_setPixel(). .PP .SS "void g15r_drawLine (\fBg15canvas\fP * canvas, int px1, int py1, int px2, int py2, const int color)" .PP Draws a line from (px1, py1) to (px2, py2). .PP A line of color is drawn from (px1, py1) to (px2, py2). .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIpx1\fP X component of point 1. .br \fIpy1\fP Y component of point 1. .br \fIpx2\fP X component of point 2. .br \fIpy2\fP Y component of point 2. .br \fIcolor\fP Line will be drawn this color. .RE .PP .PP Definition at line 102 of file pixel.c. .PP References g15r_setPixel(), and swap(). .PP Referenced by g15r_drawBar(), g15r_drawCircle(), g15r_drawRoundBox(), and g15r_pixelBox(). .PP .SS "void g15r_drawRoundBox (\fBg15canvas\fP * canvas, int x1, int y1, int x2, int y2, int fill, int color)" .PP Draws a box with rounded corners bounded by (x1, y1) and (x2, y2). .PP Draws a rounded box around the area bounded by (x1, y1) and (x2, y2). .PP The box will be filled if fill != 0. .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIx1\fP Defines leftmost bound of the box. .br \fIy1\fP Defines uppermost bound of the box. .br \fIx2\fP Defines rightmost bound of the box. .br \fIy2\fP Defines bottommost bound of the box. .br \fIfill\fP The box will be filled with color if fill != 0. .br \fIcolor\fP Lines defining the box will be drawn this color. .RE .PP .PP Definition at line 255 of file pixel.c. .PP References G15_COLOR_BLACK, G15_COLOR_WHITE, g15r_drawLine(), and g15r_setPixel(). .PP .SS "void g15r_drawSprite (\fBg15canvas\fP * canvas, char * buf, int my_x, int my_y, int width, int height, int start_x, int start_y, int total_width)" .PP Draw a sprite to the screen from a wbmp buffer. .PP Draw a sprite to a canvas .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated in is found. .br \fIbuf\fP A pointer to the buffer holding a set of sprites. .br \fImy_x\fP Leftmost boundary of image. .br \fImy_y\fP Topmost boundary of image. .br \fIwidth\fP Width of the sprite. .br \fIheight\fP Height of the sprite. .br \fIstart_x\fP X offset for reading sprite from buf. .br \fIstart_y\fP Y offset for reading sprite from buf. .br \fItotal_width\fP Width of the set of sprites held in buf. .RE .PP .PP Definition at line 445 of file pixel.c. .PP References BYTE_SIZE, and g15r_setPixel(). .PP .SS "void g15r_drawXBM (\fBg15canvas\fP * canvas, unsigned char * data, int width, int height, int pos_x, int pos_y)" .PP Draw an XBM image. .PP Draw an XBM Image to the canvas .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated in is found. .br \fIdata\fP A pointer to the buffer holding the icon to be displayed. .br \fIwidth\fP Width of the image in data. .br \fIheight\fP Height of the image in data. .br \fIpos_x\fP Leftmost boundary of image. .br \fIpos_y\fP Topmost boundary of image. .RE .PP .PP Definition at line 625 of file pixel.c. .PP References G15_COLOR_BLACK, and g15r_setPixel(). .PP .SS "void g15r_G15FontRenderString (\fBg15canvas\fP * canvas, \fBg15font\fP * font, char * string, int row, unsigned int sx, unsigned int sy, int colour, int paint_bg)" .PP Render a string in font 'font' to canvas. .PP Render a string in given font. .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIfont\fP Loaded \fBg15font\fP structure as returned by \fBg15r_loadG15Font()\fP .br \fIstring\fP Pointer to string to operate on. .br \fIrow\fP vertical font-dependent row to start printing on. can usually be left at 0 .br \fIsx\fP horizontal top-left pixel location. .br \fIsy\fP vertical top-left pixel location. .br \fIcolour\fP desired colour of character when rendered. .br \fIpaint_bg\fP if !0, pixels in the glyph background will also be painted, obstructing any image behind the text. .RE .PP .PP Definition at line 512 of file text.c. .PP References g15font::ascender_height, and g15r_renderG15Glyph(). .PP Referenced by g15r_G15FPrint(). .PP .SS "void g15r_G15FPrint (\fBg15canvas\fP * canvas, char * string, int x, int y, int size, int center, int colour, int row)" .PP Print a string using the G15 default font at size 'size'. .PP Render a string in the default font. .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIstring\fP Pointer to string to operate on. .br \fIx\fP horizontal top-left pixel location. .br \fIy\fP vertical top-left pixel location. .br \fIsize\fP if size>= 4, denotes height in pixels. if size<4, standard font sizes are used. .br \fIcenter\fP Desired text justification. 0==left, 1==centered, 2==right justified. .br \fIcolour\fP desired colour of character when rendered. .br \fIrow\fP vertical font-dependent row to start printing on. can usually be left at 0 .RE .PP .PP Definition at line 535 of file text.c. .PP References g15r_G15FontRenderString(), g15r_loadG15Font(), and g15r_testG15FontWidth(). .PP Referenced by g15r_renderCharacterLarge(), g15r_renderCharacterMedium(), g15r_renderCharacterSmall(), g15r_renderString(), and g15r_ttfPrint(). .PP .SS "int g15r_getPixel (\fBg15canvas\fP * canvas, unsigned int x, unsigned int y)" .PP Gets the value of the pixel at (x, y). .PP Retrieves the value of the pixel at (x, y) .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIx\fP X offset for pixel to be retrieved. .br \fIy\fP Y offset for pixel to be retrieved. .RE .PP .PP Definition at line 29 of file screen.c. .PP References g15canvas::buffer, BYTE_SIZE, G15_LCD_HEIGHT, and G15_LCD_WIDTH. .PP Referenced by g15r_pixelReverseFill(), and g15r_setPixel(). .PP .SS "void g15r_initCanvas (\fBg15canvas\fP * canvas)" .PP Clears the canvas and resets the mode switches. .PP Clears the screen and resets the mode values for a canvas .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct .RE .PP .PP Definition at line 91 of file screen.c. .PP References g15canvas::buffer, g15canvas::ftLib, G15_BUFFER_LEN, g15canvas::mode_cache, g15canvas::mode_reverse, and g15canvas::mode_xor. .PP .SS "\fBg15font\fP* g15r_loadG15Font (char * filename)" .PP Load G15 font and return it in \fBg15font\fP struct. .PP Load a g15 font from file. .PP \fBParameters:\fP .RS 4 \fIfilename\fP string containing full name and location of font to load. .RE .PP \fBReturns:\fP .RS 4 pointer to completed \fBg15font\fP structure. .RE .PP .PP Definition at line 286 of file text.c. .PP References g15font::ascender_height, g15glyph::buffer, g15font::default_gap, g15font::font_height, G15_CHAR_HEADER_SIZE, G15_FONT_HEADER_SIZE, g15glyph::gap, g15font::glyph, g15font::lineheight, g15font::numchars, and g15glyph::width. .PP Referenced by g15r_G15FPrint(). .PP .SS "int g15r_loadWbmpSplash (\fBg15canvas\fP * canvas, char * filename)" .PP Draw a splash screen from 160x43 wbmp file. .PP wbmp splash screen loader - assumes image is 160x43 .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIfilename\fP A string holding the path to the wbmp to be displayed. .RE .PP .PP Definition at line 389 of file pixel.c. .PP References g15canvas::buffer, G15_BUFFER_LEN, and g15r_loadWbmpToBuf(). .PP .SS "char* g15r_loadWbmpToBuf (char * filename, int * img_width, int * img_height)" .PP Load a wbmp file into a buffer. .PP basic wbmp loader - loads a wbmp image into a buffer. .PP \fBParameters:\fP .RS 4 \fIfilename\fP A string holding the path to the wbmp to be loaded. .br \fIimg_width\fP A pointer to an int that will hold the image width on return. .br \fIimg_height\fP A pointer to an int that will hold the image height on return. .RE .PP .PP Definition at line 471 of file pixel.c. .PP References BYTE_SIZE. .PP Referenced by g15r_loadWbmpSplash(). .PP .SS "void g15r_pixelBox (\fBg15canvas\fP * canvas, int x1, int y1, int x2, int y2, int color, int thick, int fill)" .PP Draws a box bounded by (x1, y1) and (x2, y2). .PP Draws a box around the area bounded by (x1, y1) and (x2, y2). .PP The box will be filled if fill != 0 and the sides will be thick pixels wide. .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIx1\fP Defines leftmost bound of the box. .br \fIy1\fP Defines uppermost bound of the box. .br \fIx2\fP Defines rightmost bound of the box. .br \fIy2\fP Defines bottommost bound of the box. .br \fIcolor\fP Lines defining the box will be drawn this color. .br \fIthick\fP Lines defining the box will be this many pixels thick. .br \fIfill\fP The box will be filled with color if fill != 0. .RE .PP .PP Definition at line 166 of file pixel.c. .PP References g15r_drawLine(), and g15r_setPixel(). .PP Referenced by g15r_drawBar(), and g15r_drawBigNum(). .PP .SS "void g15r_pixelOverlay (\fBg15canvas\fP * canvas, int x1, int y1, int width, int height, short colormap[])" .PP Overlays a bitmap of size width x height starting at (x1, y1). .PP 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). .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIx1\fP Defines the leftmost bound of the area to be drawn. .br \fIy1\fP Defines the uppermost bound of the area to be drawn. .br \fIwidth\fP Defines the width of the bitmap to be drawn. .br \fIheight\fP Defines the height of the bitmap to be drawn. .br \fIcolormap\fP An array containing width*height entries of value 0 for pixel off or != 0 for pixel on. .RE .PP .PP Definition at line 77 of file pixel.c. .PP References G15_COLOR_BLACK, G15_COLOR_WHITE, and g15r_setPixel(). .PP .SS "void g15r_pixelReverseFill (\fBg15canvas\fP * canvas, int x1, int y1, int x2, int y2, int fill, int color)" .PP Fills an area bounded by (x1, y1) and (x2, y2). .PP 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. .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIx1\fP Defines leftmost bound of area to be filled. .br \fIy1\fP Defines uppermost bound of area to be filled. .br \fIx2\fP Defines rightmost bound of area to be filled. .br \fIy2\fP Defines bottommost bound of area to be filled. .br \fIfill\fP Area will be filled with color if fill != 0, else contents of area will have color values reversed. .br \fIcolor\fP If fill != 0, then area will be filled if color == 1 and emptied if color == 0. .RE .PP .PP Definition at line 48 of file pixel.c. .PP References g15r_getPixel(), and g15r_setPixel(). .PP .SS "void g15r_renderCharacterLarge (\fBg15canvas\fP * canvas, int col, int row, unsigned char character, unsigned int sx, unsigned int sy)" .PP Renders a character in the large font at (x, y). .PP Render a character in std large font .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIcol\fP size-dependent column to start rendering. .br \fIrow\fP size-dependent row to start rendering. .br \fIcharacter\fP ascii character to render. .br \fIsx\fP horizontal top-left pixel location. .br \fIsy\fP vertical top-left pixel location. .RE .PP .PP Definition at line 33 of file text.c. .PP References G15_COLOR_BLACK, G15_TEXT_LARGE, and g15r_G15FPrint(). .PP .SS "void g15r_renderCharacterMedium (\fBg15canvas\fP * canvas, int col, int row, unsigned char character, unsigned int sx, unsigned int sy)" .PP Renders a character in the meduim font at (x, y). .PP Render a character in std medium font. .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIcol\fP size-dependent column to start rendering. .br \fIrow\fP size-dependent row to start rendering. .br \fIcharacter\fP ascii character to render. .br \fIsx\fP horizontal top-left pixel location. .br \fIsy\fP vertical top-left pixel location. .RE .PP .PP Definition at line 52 of file text.c. .PP References G15_COLOR_BLACK, G15_TEXT_MED, and g15r_G15FPrint(). .PP .SS "void g15r_renderCharacterSmall (\fBg15canvas\fP * canvas, int col, int row, unsigned char character, unsigned int sx, unsigned int sy)" .PP Renders a character in the small font at (x, y). .PP Render a character in std small font. .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIcol\fP size-dependent column to start rendering. .br \fIrow\fP size-dependent row to start rendering. .br \fIcharacter\fP ascii character to render. .br \fIsx\fP horizontal top-left pixel location. .br \fIsy\fP vertical top-left pixel location. .RE .PP .PP Definition at line 72 of file text.c. .PP References G15_COLOR_BLACK, G15_TEXT_SMALL, and g15r_G15FPrint(). .PP .SS "int g15r_renderG15Glyph (\fBg15canvas\fP * canvas, \fBg15font\fP * font, unsigned char character, int top_left_pixel_x, int top_left_pixel_y, int colour, int paint_bg)" .PP render glyph 'character' from loaded font struct 'font'. Returns width (in pixels) of rendered glyph .PP Render a character in given font. .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIfont\fP Loaded \fBg15font\fP structure as returned by \fBg15r_loadG15Font()\fP .br \fIcharacter\fP ascii character to render. .br \fItop_left_pixel_x\fP horizontal top-left pixel location. .br \fItop_left_pixel_y\fP vertical top-left pixel location. .br \fIcolour\fP desired colour of character when rendered. .br \fIpaint_bg\fP should the background of the character cell be painted? .RE .PP .PP Definition at line 461 of file text.c. .PP References g15font::ascender_height, g15glyph::buffer, g15font::default_gap, g15font::font_height, g15r_setPixel(), g15font::glyph, and g15glyph::width. .PP Referenced by g15r_G15FontRenderString(). .PP .SS "void g15r_renderString (\fBg15canvas\fP * canvas, unsigned char stringOut[], int row, int size, unsigned int sx, unsigned int sy)" .PP Renders a string with font size in row. .PP Render a string in the designated size .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIstringOut\fP An unsigned char pointer to the string which is to be printed. .br \fIrow\fP size-dependent row to start rendering. .br \fIsize\fP size of printed string. May be 0-3 for standard sizes, or 5-39 in pixel height. .br \fIsx\fP horizontal top-left pixel location. .br \fIsy\fP vertical top-left pixel location. .RE .PP .PP Definition at line 93 of file text.c. .PP References G15_COLOR_BLACK, and g15r_G15FPrint(). .PP .SS "int g15r_saveG15Font (char * oFilename, \fBg15font\fP * font)" .PP Save font in font struct to given file, return 0 on success. .PP Save \fBg15font\fP struct to given file. .PP \fBParameters:\fP .RS 4 \fIoFilename\fP string containing full name and location of font to save. .br \fIfont\fP \fBg15font\fP structure containing glyphs. Glyphs to be saved should have the corresponding active[glyph] set. .RE .PP \fBReturns:\fP .RS 4 0 on success, -1 on failure. .RE .PP .PP Definition at line 361 of file text.c. .PP References g15font::active, g15font::ascender_height, g15glyph::buffer, g15font::default_gap, g15font::font_height, G15_CHAR_HEADER_SIZE, G15_FONT_HEADER_SIZE, G15_MAX_GLYPH, g15font::glyph, g15font::lineheight, g15font::numchars, and g15glyph::width. .PP .SS "void g15r_setPixel (\fBg15canvas\fP * canvas, unsigned int x, unsigned int y, int val)" .PP Sets the value of the pixel at (x, y). .PP Sets the value of the pixel at (x, y) .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIx\fP X offset for pixel to be set. .br \fIy\fP Y offset for pixel to be set. .br \fIval\fP Value to which pixel should be set. .RE .PP .PP Definition at line 50 of file screen.c. .PP References g15canvas::buffer, BYTE_SIZE, G15_LCD_HEIGHT, G15_LCD_WIDTH, g15r_getPixel(), g15canvas::mode_reverse, and g15canvas::mode_xor. .PP Referenced by draw_ttf_char(), g15r_drawCircle(), g15r_drawIcon(), g15r_drawLine(), g15r_drawRoundBox(), g15r_drawSprite(), g15r_drawXBM(), g15r_pixelBox(), g15r_pixelOverlay(), g15r_pixelReverseFill(), and g15r_renderG15Glyph(). .PP .SS "int g15r_testG15FontWidth (\fBg15font\fP * font, char * string)" .PP Returns length (in pixels) of string if rendered in font 'font'. .PP Calculate width (in pixels) of given string if rendered in font 'font'. .PP \fBParameters:\fP .RS 4 \fIfont\fP Loaded \fBg15font\fP structure as returned by \fBg15r_loadG15Font()\fP .br \fIstring\fP Pointer to string for width calculations. .RE .PP \fBReturns:\fP .RS 4 total width in pixels of given string. .RE .PP .PP Definition at line 439 of file text.c. .PP References g15font::default_gap, g15glyph::gap, g15font::glyph, and g15glyph::width. .PP Referenced by g15r_G15FPrint(). .PP .SS "void g15r_ttfLoad (\fBg15canvas\fP * canvas, char * fontname, int fontsize, int face_num)" .PP Loads a font through the FreeType2 library. .PP Load a font for use with FreeType2 font support .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIfontname\fP Absolute pathname to font file to be loaded. .br \fIfontsize\fP Size in points for font to be loaded. .br \fIface_num\fP Slot into which font face will be loaded. .RE .PP .PP Definition at line 109 of file text.c. .PP References g15canvas::ftLib, G15_MAX_FACE, g15canvas::ttf_face, and g15canvas::ttf_fontsize. .PP .SS "void g15r_ttfPrint (\fBg15canvas\fP * canvas, int x, int y, int fontsize, int face_num, int color, int center, char * print_string)" .PP Prints a string in a given font. .PP Render a string with a FreeType2 font .PP \fBParameters:\fP .RS 4 \fIcanvas\fP A pointer to a \fBg15canvas\fP struct in which the buffer to be operated on is found. .br \fIx\fP initial x position for string. .br \fIy\fP initial y position for string. .br \fIfontsize\fP Size of string in points. .br \fIface_num\fP Font to be used is loaded in this slot. .br \fIcolor\fP Text will be drawn this color. .br \fIcenter\fP Text will be centered if center == 1 and right justified if center == 2. .br \fIprint_string\fP Pointer to the string to be printed. .RE .PP .PP Definition at line 247 of file text.c. .PP References calc_ttf_centering(), calc_ttf_right_justify(), calc_ttf_true_ypos(), draw_ttf_str(), g15r_G15FPrint(), g15canvas::ttf_face, and g15canvas::ttf_fontsize. .PP .SH "Variable Documentation" .PP .SS "unsigned char \fBfontdata_6x4\fP[]" .PP Font data for the small (6x4) font. .PP .SS "unsigned char \fBfontdata_7x5\fP[]" .PP Font data for the medium (7x5) font. .PP .SS "unsigned char \fBfontdata_8x8\fP[]" .PP Font data for the large (8x8) font. .PP .SH "Author" .PP Anthony J. Mirabella .PP Generated automatically by Doxygen for libg15render from the source code.