2 #include "oswald_strings.h"
3 #include "oswald_fonts.h"
5 #include "oswald_graphics.h"
8 void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp)
12 // we only draw set pixel, unset pixel remain as they are
13 for (y=0; y<height; y++) {
14 for (x=0; x<width; x++) {
15 hal_lcd_set_pixel(x, y, TRUE);
20 void oswald_draw_Line(uint8_t xstart, uint8_t ystart, uint8_t xend, uint8_t yend)
22 int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
27 incx = (dx >= 0) ? 1 : -1;
28 incy = (dy >= 0) ? 1 : -1;
48 hal_lcd_set_pixel(x, y, TRUE);
50 for (t = 0; t < el; ++t) {
60 hal_lcd_set_pixel(x, y, TRUE);
62 hal_lcd_update_display();
65 void oswald_draw_line_ww(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness)
67 int i, x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
72 incx = (dx >= 0) ? 1 : -1;
73 incy = (dy >= 0) ? 1 : -1;
93 hal_lcd_set_pixel(x, y, TRUE);
94 for (i=1; i<thickness; i++) {
95 hal_lcd_set_pixel(x-i, y, TRUE);
96 hal_lcd_set_pixel(x+i, y, TRUE);
97 hal_lcd_set_pixel(x, y-i, TRUE);
98 hal_lcd_set_pixel(x, y+i, TRUE);
101 for (t = 0; t < el; ++t) {
111 hal_lcd_set_pixel(x, y, TRUE);
112 for (i=1; i<thickness; i++) {
113 hal_lcd_set_pixel(x-i, y, TRUE);
114 hal_lcd_set_pixel(x+i, y, TRUE);
115 hal_lcd_set_pixel(x, y-i, TRUE);
116 hal_lcd_set_pixel(x, y+i, TRUE);
119 hal_lcd_update_display();
122 u8t oswald_write_character(u8t x, u8t y, oswald_font_face face, u8t Character)
125 u8t CharacterHeight = GetCharacterHeight();
126 u8t CharacterWidth = GetCharacterWidth(Character);
127 u16t bitmap[MAX_FONT_ROWS];
130 GetCharacterBitmap(Character, bitmap);
132 // printf("cw=%d ch=%d\n", CharacterWidth, CharacterHeight);
133 for (ly=0; ly<CharacterHeight; ly++) {
134 for (lx=0; lx<CharacterWidth; lx++) {
135 if (bitmap[ly] & (1<<lx)) {
136 hal_lcd_set_pixel(lx+x, ly+y, TRUE);
139 hal_lcd_set_pixel(lx+x, ly+y, FALSE);
146 return CharacterWidth + GetFontSpacing();
148 char *cdata = oswald_fonts[face].data[Character];
150 dbg_out("%c", cdata[1]);
154 void oswald_write_string(u8t x, u8t y, oswald_font_face face, u8t *str)
156 register lx, i, strl;
158 strl = oswald_strlen(str);
163 for (i=0; i<strl; i++) {
164 lx += WriteLcdCharacter(lx, y, str[i]);
169 void oswald_Write_number(u8t x, u8t y, oswald_font_face face, s16t number)
171 register lx, i, strl;
174 itoa(number, str, 10);
175 strl = oswald_strlen(str);
180 for (i=0; i<strl; i++) {
181 lx += WriteLcdCharacter(lx, y, str[i]);