Added transparency support
This commit is contained in:
parent
dd2fb5d7e6
commit
e7b5cfdf7e
9
spilcd.h
9
spilcd.h
@ -62,6 +62,15 @@ uint8 lcd_setWindow(lcd_t* lcd, uint8 x1, uint8 y1, uint8 x2, uint8 y2);
|
||||
*/
|
||||
void lcd_pushPixel(lcd_t* lcd, uint8 r, uint8 g, uint8 b);
|
||||
|
||||
/*
|
||||
* Push a 'transparent' pixel into the previously set drawing area.
|
||||
* Requires buffering to be enabled.
|
||||
*
|
||||
* Parameters:
|
||||
* lcd - display to use
|
||||
*/
|
||||
void lcd_pushPixelSkip(lcd_t* lcd);
|
||||
|
||||
/*
|
||||
* Push an array of pixels into the previously set drawing area.
|
||||
* Significantly faster than pushing pixels individually.
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "spilcd_font.h"
|
||||
#include "font8x8_basic.h"
|
||||
|
||||
static void lcd_pushChar(lcd_t* lcd, char c)
|
||||
static void lcd_pushChar(lcd_t* lcd, char c, uint8 r, uint8 g, uint8 b)
|
||||
{
|
||||
char* bitmap = font8x8_basic[(unsigned int) c];
|
||||
int x,y;
|
||||
@ -14,9 +14,10 @@ static void lcd_pushChar(lcd_t* lcd, char c)
|
||||
for (y=0; y < 8; y++) {
|
||||
set = bitmap[x] & 1 << y;
|
||||
if (set) {
|
||||
lcd_pushPixel(lcd, 200, 0, 0);
|
||||
lcd_pushPixel(lcd, r, g, b);
|
||||
} else {
|
||||
lcd_pushPixel(lcd, 0, 0, 0);
|
||||
//lcd_pushPixel(lcd, 0, 0, 0);
|
||||
lcd_pushPixelSkip(lcd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -25,7 +26,7 @@ static void lcd_pushChar(lcd_t* lcd, char c)
|
||||
void lcd_drawChar(lcd_t* lcd, uint8 x, uint8 y, char c, uint8 r, uint8 g, uint8 b)
|
||||
{
|
||||
lcd_setWindow(lcd, x, y, x+8 - 1, y+8 - 1);
|
||||
lcd_pushChar(lcd, c);
|
||||
lcd_pushChar(lcd, c, r, g, b);
|
||||
}
|
||||
|
||||
void lcd_drawText(lcd_t* lcd, uint8 x, uint8 y, char* text, uint8 r, uint8 g, uint8 b)
|
||||
|
24
st7735.c
24
st7735.c
@ -36,6 +36,18 @@ static uint8 screen_window_y2;
|
||||
static uint8 screen_cursor_x;
|
||||
static uint8 screen_cursor_y;
|
||||
|
||||
void advance_screen_cursor()
|
||||
{
|
||||
screen_cursor_x++;
|
||||
if (screen_cursor_x > screen_window_x2) {
|
||||
screen_cursor_x = screen_window_x1;
|
||||
screen_cursor_y++;
|
||||
if (screen_cursor_y > screen_window_y2) {
|
||||
screen_cursor_y = screen_window_y1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static lcd_t *activeDisplay;
|
||||
|
||||
/*
|
||||
@ -298,14 +310,12 @@ void lcd_pushPixel(lcd_t* lcd, uint8 r, uint8 g, uint8 b)
|
||||
screen_buffer[i * 3 + 1] = g;
|
||||
screen_buffer[i * 3 + 2] = b;
|
||||
|
||||
screen_cursor_x++;
|
||||
if (screen_cursor_x > screen_window_x2) {
|
||||
screen_cursor_x = screen_window_x1;
|
||||
screen_cursor_y++;
|
||||
if (screen_cursor_y > screen_window_y2) {
|
||||
screen_cursor_y = screen_window_y1;
|
||||
}
|
||||
advance_screen_cursor();
|
||||
}
|
||||
|
||||
void lcd_pushPixelSkip(lcd_t* lcd)
|
||||
{
|
||||
advance_screen_cursor();
|
||||
}
|
||||
|
||||
void lcd_pushPixels(lcd_t* lcd, uint8* pixels, size_t count)
|
||||
|
Loading…
Reference in New Issue
Block a user