X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=ui%2Foswald_graphics.c;h=e64476d61ed50f26a8c1cc4e886a3b7c0f040591;hb=c0fd05511a605f063a175d5d99c56af92b65422b;hp=a6eb14f9dfd50191705b71c4c4d0e3198f4a8e55;hpb=5d0ff002cee35d109f4a60eff415b2db556fb8f4;p=oswald.git diff --git a/ui/oswald_graphics.c b/ui/oswald_graphics.c index a6eb14f..e64476d 100644 --- a/ui/oswald_graphics.c +++ b/ui/oswald_graphics.c @@ -1,23 +1,83 @@ -#include "oswald-ui.h" +#include "oswald.h" #include "oswald_strings.h" #include "oswald_fonts.h" +#include "oswald_hal.h" #include "oswald_graphics.h" -void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp) +void oswald_draw_pixel(const unsigned int xstart, const unsigned int ystart) { - uint8_t x, y; + hal_lcd_set_pixel(xstart, ystart, TRUE); +} + +void oswald_draw_bitmap_opts(const unsigned int xstart, const unsigned int ystart, const unsigned int xoff, const unsigned int yoff, const unsigned int width, const unsigned int height, const unsigned int bmp_width, const unsigned int bmp_height, const void *bmp) +{ + unsigned int x, y; + uint8_t *cb; + + if (bmp == NULL) + return; + + //g_printerr("dbmp %d,%d off %d,%d\n", xstart, ystart, width, height); + cb = (uint8_t *)bmp; + //g_printerr("dat %02x %02x %02x\n", (uint8_t)cb[0], (uint8_t)cb[1], (uint8_t)cb[2]); + // we only draw set pixel, unset pixel remain as they are + for (y=yoff; ydy) { - pdx = incx; pdy = 0; - ddx=incx; ddy=incy; - es =dy; el =dx; + pdx = incx; + pdy = 0; + ddx=incx; + ddy=incy; + es =dy; + el =dx; } else { - pdx=0; pdy=incy; - ddx=incx; ddy=incy; - es =dx; el =dy; + pdx=0; + pdy=incy; + ddx=incx; + ddy=incy; + es =dx; + el =dy; } x = xstart; @@ -116,10 +182,10 @@ void oswald_draw_line_ww(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickne hal_lcd_set_pixel(x, y+i, TRUE); } } - hal_lcd_update_display(); + // hal_lcd_update_display(); } -u8t oswald_write_character(u8t x, u8t y, oswald_font_face face, u8t Character) +uint8_t oswald_write_character(const uint8_t x, const uint8_t y, const oswald_font_face face, const uint8_t Character) { #if 0 u8t CharacterHeight = GetCharacterHeight(); @@ -135,25 +201,56 @@ u8t oswald_write_character(u8t x, u8t y, oswald_font_face face, u8t Character) if (bitmap[ly] & (1< 0 ? (8-(oswald_fonts[face].width % 8)) : 0, 0, ((oswald_fonts[face].width / 8) + ((oswald_fonts[face].width % 8) ? 1 : 0))*8, oswald_fonts[face].height, cdata); + + return cwidth; +#endif } -void oswald_write_string(u8t x, u8t y, oswald_font_face face, u8t *str) +void oswald_write_string(const uint8_t x, const uint8_t y, const oswald_font_face face, char *str) { - register lx, i, strl; + uint8_t lx, i, strl; strl = oswald_strlen(str); if (strl == 0) @@ -161,15 +258,15 @@ void oswald_write_string(u8t x, u8t y, oswald_font_face face, u8t *str) lx = x; for (i=0; i