5c16e9df442a6a66c91f8cbf52f7543cb9cb4517 braney Mon Dec 6 16:34:22 2021 -0800 add new function to the graphics library to put text in a box that is used by the logo function of wiggle draws diff --git src/inc/vGfx.h src/inc/vGfx.h index a80afc3..8594a2c 100644 --- src/inc/vGfx.h +++ src/inc/vGfx.h @@ -39,30 +39,34 @@ void (*line)(void *v, int x1, int y1, int x2, int y2, int colorIx); /* Draw a line from one point to another. */ void (*text)(void *v, int x, int y, int colorIx, void *font, char *text); /* Draw a line of text with upper left corner x,y. */ void (*textRight)(void *v, int x, int y, int width, int height, int colorIx, void *font, char *text); /* Draw a line of text right justified in box defined by x/y/width/height */ void (*textCentered)(void *v, int x, int y, int width, int height, int colorIx, void *font, char *text); /* Draw a line of text in middle of box. */ + void (*textInBox)(void *v, int x, int y, int width, int height, + int colorIx, void *font, char *text); + /* Draw text that fills a box. */ + int (*findColorIx)(void *v, int r, int g, int b); /* Find color in map if possible, otherwise create new color or * in a pinch a close color. */ struct rgbColor (*colorIxToRgb)(void *v, int colorIx); /* Return rgb values for given color index. */ void (*setWriteMode)(void *v, unsigned int writeMode); /* Set write mode. */ void (*setClip)(void *v, int x, int y, int width, int height); /* Set clipping rectangle. */ void (*unclip)(void *v); /* Set clipping rect cover full thing. */ @@ -141,30 +145,34 @@ #define vgLine(v,x1,y1,x2,y2,color) v->line(v->data,x1,y1,x2,y2,color) /* Draw a line from one point to another. */ #define vgText(v,x,y,color,font,string) v->text(v->data,x,y,color,font,string) /* Draw a line of text with upper left corner x,y. */ #define vgTextRight(v,x,y,width,height,color,font,string) \ v->textRight(v->data,x,y,width,height,color,font,string) /* Draw a line of text right justified in box defined by x/y/width/height */ #define vgTextCentered(v,x,y,width,height,color,font,string) \ v->textCentered(v->data,x,y,width,height,color,font,string) /* Draw a line of text in middle of box. */ +#define vgTextInBox(v,x,y,width,height,color,font,string) \ + v->textInBox(v->data,x,y,width,height,color,font,string) +/* Draw text that fills a box. */ + #define vgFindColorIx(v,r,g,b) v->findColorIx(v->data, r, g, b) /* Find index of RGB color. */ #define vgColorIxToRgb(v,colorIx) v->colorIxToRgb(v->data, colorIx) /* Return rgb values for given color index. */ #define vgSetWriteMode(v, writeMode) \ v->setWriteMode(v->data, writeMode) /* Set write mode. */ #define vgSetClip(v,x,y,width,height) \ v->setClip(v->data, x, y, width, height) /* Set clipping rectangle. */ #define vgUnclip(v) v->unclip(v->data);