2 #include "oswald_strings.h"
5 #include "LcdDisplay.h"
7 void DrawLcdLineBresenham(u8t xstart, u8t ystart, u8t xend, u8t yend)
9 int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
14 incx = (dx >= 0) ? 1 : -1;
15 incy = (dy >= 0) ? 1 : -1;
35 lcd_set_pixel(x, y, TRUE);
37 for (t = 0; t < el; ++t) {
47 lcd_set_pixel(x, y, TRUE);
49 // lcd_update_display();
52 void DrawLcdLineBresenhamWW(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness)
54 int i, x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
59 incx = (dx >= 0) ? 1 : -1;
60 incy = (dy >= 0) ? 1 : -1;
80 lcd_set_pixel(x, y, TRUE);
81 for (i=1; i<thickness; i++) {
82 lcd_set_pixel(x-i, y, TRUE);
83 lcd_set_pixel(x+i, y, TRUE);
84 lcd_set_pixel(x, y-i, TRUE);
85 lcd_set_pixel(x, y+i, TRUE);
88 for (t = 0; t < el; ++t) {
98 lcd_set_pixel(x, y, TRUE);
99 for (i=1; i<thickness; i++) {
100 lcd_set_pixel(x-i, y, TRUE);
101 lcd_set_pixel(x+i, y, TRUE);
102 lcd_set_pixel(x, y-i, TRUE);
103 lcd_set_pixel(x, y+i, TRUE);
106 // lcd_update_display();
109 u8t WriteLcdCharacter(u8t x, u8t y, u8t Character)
111 u8t CharacterHeight = GetCharacterHeight();
112 u8t CharacterWidth = GetCharacterWidth(Character);
113 u16t bitmap[MAX_FONT_ROWS];
116 GetCharacterBitmap(Character, bitmap);
118 // printf("cw=%d ch=%d\n", CharacterWidth, CharacterHeight);
119 for (ly=0; ly<CharacterHeight; ly++) {
120 for (lx=0; lx<CharacterWidth; lx++) {
121 if (bitmap[ly] & (1<<lx)) {
122 lcd_set_pixel(lx+x, ly+y, TRUE);
125 lcd_set_pixel(lx+x, ly+y, FALSE);
131 // lcd_update_display();
132 return CharacterWidth + GetFontSpacing();
135 void WriteLcdString(u8t x, u8t y, char *str)
139 strl = oswald_strlen(str);
144 for (i=0; i<strl; i++) {
145 lx += WriteLcdCharacter(lx, y, str[i]);
150 void WriteLcdNumber(u8t x, u8t y, s16t number)
155 itoa(number, str, 10);
156 strl = oswald_strlen(str);
161 for (i=0; i<strl; i++) {
162 lx += WriteLcdCharacter(lx, y, str[i]);