libg15render.h(3)

πŸ’… libg15render.h β€” Library Functions Manual (section 3)

okay bestie, welcome to the library functions manual for libg15render.h, section 3, and honestly? she's a whole vibe. this is the header that does all the heavy lifting for drawing stuff. let's get into it πŸ’–


✨ NAME ✨

libg15render β€” Render text and graphics to a buffer usable by libg15(3) or g15daemon(1).

like. she renders. she draws. she's the main character of your LCD screen. periodt. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libg15render.h>

🌸 Data Structures 🌸

  • struct g15canvas β€” This structure holds the data need to render objects to the LCD screen. (yes, "need", we're keeping the typo, it's iconic πŸ’€)
  • struct g15font β€” Structure holding a single font.
  • struct g15glyph β€” Structure holding glyph data for g15render font types.

🌈 Defines 🌈

  • #define BYTE_SIZE 8
  • #define G15_BUFFER_LEN 1048
  • #define G15_CHAR_HEADER_SIZE 4
  • #define G15_COLOR_BLACK 1
  • #define G15_COLOR_WHITE 0
  • #define G15_FONT_HEADER_SIZE 15
  • #define G15_LCD_HEIGHT 43
  • #define G15_LCD_OFFSET 32
  • #define G15_LCD_WIDTH 160
  • #define G15_MAX_FACE 5
  • #define G15_MAX_GLYPH 256
  • #define G15_PIXEL_FILL 1
  • #define G15_PIXEL_NOFILL 0
  • #define G15_TEXT_HUGE 3
  • #define G15_TEXT_LARGE 2
  • #define G15_TEXT_MED 1
  • #define G15_TEXT_SMALL 0
  • #define G15R_FONT_SUPPORT 1

πŸ‘‘ Functions πŸ‘‘

  • void g15r_clearScreen (g15canvas *canvas, int color) β€” Fills the screen with pixels of color.
  • void g15r_deleteG15Font (g15font *font) β€” De-allocate memory associated with font.
  • 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.
  • void g15r_drawXBM (g15canvas *canvas, unsigned char *data, int width, int height, int pos_x, int pos_y) β€” Draw an XBM image.
  • void g15r_G15FontRenderString (g15canvas *canvas, g15font *font, char *string, int row, unsigned int sx, unsigned int sy, int colour, int paint_bg) β€” Render a string in font 'font' to canvas.
  • void g15r_G15FPrint (g15canvas *canvas, char *string, int x, int y, int size, int center, int colour, int row) β€” Print a string using the G15 default font at size 'size'.
  • int g15r_getPixel (g15canvas *canvas, unsigned int x, unsigned int y) β€” Gets the value of the pixel at (x, y).
  • void g15r_initCanvas (g15canvas *canvas) β€” Clears the canvas and resets the mode switches.
  • g15font * g15r_loadG15Font (char *filename) β€” Load G15 font and return it in g15font struct.
  • 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 g15r_renderCharacterLarge (g15canvas *canvas, int x, int y, unsigned char character, unsigned int sx, unsigned int sy) β€” Renders a character in the large font at (x, y).
  • void g15r_renderCharacterMedium (g15canvas *canvas, int x, int y, unsigned char character, unsigned int sx, unsigned int sy) β€” Renders a character in the meduim font at (x, y). (she said meduim. we respect her. πŸ’€)
  • void g15r_renderCharacterSmall (g15canvas *canvas, int x, int y, unsigned char character, unsigned int sx, unsigned int sy) β€” Renders a character in the small font at (x, y).
  • int g15r_renderG15Glyph (g15canvas *canvas, g15font *font, unsigned char character, int top_left_pixel_x, int top_left_pixel_y, int colour, int paint_bg) β€” render glyph 'character' from loaded font struct 'font'. Returns width (in pixels) of rendered glyph
  • void g15r_renderString (g15canvas *canvas, unsigned char stringOut[], int row, int size, unsigned int sx, unsigned int sy) β€” Renders a string with font size in row.
  • int g15r_saveG15Font (char *oFilename, g15font *font) β€” Save font in font struct to given file, return 0 on success.
  • void g15r_setPixel (g15canvas *canvas, unsigned int x, unsigned int y, int val) β€” Sets the value of the pixel at (x, y).
  • int g15r_testG15FontWidth (g15font *font, char *string) β€” Returns length (in pixels) of string if rendered in font 'font'.
  • void g15r_ttfLoad (g15canvas *canvas, char *fontname, int fontsize, int face_num) β€” Loads a font through the FreeType2 library.
  • void g15r_ttfPrint (g15canvas *canvas, int x, int y, int fontsize, int face_num, int color, int center, char *print_string) β€” Prints a string in a given font.

🫢 Variables 🫢

  • unsigned char fontdata_6x4 [] β€” Font data for the small (6x4) font.
  • unsigned char fontdata_7x5 [] β€” Font data for the medium (7x5) font.
  • unsigned char fontdata_8x8 [] β€” Font data for the large (8x8) font.

πŸ’– DEFINE DOCUMENTATION πŸ’–

#define BYTE_SIZE 8

Definition at line 23 of file libg15render.h.

Referenced by g15r_drawIcon(), g15r_drawSprite(), g15r_getPixel(), g15r_loadWbmpToBuf(), and g15r_setPixel().

#define G15_BUFFER_LEN 1048

Definition at line 24 of file libg15render.h.

Referenced by g15r_clearScreen(), g15r_initCanvas(), and g15r_loadWbmpSplash().

#define G15_CHAR_HEADER_SIZE 4

Definition at line 38 of file libg15render.h.

Referenced by g15r_loadG15Font(), and g15r_saveG15Font().

#define G15_COLOR_BLACK 1

Definition at line 29 of file libg15render.h.

Referenced by g15r_drawRoundBox(), g15r_drawXBM(), g15r_pixelOverlay(), g15r_renderCharacterLarge(), g15r_renderCharacterMedium(), g15r_renderCharacterSmall(), and g15r_renderString().

#define G15_COLOR_WHITE 0

Definition at line 28 of file libg15render.h.

Referenced by g15r_drawRoundBox(), and g15r_pixelOverlay().

#define G15_FONT_HEADER_SIZE 15

Definition at line 37 of file libg15render.h.

Referenced by g15r_loadG15Font(), and g15r_saveG15Font().

#define G15_LCD_HEIGHT 43

Definition at line 26 of file libg15render.h.

Referenced by g15r_getPixel(), and g15r_setPixel().

#define G15_LCD_OFFSET 32

Definition at line 25 of file libg15render.h.

#define G15_LCD_WIDTH 160

Definition at line 27 of file libg15render.h.

Referenced by g15r_getPixel(), and g15r_setPixel().

#define G15_MAX_FACE 5

Definition at line 36 of file libg15render.h.

Referenced by g15r_ttfLoad().

#define G15_MAX_GLYPH 256

Definition at line 39 of file libg15render.h.

Referenced by g15r_saveG15Font().

#define G15_PIXEL_FILL 1

Definition at line 35 of file libg15render.h.

#define G15_PIXEL_NOFILL 0

Definition at line 34 of file libg15render.h.

#define G15_TEXT_HUGE 3

Definition at line 33 of file libg15render.h.

#define G15_TEXT_LARGE 2

Definition at line 32 of file libg15render.h.

Referenced by g15r_renderCharacterLarge().

#define G15_TEXT_MED 1

Definition at line 31 of file libg15render.h.

Referenced by g15r_renderCharacterMedium().

#define G15_TEXT_SMALL 0

Definition at line 30 of file libg15render.h.

Referenced by g15r_renderCharacterSmall().

#define G15R_FONT_SUPPORT 1

Definition at line 21 of file libg15render.h.


πŸ”₯ FUNCTION DOCUMENTATION πŸ”₯

void g15r_clearScreen (g15canvas * canvas, int color)

Fills the screen with pixels of color.

Clears the screen and fills it with pixels of color

Parameters:

  • canvas β€” A pointer to a g15canvas struct in which the buffer to be operated on is found.
  • color β€” Screen will be filled with this color.

Definition at line 80 of file screen.c.

References g15canvas::buffer, and G15_BUFFER_LEN.

void g15r_deleteG15Font (g15font * font)

De-allocate memory associated with font.

De-allocate memory associated with g15font struct, including glyph buffers

Parameters:

  • font β€” g15font structure containing glyphs.

Definition at line 424 of file text.c.

References g15font::glyph_buffer.

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. slay, honestly. progress bar realness πŸ“Š

Parameters:

  • 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 340 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

Parameters:

  • 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.
  • color β€” The number will be drawn this color.
  • num β€” The number to be drawn.

Definition at line 548 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.

and that's where part 1 of this lil journey stops, bestie β€” more parts are coming, don't you dare go anywhere 🫢✨

Parameters

  • canvas β€” A pointer to a g15canvas struct in which the buffer to be operated on is found. (like, the canvas is where the magic happens ✨)
  • 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 206 of file pixel.c.
References g15r_drawLine(), and g15r_setPixel().

g15r_drawIcon

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. πŸ’…

Parameters

  • canvas β€” A pointer to a g15canvas struct in which the buffer to be operated in is found. (yes, "operated in" β€” that's what the original says, no cap)
  • 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 413 of file pixel.c.
References BYTE_SIZE, and g15r_setPixel().

g15r_drawLine

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). slay

A line of color is drawn from (px1, py1) to (px2, py2).

Parameters

  • 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 102 of file pixel.c.
References g15r_setPixel(), and swap().
Referenced by g15r_drawBar(), g15r_drawCircle(), g15r_drawRoundBox(), and g15r_pixelBox().

g15r_drawRoundBox

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). rounded corners? it's giving soft girl aesthetic πŸ’–

Draws a rounded box around the area bounded by (x1, y1) and (x2, y2).

The box will be filled if fill != 0.

Parameters

  • 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 255 of file pixel.c.
References G15_COLOR_BLACK, G15_COLOR_WHITE, g15r_drawLine(), and g15r_setPixel().

g15r_drawSprite

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. sprite? like a little pixel fairy 🧚

Draw a sprite to a canvas.

Parameters

  • 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 445 of file pixel.c.
References BYTE_SIZE, and g15r_setPixel().

g15r_drawXBM

void g15r_drawXBM (g15canvas * canvas, unsigned char * data, int width, int
    height, int pos_x, int pos_y)

Draw an XBM image. XBM? iconic.

Draw an XBM Image to the canvas.

Parameters

  • canvas β€” A pointer to a g15canvas struct in which the buffer to be operated in is found.
  • data β€” A pointer to the buffer holding the icon to be displayed.
  • width β€” Width of the image in data.
  • height β€” Height of the image in data.
  • pos_x β€” Leftmost boundary of image.
  • pos_y β€” Topmost boundary of image.
Definition at line 625 of file pixel.c.
References G15_COLOR_BLACK, and g15r_setPixel().

g15r_G15FontRenderString

void g15r_G15FontRenderString (g15canvas * canvas, g15font * font, char *
    string, int row, unsigned int sx, unsigned int sy, int colour, int
    paint_bg)

Render a string in font font to canvas. font goals πŸ’…

Render a string in given font.

Parameters

  • canvas β€” A pointer to a g15canvas struct in which the buffer to be operated on is found.
  • font β€” Loaded g15font structure as returned by g15r_loadG15Font()
  • string β€” Pointer to string to operate on.
  • row β€” vertical font-dependent row to start printing on. can usually be left at 0
  • sx β€” horizontal top-left pixel location.
  • sy β€” vertical top-left pixel location.
  • colour β€” desired colour of character when rendered.
  • paint_bg β€” if !0, pixels in the glyph background will also be painted, obstructing any image behind the text.
Definition at line 512 of file text.c.
References g15font::ascender_height, and g15r_renderG15Glyph().
Referenced by g15r_G15FPrint().

g15r_G15FPrint

void g15r_G15FPrint (g15canvas * canvas, char * string, int x, int y, int
    size, int center, int colour, int row)

Print a string using the G15 default font at size size. default font but make it fashion

Render a string in the default font.

Parameters

  • canvas β€” A pointer to a g15canvas struct in which the buffer to be operated on is found.
  • string β€” Pointer to string to operate on.
  • x β€” horizontal top-left pixel location.
  • y β€” vertical top-left pixel location.
  • size β€” if size>= 4, denotes height in pixels. if size<4, standard font sizes are used.
  • center β€” Desired text justification. 0==left, 1==centered, 2==right justified.
  • colour β€” desired colour of character when rendered.
  • row β€” vertical font-dependent row to start printing on. can usually be left at 0
Definition at line 535 of file text.c.
References g15r_G15FontRenderString(), g15r_loadG15Font(), and g15r_testG15FontWidth().
Referenced by g15r_renderCharacterLarge(), g15r_renderCharacterMedium(), g15r_renderCharacterSmall(), g15r_renderString(), and g15r_ttfPrint().

g15r_getPixel

int g15r_getPixel (g15canvas * canvas, unsigned int x, unsigned int y)

Gets the value of the pixel at (x, y). peekaboo pixel πŸ‘€

Retrieves the value of the pixel at (x, y)

Parameters

  • canvas β€” A pointer to a g15canvas struct in which the buffer to be operated on is found.
  • x β€” X offset for pixel to be retrieved.
  • y β€” Y offset for pixel to be retrieved.
Definition at line 29 of file screen.c.
References g15canvas::buffer, BYTE_SIZE, G15_LCD_HEIGHT, and G15_LCD_WIDTH.
Referenced by g15r_pixelReverseFill(), and g15r_setPixel().

g15r_initCanvas

void g15r_initCanvas (g15canvas * canvas)

Clears the canvas and resets the mode switches. fresh start, clean slate ✨

Clears the screen and resets the mode values for a canvas.

Parameters

  • canvas β€” A pointer to a g15canvas struct
Definition at line 91 of file screen.c.
References g15canvas::buffer, g15canvas::ftLib, G15_BUFFER_LEN, g15canvas::mode_cache, g15canvas::mode_reverse, and g15canvas::mode_xor.

g15r_loadG15Font

g15font* g15r_loadG15Font (char * filename)

Load G15 font and return it in g15font struct. font loading, but make it return a pointer πŸ’…

Load a g15 font from file.

Parameters

  • filename β€” string containing full name and location of font to load.

Returns

  • pointer to completed g15font structure.
Definition at line 286 of file text.c.
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.
Referenced by g15r_G15FPrint().

g15r_loadWbmpSplash

int g15r_loadWbmpSplash (g15canvas * canvas, char * filename)

Draw a splash screen from 160x43 wbmp file. splash screen era πŸ’–

wbmp splash screen loader - assumes image is 160x43

Parameters

  • 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 389 of file pixel.c.
References g15canvas::buffer, G15_BUFFER_LEN, and g15r_loadWbmpToBuf().

g15r_loadWbmpToBuf

char* g15r_loadWbmpToBuf (char * filename, int * img_width, int *
    img_height)

Load a wbmp file into a buffer. buffer loading realness

basic wbmp loader - loads a wbmp image into a buffer.

Parameters

  • 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 471 of file pixel.c.
References BYTE_SIZE.
Referenced by g15r_loadWbmpSplash().

g15r_pixelBox

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). box it out πŸ“¦

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.

Parameters

  • 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 166 of file pixel.c.
References g15r_drawLine(), and g15r_setPixel().
Referenced by g15r_drawBar(), and g15r_drawBigNum().

g15r_pixelOverlay

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). overlay slay

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).

Parameters

  • 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 77 of file pixel.c.
References G15_COLOR_BLACK, G15_COLOR_WHITE, and g15r_setPixel().

g15r_pixelReverseFill

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). fill it up πŸ’–

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.


Okay so for the parameters of that function we were just talking about, bestie:

  • canvas β€” a pointer to a g15canvas struct, and that's where the buffer you're operating on is found. πŸ’…
  • x1 β€” defines the leftmost bound of the area to be filled. ✨
  • y1 β€” defines the uppermost bound of the area to be filled. 🌸
  • x2 β€” defines the rightmost bound of the area to be filled. πŸ’–
  • y2 β€” defines the bottommost bound of the area to be filled. πŸ¦‹
  • fill β€” the area will be filled with color if fill != 0; otherwise the contents of the area will have their color values reversed. πŸ”₯
  • color β€” if fill != 0, then the area will be filled if color == 1 and emptied if color == 0. Periodt. πŸ‘‘

Definition at line 48 of file pixel.c.

References g15r_getPixel(), and g15r_setPixel(). πŸ’«


void g15r_renderCharacterLarge (g15canvas * canvas, int col, int row, unsigned char character, unsigned int sx, unsigned int sy) ✨

She renders a character in the large font at (x, y). Like, render a character in the std large font. No cap. πŸ’–

  • canvas β€” a pointer to a g15canvas struct in which the buffer to be operated on is found. πŸ’…
  • col β€” size-dependent column to start rendering. ✨
  • row β€” size-dependent row to start rendering. 🌸
  • character β€” ascii character to render. πŸ¦‹
  • sx β€” horizontal top-left pixel location. πŸ’–
  • sy β€” vertical top-left pixel location. πŸ’œ

Definition at line 33 of file text.c.

References G15_COLOR_BLACK, G15_TEXT_LARGE, and g15r_G15FPrint(). πŸ”₯


void g15r_renderCharacterMedium (g15canvas * canvas, int col, int row, unsigned char character, unsigned int sx, unsigned int sy) πŸŽ€

She renders a character in the meduim font at (x, y). And yeah, the source really does spell it meduim, iconic. Render a character in std medium font. πŸ’…

  • canvas β€” a pointer to a g15canvas struct in which the buffer to be operated on is found. πŸ’–
  • col β€” size-dependent column to start rendering. 🌸
  • row β€” size-dependent row to start rendering. πŸ¦‹
  • character β€” ascii character to render. ✨
  • sx β€” horizontal top-left pixel location. πŸ’œ
  • sy β€” vertical top-left pixel location. 🫢

Definition at line 52 of file text.c.

References G15_COLOR_BLACK, G15_TEXT_MED, and g15r_G15FPrint(). πŸ‘‘


void g15r_renderCharacterSmall (g15canvas * canvas, int col, int row, unsigned char character, unsigned int sx, unsigned int sy) 🌸

She renders a character in the small font at (x, y). Render a character in std small font. So cute, so tiny. 🧚

  • canvas β€” a pointer to a g15canvas struct in which the buffer to be operated on is found. πŸ’…
  • col β€” size-dependent column to start rendering. ✨
  • row β€” size-dependent row to start rendering. πŸ’–
  • character β€” ascii character to render. 🌈
  • sx β€” horizontal top-left pixel location. πŸ¦‹
  • sy β€” vertical top-left pixel location. πŸ’œ

Definition at line 72 of file text.c.

References G15_COLOR_BLACK, G15_TEXT_SMALL, and g15r_G15FPrint(). ⭐


int g15r_renderG15Glyph (g15canvas * canvas, g15font * font, unsigned char character, int top_left_pixel_x, int top_left_pixel_y, int colour, int paint_bg) πŸ’…

She renders the glyph 'character' from the loaded font struct 'font'. Returns the width (in pixels) of the rendered glyph. Main character energy, fr. Render a character in the given font. πŸ’–

  • canvas β€” a pointer to a g15canvas struct in which the buffer to be operated on is found. ✨
  • font β€” loaded g15font structure as returned by g15r_loadG15Font(). 🌸
  • character β€” ascii character to render. πŸ¦‹
  • top_left_pixel_x β€” horizontal top-left pixel location. πŸ’œ
  • top_left_pixel_y β€” vertical top-left pixel location. 🫢
  • colour β€” desired colour of character when rendered. πŸ”₯
  • paint_bg β€” should the background of the character cell be painted? πŸ‘‘

Definition at line 461 of file text.c.

References g15font::ascender_height, g15glyph::buffer, g15font::default_gap, g15font::font_height, g15r_setPixel(), g15font::glyph, and g15glyph::width. πŸ’«

Referenced by g15r_G15FontRenderString(). ✨


void g15r_renderString (g15canvas * canvas, unsigned char stringOut[], int row, int size, unsigned int sx, unsigned int sy) πŸŽ€

She renders a string with font size in row. Render a string in the designated size. Obsessed. πŸ’–

  • canvas β€” a pointer to a g15canvas struct in which the buffer to be operated on is found. πŸ’…
  • stringOut β€” an unsigned char pointer to the string which is to be printed. 🌸
  • row β€” size-dependent row to start rendering. πŸ¦‹
  • size β€” size of printed string. May be 0-3 for standard sizes, or 5-39 in pixel height. πŸ‘‘
  • sx β€” horizontal top-left pixel location. ✨
  • sy β€” vertical top-left pixel location. πŸ’œ

Definition at line 93 of file text.c.

References G15_COLOR_BLACK, and g15r_G15FPrint(). πŸ”₯


int g15r_saveG15Font (char * oFilename, g15font * font) πŸ’Ύ

She saves the font in the font struct to the given file, and returns 0 on success. Save g15font struct to given file. Periodt. πŸ’…

  • oFilename β€” string containing full name and location of font to save. 🌸
  • font β€” g15font structure containing glyphs. Glyphs to be saved should have the corresponding active[glyph] set. πŸ¦‹

Returns: 0 on success, -1 on failure. 😭

Definition at line 361 of file text.c.

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. πŸ’–


void g15r_setPixel (g15canvas * canvas, unsigned int x, unsigned int y, int val) ✨

She sets the value of the pixel at (x, y). Sets the value of the pixel at (x, y). Yes bestie, it's giving exactly what it says. πŸ’…

  • canvas β€” a pointer to a g15canvas struct in which the buffer to be operated on is found. 🌸
  • x β€” X offset for pixel to be set. πŸ¦‹
  • y β€” Y offset for pixel to be set. πŸ’œ
  • val β€” value to which pixel should be set. πŸ‘‘

Definition at line 50 of file screen.c.

References g15canvas::buffer, BYTE_SIZE, G15_LCD_HEIGHT, G15_LCD_WIDTH, g15r_getPixel(), g15canvas::mode_reverse, and g15canvas::mode_xor. πŸ”₯

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(). πŸ’«


int g15r_testG15FontWidth (g15font * font, char * string) πŸ“

She returns the length (in pixels) of string if rendered in font 'font'. Calculate width (in pixels) of given string if rendered in font 'font'. Math queen. πŸ‘‘

  • font β€” loaded g15font structure as returned by g15r_loadG15Font(). 🌸
  • string β€” pointer to string for width calculations. πŸ¦‹

Returns: total width in pixels of given string. πŸ’–

Definition at line 439 of file text.c.

References g15font::default_gap, g15glyph::gap, g15font::glyph, and g15glyph::width. ✨

Referenced by g15r_G15FPrint(). πŸ’…


void g15r_ttfLoad (g15canvas * canvas, char * fontname, int fontsize, int face_num) πŸ¦‹

She loads a font through the FreeType2 library. Load a font for use with FreeType2 font support. Slay. πŸ’–

  • canvas β€” a pointer to a g15canvas struct in which the buffer to be operated on is found. πŸ’…
  • fontname β€” absolute pathname to font file to be loaded. 🌸
  • fontsize β€” size in points for font to be loaded. πŸ¦‹
  • face_num β€” slot into which font face will be loaded. πŸ‘‘

Definition at line 109 of file text.c.

References g15canvas::ftLib, G15_MAX_FACE, g15canvas::ttf_face, and g15canvas::ttf_fontsize. πŸ”₯


void g15r_ttfPrint (g15canvas * canvas, int x, int y, int fontsize, int face_num, int color, int center, char * print_string) πŸŽ€

She prints a string in a given font. Render a string with a FreeType2 font. Ate. πŸ’…

  • canvas β€” a pointer to a g15canvas struct in which the buffer to be operated on is found. 🌸
  • x β€” initial x position for string. πŸ¦‹
  • y β€” initial y position for string. πŸ’œ
  • fontsize β€” size of string in points. ✨
  • face_num β€” font to be used is loaded in this slot. πŸ’–
  • color β€” text will be drawn this color. πŸ”₯
  • center β€” text will be centered if center == 1 and right justified if center == 2. πŸ‘‘
  • print_string β€” pointer to the string to be printed. 🌈

Definition at line 247 of file text.c.

References calc_ttf_centering(), calc_ttf_right_justify(), calc_ttf_true_ypos(), draw_ttf_str(), g15r_G15FPrint(), g15canvas::ttf_face, and g15canvas::ttf_fontsize. πŸ’«


✨ VARIABLE DOCUMENTATION ✨

  • unsigned char fontdata_6x4[] β€” font data for the small (6x4) font. πŸŽ€
  • unsigned char fontdata_7x5[] β€” font data for the medium (7x5) font. πŸ’–
  • unsigned char fontdata_8x8[] β€” font data for the large (8x8) font. 🌈

✨ AUTHOR ✨

Anthony J. Mirabella <mirabeaj@gmail.com> πŸ’Œ

Generated automatically by Doxygen for libg15render from the source code. 🫢


Catch you later, bestie β€” this was libg15render, dated 21 Apr 2009, and it's page libg15render.h(3). Mwah! πŸ’‹