Import Upstream version 1.3.0~svn316
This commit is contained in:
1 parent
0f94383c26
commit
f836fd86a6
53 files changed
+1199
-4882
No files matched your search
+68
-8
@@ -18,6 +18,9 @@ extern "C"
|
||||
#include FT_BITMAP_H
|
||||
#endif
|
||||
|
||||
#define G15R_FONT_SUPPORT 1
|
||||
#define G15R_FONT_API_V2 1
|
||||
|
||||
#define BYTE_SIZE 8
|
||||
#define G15_BUFFER_LEN 1048
|
||||
#define G15_LCD_OFFSET 32
|
||||
@@ -28,10 +31,17 @@ extern "C"
|
||||
#define G15_TEXT_SMALL 0
|
||||
#define G15_TEXT_MED 1
|
||||
#define G15_TEXT_LARGE 2
|
||||
#define G15_TEXT_HUGE 3
|
||||
#define G15_PIXEL_NOFILL 0
|
||||
#define G15_PIXEL_FILL 1
|
||||
#define G15_MAX_FACE 5
|
||||
#define G15_FONT_HEADER_SIZE 15
|
||||
#define G15_CHAR_HEADER_SIZE 4
|
||||
#define G15_MAX_GLYPH 256
|
||||
|
||||
#define G15_JUSTIFY_LEFT 0
|
||||
#define G15_JUSTIFY_CENTER 1
|
||||
#define G15_JUSTIFY_RIGHT 2
|
||||
/** \brief This structure holds the data need to render objects to the LCD screen.*/
|
||||
typedef struct g15canvas
|
||||
{
|
||||
@@ -50,6 +60,36 @@ extern "C"
|
||||
#endif
|
||||
} g15canvas;
|
||||
|
||||
/** \brief Structure holding glyph data for g15render font types */
|
||||
typedef struct g15glyph {
|
||||
/** g15glyph::buffer holds glyph data */
|
||||
unsigned char *buffer;
|
||||
/** g15glyph::width - width of the glyph, without padding */
|
||||
unsigned char width;
|
||||
/** g15glyph::gap - recommended gap between this character and the next */
|
||||
unsigned char gap;
|
||||
}g15glyph;
|
||||
|
||||
/** \brief Structure holding a single font. One g15font struct is needed per size. */
|
||||
typedef struct g15font {
|
||||
/** g15font::font_height - total max height of font in pixels */
|
||||
unsigned int font_height;
|
||||
/** g15font::ascender_height - height in pixels from baseline to the top pixel of an ascender character */
|
||||
unsigned int ascender_height;
|
||||
/** g15font::lineheight - height in pixels from decender to ascender */
|
||||
unsigned int lineheight;
|
||||
/** g15font::numchars - number of glyphs available in this font */
|
||||
unsigned int numchars;
|
||||
/** g15font::glyph - contains all glyphs available in this font */
|
||||
g15glyph glyph[G15_MAX_GLYPH]; // allow 256 chars.. ought to be enough for our purposes
|
||||
/** g15font::default_gap - default gap between glyphs (in pixels). */
|
||||
unsigned int default_gap;
|
||||
/** g15font::active - each active glyph is set to 1 else 0 */
|
||||
unsigned char active[G15_MAX_GLYPH];
|
||||
/** g15font::glyph_buffer memory pool for glyphs */
|
||||
char *glyph_buffer;
|
||||
}g15font;
|
||||
|
||||
/** \brief Fills an area bounded by (x1, y1) and (x2, y2)*/
|
||||
void g15r_pixelReverseFill (g15canvas * canvas, int x1, int y1, int x2,
|
||||
int y2, int fill, int color);
|
||||
@@ -81,6 +121,9 @@ void g15r_drawSprite(g15canvas *canvas, char *buf, int my_x, int my_y, int width
|
||||
char *g15r_loadWbmpToBuf(char *filename, int *img_width, int *img_height);
|
||||
/** \brief Draw a large number*/
|
||||
void g15r_drawBigNum (g15canvas * canvas, unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, int color, int num);
|
||||
/** \brief Draw an XBM image*/
|
||||
void
|
||||
g15r_drawXBM (g15canvas *canvas, unsigned char* data, int width, int height, int pos_x, int pos_y);
|
||||
|
||||
/** \brief Gets the value of the pixel at (x, y)*/
|
||||
int g15r_getPixel (g15canvas * canvas, unsigned int x, unsigned int y);
|
||||
@@ -92,13 +135,6 @@ void g15r_drawBigNum (g15canvas * canvas, unsigned int x1, unsigned int y1, unsi
|
||||
/** \brief Clears the canvas and resets the mode switches*/
|
||||
void g15r_initCanvas (g15canvas * canvas);
|
||||
|
||||
/** \brief Font data for the large (8x8) font*/
|
||||
extern unsigned char fontdata_8x8[];
|
||||
/** \brief Font data for the medium (7x5) font*/
|
||||
extern unsigned char fontdata_7x5[];
|
||||
/** \brief Font data for the small (6x4) font*/
|
||||
extern unsigned char fontdata_6x4[];
|
||||
|
||||
/** \brief Renders a character in the large font at (x, y)*/
|
||||
void g15r_renderCharacterLarge (g15canvas * canvas, int x, int y,
|
||||
unsigned char character, unsigned int sx,
|
||||
@@ -116,9 +152,33 @@ void g15r_drawBigNum (g15canvas * canvas, unsigned int x1, unsigned int y1, unsi
|
||||
int row, int size, unsigned int sx,
|
||||
unsigned int sy);
|
||||
|
||||
/** \brief Load G15 font and return it in g15font struct */
|
||||
g15font * g15r_loadG15Font(char *filename);
|
||||
/** \brief Save font in font struct to given file, return 0 on success */
|
||||
int g15r_saveG15Font(char *oFilename, g15font *font);
|
||||
/** \brief De-allocate memory associated with font */
|
||||
void g15r_deleteG15Font(g15font*font);
|
||||
/** \brief Returns length (in pixels) of string if rendered in font 'font' */
|
||||
int g15r_testG15FontWidth(g15font *font,char *string);
|
||||
/** \brief Returns g15font structure containing the default font at requested size if available */
|
||||
g15font * g15r_requestG15DefaultFont (int size);
|
||||
/** \brief render glyph 'character' from loaded font struct 'font'. Returns width (in pixels) of rendered glyph */
|
||||
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);
|
||||
/** \brief Render a string in font 'font' to canvas */
|
||||
void g15r_G15FontRenderString (g15canvas * canvas, g15font *font,
|
||||
char *string,
|
||||
int row, unsigned int sx, unsigned int sy,
|
||||
int colour, int paint_bg);
|
||||
/** \brief Print a string using the G15 default font at size 'size' */
|
||||
void g15r_G15FPrint (g15canvas *canvas, char *string, int x, int y,
|
||||
int size, int center, int colour, int row);
|
||||
|
||||
#ifdef TTF_SUPPORT
|
||||
/** \brief Loads a font through the FreeType2 library*/
|
||||
void g15r_ttfLoad (g15canvas * canvas, char *fontname, int fontsize,
|
||||
int g15r_ttfLoad (g15canvas * canvas, char *fontname, int fontsize,
|
||||
int face_num);
|
||||
/** \brief Prints a string in a given font*/
|
||||
void g15r_ttfPrint (g15canvas * canvas, int x, int y, int fontsize,
|
||||
|
||||
Reference in new issue
Block a user