]> git.karo-electronics.de Git - oswald.git/blobdiff - ui/oswald_graphics.c
Oh boy... lots of changes, too many to describe
[oswald.git] / ui / oswald_graphics.c
index 36894abeb49a842c8ffb5da326bafe86ef37d6c3..a6eb14f9dfd50191705b71c4c4d0e3198f4a8e55 100644 (file)
@@ -5,7 +5,19 @@
 #include "oswald_graphics.h"
 
 
-void oswald_draw_Line(u8t xstart, u8t ystart, u8t xend, u8t yend)
+void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp)
+{
+       uint8_t x, y;
+
+       // we only draw set pixel, unset pixel remain as they are
+       for (y=0; y<height; y++) {
+               for (x=0; x<width; x++) {
+                       hal_lcd_set_pixel(x, y, TRUE);
+               }
+       }
+}
+
+void oswald_draw_Line(uint8_t xstart, uint8_t ystart, uint8_t xend, uint8_t yend)
 {
        int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
  
@@ -33,7 +45,7 @@ void oswald_draw_Line(u8t xstart, u8t ystart, u8t xend, u8t yend)
        x = xstart;
        y = ystart;
        err = el/2;
-       lcd_set_pixel(x, y, TRUE);
+       hal_lcd_set_pixel(x, y, TRUE);
  
        for (t = 0; t < el; ++t) {
                err -= es; 
@@ -45,9 +57,9 @@ void oswald_draw_Line(u8t xstart, u8t ystart, u8t xend, u8t yend)
                        x += pdx;
                        y += pdy;
                }
-               lcd_set_pixel(x, y, TRUE);
+               hal_lcd_set_pixel(x, y, TRUE);
        }
-       lcd_update_display();
+       hal_lcd_update_display();
 }
 
 void oswald_draw_line_ww(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness)
@@ -78,12 +90,12 @@ void oswald_draw_line_ww(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickne
        x = xstart;
        y = ystart;
        err = el/2;
-       lcd_set_pixel(x, y, TRUE);
+       hal_lcd_set_pixel(x, y, TRUE);
        for (i=1; i<thickness; i++) {
-               lcd_set_pixel(x-i, y, TRUE);
-               lcd_set_pixel(x+i, y, TRUE);
-               lcd_set_pixel(x, y-i, TRUE);
-               lcd_set_pixel(x, y+i, TRUE);
+               hal_lcd_set_pixel(x-i, y, TRUE);
+               hal_lcd_set_pixel(x+i, y, TRUE);
+               hal_lcd_set_pixel(x, y-i, TRUE);
+               hal_lcd_set_pixel(x, y+i, TRUE);
        }
  
        for (t = 0; t < el; ++t) {
@@ -96,15 +108,15 @@ void oswald_draw_line_ww(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickne
                        x += pdx;
                        y += pdy;
                }
-               lcd_set_pixel(x, y, TRUE);
+               hal_lcd_set_pixel(x, y, TRUE);
                for (i=1; i<thickness; i++) {
-                       lcd_set_pixel(x-i, y, TRUE);
-                       lcd_set_pixel(x+i, y, TRUE);
-                       lcd_set_pixel(x, y-i, TRUE);
-                       lcd_set_pixel(x, y+i, TRUE);
+                       hal_lcd_set_pixel(x-i, y, TRUE);
+                       hal_lcd_set_pixel(x+i, y, TRUE);
+                       hal_lcd_set_pixel(x, y-i, TRUE);
+                       hal_lcd_set_pixel(x, y+i, TRUE);
                }
        }
-       lcd_update_display();
+       hal_lcd_update_display();
 }
 
 u8t oswald_write_character(u8t x, u8t y, oswald_font_face face, u8t Character)
@@ -121,10 +133,10 @@ u8t oswald_write_character(u8t x, u8t y, oswald_font_face face, u8t Character)
        for (ly=0; ly<CharacterHeight; ly++) {
                for (lx=0; lx<CharacterWidth; lx++) {
                        if (bitmap[ly] & (1<<lx)) {
-                               lcd_set_pixel(lx+x, ly+y, TRUE);
+                               hal_lcd_set_pixel(lx+x, ly+y, TRUE);
                                // printf(".");
                        } else {
-                               lcd_set_pixel(lx+x, ly+y, FALSE);
+                               hal_lcd_set_pixel(lx+x, ly+y, FALSE);
                                // printf(" ");
                        }
                }