Change color_t to gColor

release/v2.9
inmarket 2018-07-08 11:19:43 +10:00
parent cfb1b2a488
commit f9c848e985
81 changed files with 263 additions and 261 deletions

View File

@ -153,7 +153,7 @@ static GFXINLINE uint16_t read_data(GDisplay *g) {
} }
#if defined(GDISP_USE_DMA) || defined(__DOXYGEN__) #if defined(GDISP_USE_DMA) || defined(__DOXYGEN__)
static GFXINLINE void dma_with_noinc(GDisplay *g, color_t *buffer, int area) { static GFXINLINE void dma_with_noinc(GDisplay *g, gColor *buffer, int area) {
(void) g; (void) g;
dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer); dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer);
dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);
@ -164,7 +164,7 @@ static GFXINLINE uint16_t read_data(GDisplay *g) {
} }
} }
static GFXINLINE void dma_with_inc(GDisplay *g, color_t *buffer, int area) { static GFXINLINE void dma_with_inc(GDisplay *g, gColor *buffer, int area) {
(void) g; (void) g;
dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer); dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer);
dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PINC | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PINC | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);

View File

@ -145,7 +145,7 @@ static GFXINLINE uint16_t read_data(GDisplay *g) {
} }
#if defined(GDISP_USE_DMA) #if defined(GDISP_USE_DMA)
static GFXINLINE void dma_with_noinc(GDisplay *g, color_t *buffer, int area) { static GFXINLINE void dma_with_noinc(GDisplay *g, gColor *buffer, int area) {
(void) g; (void) g;
dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer); dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer);
dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);
@ -156,7 +156,7 @@ static GFXINLINE uint16_t read_data(GDisplay *g) {
} }
} }
static GFXINLINE void dma_with_inc(GDisplay *g, color_t *buffer, int area) { static GFXINLINE void dma_with_inc(GDisplay *g, gColor *buffer, int area) {
(void) g; (void) g;
dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer); dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer);
dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PINC | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PINC | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);

View File

@ -169,7 +169,7 @@ static GFXINLINE uint16_t read_data(GDisplay *g) {
} }
#if defined(GDISP_USE_DMA) || defined(__DOXYGEN__) #if defined(GDISP_USE_DMA) || defined(__DOXYGEN__)
static GFXINLINE void dma_with_noinc(GDisplay *g, color_t *buffer, int area) { static GFXINLINE void dma_with_noinc(GDisplay *g, gColor *buffer, int area) {
(void) g; (void) g;
dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer); dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer);
dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | \ dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | \
@ -182,7 +182,7 @@ static GFXINLINE void dma_with_noinc(GDisplay *g, color_t *buffer, int area) {
} }
} }
static GFXINLINE void dma_with_inc(GDisplay *g, color_t *buffer, int area) { static GFXINLINE void dma_with_inc(GDisplay *g, gColor *buffer, int area) {
(void) g; (void) g;
dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer); dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer);
dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PINC | \ dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PINC | \

View File

@ -22,6 +22,7 @@ FEATURE: Fixed headers to ensure size_t, NULL are always defined. size_t is not
CHANGE: Added type gPoint to replace V2.x point and point_t CHANGE: Added type gPoint to replace V2.x point and point_t
CHANGE: Added type gCoord to replace V2.x coord_t CHANGE: Added type gCoord to replace V2.x coord_t
CHANGE: Added type gPixel to replace V2.x pixel_t CHANGE: Added type gPixel to replace V2.x pixel_t
CHANGE: Added type gColor to replace V2.x color_t
FIX: Added gfxRealloc() to Qt port FIX: Added gfxRealloc() to Qt port
FIX: Fixed UC1610 driver private area initialisation FIX: Fixed UC1610 driver private area initialisation
FIX: Fixed ST7735 driver and added kapacuk changes FIX: Fixed ST7735 driver and added kapacuk changes

View File

@ -44,7 +44,7 @@ void initialize (void)
} }
void matrix (int16_t xyz[3][N], color_t col[N]) void matrix (int16_t xyz[3][N], gColor col[N])
{ {
static uint32_t t = 0; static uint32_t t = 0;
int16_t x = -SCALE, y = -SCALE; int16_t x = -SCALE, y = -SCALE;
@ -106,7 +106,7 @@ void rotate (int16_t xyz[3][N], uint16_t angleX, uint16_t angleY, uint16_t angle
} }
void draw(int16_t xyz[3][N], color_t col[N]) void draw(int16_t xyz[3][N], gColor col[N])
{ {
static uint16_t oldProjX[N] = {0}; static uint16_t oldProjX[N] = {0};
static uint16_t oldProjY[N] = {0}; static uint16_t oldProjY[N] = {0};
@ -142,7 +142,7 @@ int16_t angleX = 0, angleY = 0, angleZ = 0;
int16_t speedX = 0, speedY = 0, speedZ = 0; int16_t speedX = 0, speedY = 0, speedZ = 0;
int16_t xyz[3][N]; int16_t xyz[3][N];
color_t col[N]; gColor col[N];
int main (void) int main (void)

View File

@ -63,9 +63,9 @@ static GButtonObject btnClose;
// Image object // Image object
static gdispImage toolbarImageFilmstrip; static gdispImage toolbarImageFilmstrip;
static color_t myColors[] = { GFX_BLACK, GFX_RED, GFX_GREEN, GFX_BLUE, GFX_CYAN, GFX_MAGENTA, GFX_YELLOW, GFX_WHITE }; static gColor myColors[] = { GFX_BLACK, GFX_RED, GFX_GREEN, GFX_BLUE, GFX_CYAN, GFX_MAGENTA, GFX_YELLOW, GFX_WHITE };
static color_t selColor = GFX_BLACK; static gColor selColor = GFX_BLACK;
static int selColorIndex = 0, selPenWidth = 1, tbMode = 1; static int selColorIndex = 0, selPenWidth = 1, tbMode = 1;
static NColorScheme nCurColorScheme; static NColorScheme nCurColorScheme;
@ -156,7 +156,7 @@ static void nbtnColorBarSelDraw(GHandle gh, gBool enabled, gBool isdown, const c
#define ccs nCurColorScheme #define ccs nCurColorScheme
int i, j = 0, k; int i, j = 0, k;
color_t ca, cb; gColor ca, cb;
GEventMouse ptr; GEventMouse ptr;
(void)txt; (void)txt;
@ -218,7 +218,7 @@ static void nbtnColorBarSelDraw(GHandle gh, gBool enabled, gBool isdown, const c
static void nToolbarImageButtonDraw(GHandle gh, gBool isenabled, gBool isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) { static void nToolbarImageButtonDraw(GHandle gh, gBool isenabled, gBool isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) {
(void)txt; (void)pstyle; (void)isenabled; (void)txt; (void)pstyle; (void)isenabled;
color_t cl = isdown ? nCurColorScheme.toolbarBgActive : nCurColorScheme.toolbarBgUnsel; gColor cl = isdown ? nCurColorScheme.toolbarBgActive : nCurColorScheme.toolbarBgUnsel;
gdispImageSetBgColor(&toolbarImageFilmstrip, cl); gdispImageSetBgColor(&toolbarImageFilmstrip, cl);
gdispFillArea(gh->x, gh->y, gh->width, gh->height, cl); gdispFillArea(gh->x, gh->y, gh->width, gh->height, cl);

View File

@ -56,7 +56,7 @@ static GHandle nStatusConsole = NULL;
static volatile gBool doExit; static volatile gBool doExit;
static void draw_point(gCoord x, gCoord y) { static void draw_point(gCoord x, gCoord y) {
color_t c = ncoreDrawingArea->color; gColor c = ncoreDrawingArea->color;
if (nMode == NCORE_MODE_DRAW) if (nMode == NCORE_MODE_DRAW)
c = ncoreDrawingArea->color; c = ncoreDrawingArea->color;
@ -227,8 +227,8 @@ void ncoreSetPenWidth(uint8_t penWidth) { nPenWidth = penWidth; }
uint8_t ncoreGetPenWidth(void) { return nPenWidth; } uint8_t ncoreGetPenWidth(void) { return nPenWidth; }
/* Get and set the drawing color */ /* Get and set the drawing color */
void ncoreSetPenColor(color_t penColor) { gwinSetColor(ncoreDrawingArea, penColor); } void ncoreSetPenColor(gColor penColor) { gwinSetColor(ncoreDrawingArea, penColor); }
color_t ncoreGetPenColor(void) { return ncoreDrawingArea->color; } gColor ncoreGetPenColor(void) { return ncoreDrawingArea->color; }
/* Set mode */ /* Set mode */
void ncoreSetMode(uint8_t mode) { nMode = mode; } void ncoreSetMode(uint8_t mode) { nMode = mode; }

View File

@ -58,8 +58,8 @@ void ncoreSetPenWidth(uint8_t penWidth);
uint8_t ncoreGetPenWidth(void); uint8_t ncoreGetPenWidth(void);
/* Get and set the drawing color */ /* Get and set the drawing color */
void ncoreSetPenColor(color_t penColor); void ncoreSetPenColor(gColor penColor);
color_t ncoreGetPenColor(void); gColor ncoreGetPenColor(void);
/* Get and set the pen mode */ /* Get and set the pen mode */
void ncoreSetMode(uint8_t mode); void ncoreSetMode(uint8_t mode);

View File

@ -97,18 +97,18 @@
/* Color scheme definition */ /* Color scheme definition */
typedef struct colScheme { typedef struct colScheme {
color_t titleBarColor; gColor titleBarColor;
color_t titleTextColor; gColor titleTextColor;
color_t winBgColor; gColor winBgColor;
color_t drawingWinBorder; gColor drawingWinBorder;
color_t toolbarSeparator; gColor toolbarSeparator;
color_t toolbarBgUnsel; gColor toolbarBgUnsel;
color_t toolbarBgActive; gColor toolbarBgActive;
color_t toolbarBgSel; gColor toolbarBgSel;
color_t statusBarText; gColor statusBarText;
} NColorScheme; } NColorScheme;

View File

@ -66,7 +66,7 @@ static DECLARE_THREAD_FUNCTION(task, param) {
gCoord width, height, x, y, radius, ballx, bally, dx, floor; gCoord width, height, x, y, radius, ballx, bally, dx, floor;
gCoord minx, miny, maxx, maxy, winx, winy; gCoord minx, miny, maxx, maxy, winx, winy;
gCoord ballcx, ballcy; gCoord ballcx, ballcy;
color_t colour; gColor colour;
float ii, spin, dy, spinspeed, h, f, g; float ii, spin, dy, spinspeed, h, f, g;
(void) param; (void) param;

View File

@ -32,7 +32,7 @@
void mandelbrot(float x1, float y1, float x2, float y2) { void mandelbrot(float x1, float y1, float x2, float y2) {
unsigned int i,j, width, height; unsigned int i,j, width, height;
uint16_t iter; uint16_t iter;
color_t color; gColor color;
float fwidth, fheight; float fwidth, fheight;
float sy = y2 - y1; float sy = y2 - y1;

View File

@ -74,7 +74,7 @@ void drawScreen(void) {
GEventMouse ev; GEventMouse ev;
int main(void) { int main(void) {
color_t color = GFX_BLACK; gColor color = GFX_BLACK;
uint16_t pen = 0; uint16_t pen = 0;
gfxInit(); gfxInit();

View File

@ -89,7 +89,7 @@ void benchmark(void) {
uint32_t i, pixels, ms, pps; uint32_t i, pixels, ms, pps;
char pps_str[25]; char pps_str[25];
gCoord height, width, rx, ry, rcx, rcy; gCoord height, width, rx, ry, rcx, rcy;
color_t random_color; gColor random_color;
font_t font; font_t font;
gdispSetOrientation(GDISP_ROTATE_90); gdispSetOrientation(GDISP_ROTATE_90);

View File

@ -155,7 +155,7 @@ static GFXINLINE uint16_t read_data(GDisplay *g) {
} }
#if defined(GDISP_USE_DMA) || defined(__DOXYGEN__) #if defined(GDISP_USE_DMA) || defined(__DOXYGEN__)
static GFXINLINE void dma_with_noinc(GDisplay *g, color_t *buffer, int area) { static GFXINLINE void dma_with_noinc(GDisplay *g, gColor *buffer, int area) {
(void) g; (void) g;
dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer); dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer);
dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);
@ -166,7 +166,7 @@ static GFXINLINE uint16_t read_data(GDisplay *g) {
} }
} }
static GFXINLINE void dma_with_inc(GDisplay *g, color_t *buffer, int area) { static GFXINLINE void dma_with_inc(GDisplay *g, gColor *buffer, int area) {
(void) g; (void) g;
dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer); dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer);
dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PINC | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PINC | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);

View File

@ -153,7 +153,7 @@ static GFXINLINE uint16_t read_data(GDisplay *g) {
} }
#if defined(GDISP_USE_DMA) || defined(__DOXYGEN__) #if defined(GDISP_USE_DMA) || defined(__DOXYGEN__)
static GFXINLINE void dma_with_noinc(GDisplay *g, color_t *buffer, int area) { static GFXINLINE void dma_with_noinc(GDisplay *g, gColor *buffer, int area) {
(void) g; (void) g;
dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer); dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer);
dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);
@ -164,7 +164,7 @@ static GFXINLINE uint16_t read_data(GDisplay *g) {
} }
} }
static GFXINLINE void dma_with_inc(GDisplay *g, color_t *buffer, int area) { static GFXINLINE void dma_with_inc(GDisplay *g, gColor *buffer, int area) {
(void) g; (void) g;
dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer); dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer);
dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PINC | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PINC | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);

View File

@ -63,7 +63,7 @@ E C
D D
*/ */
const uint8_t sevenSegNumbers[10] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F}; // 0,1,2,3,4,5,6,7,8,9 const uint8_t sevenSegNumbers[10] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F}; // 0,1,2,3,4,5,6,7,8,9
const color_t tetrisShapeColors[9] = {GFX_BLACK, HTML2COLOR(0x009000), GFX_RED, GFX_BLUE, GFX_MAGENTA, GFX_SKYBLUE, GFX_ORANGE, HTML2COLOR(0xBBBB00), GFX_WHITE}; // shape colors const gColor tetrisShapeColors[9] = {GFX_BLACK, HTML2COLOR(0x009000), GFX_RED, GFX_BLUE, GFX_MAGENTA, GFX_SKYBLUE, GFX_ORANGE, HTML2COLOR(0xBBBB00), GFX_WHITE}; // shape colors
// default tetris shapes // default tetris shapes
const int tetrisShapes[TETRIS_SHAPE_COUNT][4][2] = { const int tetrisShapes[TETRIS_SHAPE_COUNT][4][2] = {
{{4, 17},{4, 16},{5, 16},{4, 15}}, {{4, 17},{4, 16},{5, 16},{4, 15}},
@ -143,7 +143,7 @@ static int uitoa(unsigned int value, char * buf, int max) {
return n; return n;
} }
static void sevenSegDraw(int x, int y, uint8_t number, color_t color) { static void sevenSegDraw(int x, int y, uint8_t number, gColor color) {
if (number & 0x01) gdispFillArea(x+SEVEN_SEG_HEIGHT+SEVEN_SEG_SIZE, y, SEVEN_SEG_WIDTH, SEVEN_SEG_HEIGHT, color); // A if (number & 0x01) gdispFillArea(x+SEVEN_SEG_HEIGHT+SEVEN_SEG_SIZE, y, SEVEN_SEG_WIDTH, SEVEN_SEG_HEIGHT, color); // A
if (number & 0x02) gdispFillArea(x+SEVEN_SEG_HEIGHT+(SEVEN_SEG_SIZE*2)+SEVEN_SEG_WIDTH, y+SEVEN_SEG_HEIGHT+SEVEN_SEG_SIZE, SEVEN_SEG_HEIGHT, SEVEN_SEG_WIDTH, color); // B if (number & 0x02) gdispFillArea(x+SEVEN_SEG_HEIGHT+(SEVEN_SEG_SIZE*2)+SEVEN_SEG_WIDTH, y+SEVEN_SEG_HEIGHT+SEVEN_SEG_SIZE, SEVEN_SEG_HEIGHT, SEVEN_SEG_WIDTH, color); // B
if (number & 0x04) gdispFillArea(x+SEVEN_SEG_HEIGHT+(SEVEN_SEG_SIZE*2)+SEVEN_SEG_WIDTH, y+(SEVEN_SEG_HEIGHT*2)+SEVEN_SEG_WIDTH+(SEVEN_SEG_SIZE*3), SEVEN_SEG_HEIGHT, SEVEN_SEG_WIDTH, color); // C if (number & 0x04) gdispFillArea(x+SEVEN_SEG_HEIGHT+(SEVEN_SEG_SIZE*2)+SEVEN_SEG_WIDTH, y+(SEVEN_SEG_HEIGHT*2)+SEVEN_SEG_WIDTH+(SEVEN_SEG_SIZE*3), SEVEN_SEG_HEIGHT, SEVEN_SEG_WIDTH, color); // C

View File

@ -60,7 +60,7 @@ int main(void) {
gCoord width, height, x, y, radius, ballx, bally, dx, floor; gCoord width, height, x, y, radius, ballx, bally, dx, floor;
gCoord minx, miny, maxx, maxy; gCoord minx, miny, maxx, maxy;
gCoord ballcx, ballcy; gCoord ballcx, ballcy;
color_t colour; gColor colour;
float ii, spin, dy, spinspeed, h, f, g; float ii, spin, dy, spinspeed, h, f, g;
gfxInit(); gfxInit();

View File

@ -124,7 +124,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay* g)
PIXEL_ADDR(g, pos)[0] = gdispColor2Native(g->p.color); PIXEL_ADDR(g, pos)[0] = gdispColor2Native(g->p.color);
} }
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay* g) LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay* g)
{ {
unsigned pos; unsigned pos;
LLDCOLOR_TYPE color; LLDCOLOR_TYPE color;
@ -255,7 +255,7 @@ LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay* g)
// Fill the line buffer with the solid color // Fill the line buffer with the solid color
for (i = 0; i < bytes_per_pixel * g->p.cx; i += 4) { for (i = 0; i < bytes_per_pixel * g->p.cx; i += 4) {
*((color_t*)(line + i)) = g->p.color; *((gColor*)(line + i)) = g->p.color;
} }
// Calculate the address of the first pixel of the rectangle (top left corner) // Calculate the address of the first pixel of the rectangle (top left corner)

View File

@ -581,7 +581,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
* =============================== */ * =============================== */
#if GDISP_HARDWARE_CLEARS #if GDISP_HARDWARE_CLEARS
static void subclear(GDisplay *g, color_t color) { static void subclear(GDisplay *g, gColor color) {
unsigned x, y; unsigned x, y;
uint8_t byte; uint8_t byte;

View File

@ -99,7 +99,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
#endif #endif
} }
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
unsigned pos; unsigned pos;
uint8_t *p; uint8_t *p;

View File

@ -222,7 +222,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
setreadmode(g); setreadmode(g);
dummy_read(g); dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -216,7 +216,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
setreadmode(g); setreadmode(g);
dummy_read(g); dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -256,7 +256,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
setreadmode(g); setreadmode(g);
dummy_read(g); dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -260,7 +260,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
setreadmode(g); setreadmode(g);
dummy_read(g); dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -289,7 +289,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
setreadmode(g); setreadmode(g);
dummy_read(g); dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -220,7 +220,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
setreadmode(g); setreadmode(g);
dummy_read(g); dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -220,7 +220,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
dummy_read(g); dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -188,7 +188,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
dummy_read(g); dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -210,7 +210,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
setreadmode(g); setreadmode(g);
dummy_read(g); dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -436,8 +436,8 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
while (tuples--) { while (tuples--) {
/* Get a pixel */ /* Get a pixel */
switch(pnum++ & 1) { switch(pnum++ & 1) {
case 0: c1 = (((color_t)p[0]) << 4)|(((color_t)p[1])>>4); break; case 0: c1 = (((gColor)p[0]) << 4)|(((gColor)p[1])>>4); break;
case 1: c1 = (((color_t)p[1]&0x0F) << 8)|((color_t)p[1]); p += 3; break; case 1: c1 = (((gColor)p[1]&0x0F) << 8)|((gColor)p[1]); p += 3; break;
} }
/* Check for line or buffer wrapping */ /* Check for line or buffer wrapping */
@ -454,8 +454,8 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
/* Get the next pixel */ /* Get the next pixel */
switch(pnum++ & 1) { switch(pnum++ & 1) {
case 0: c2 = (((color_t)p[0]) << 4)|(((color_t)p[1])>>4); break; case 0: c2 = (((gColor)p[0]) << 4)|(((gColor)p[1])>>4); break;
case 1: c2 = (((color_t)p[1]&0x0F) << 8)|((color_t)p[1]); p += 3; break; case 1: c2 = (((gColor)p[1]&0x0F) << 8)|((gColor)p[1]); p += 3; break;
} }
/* Check for line or buffer wrapping */ /* Check for line or buffer wrapping */

View File

@ -155,7 +155,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
gCoord x, y; gCoord x, y;
switch(g->g.Orientation) { switch(g->g.Orientation) {

View File

@ -165,7 +165,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
gCoord x, y; gCoord x, y;
switch(g->g.Orientation) { switch(g->g.Orientation) {

View File

@ -55,7 +55,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g)
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
color_t gdisp_lld_get_pixel_color(GDisplay *g) gColor gdisp_lld_get_pixel_color(GDisplay *g)
{ {
return qimage_getPixel(g); return qimage_getPixel(g);
} }

View File

@ -27,12 +27,12 @@ void qimage_setPixel(GDisplay* g)
qimage->setPixel(g->p.x, g->p.y, rgbVal); qimage->setPixel(g->p.x, g->p.y, rgbVal);
} }
color_t qimage_getPixel(GDisplay* g) gColor qimage_getPixel(GDisplay* g)
{ {
const QImage* qimage = static_cast<const QImage*>(g->priv); const QImage* qimage = static_cast<const QImage*>(g->priv);
if (!qimage) { if (!qimage) {
return 0; return 0;
} }
return static_cast<color_t>(qimage->pixel(g->p.x, g->p.y)); return static_cast<gColor>(qimage->pixel(g->p.x, g->p.y));
} }

View File

@ -9,7 +9,7 @@ extern "C" {
gBool qimage_init(GDisplay* g, gCoord width, gCoord height); gBool qimage_init(GDisplay* g, gCoord width, gCoord height);
void qimage_setPixel(GDisplay* g); void qimage_setPixel(GDisplay* g);
color_t qimage_getPixel(GDisplay* g); gColor qimage_getPixel(GDisplay* g);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -230,7 +230,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
setreadmode(g); setreadmode(g);
dummy_read(g); dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -274,7 +274,7 @@ LLDSPEC void gdisp_lld_read_start(GDisplay *g) {
dummy_read(g); dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -234,7 +234,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
setreadmode(g); setreadmode(g);
dummy_read(g); dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -65,13 +65,13 @@ static GFXINLINE uint16_t read_data(GDisplay *g) {
#if defined(GDISP_USE_DMA) && GDISP_USE_DMA #if defined(GDISP_USE_DMA) && GDISP_USE_DMA
static GFXINLINE void dma_with_noinc(GDisplay *g, color_t *buffer, int area) { static GFXINLINE void dma_with_noinc(GDisplay *g, gColor *buffer, int area) {
(void) g; (void) g;
(void) buffer; (void) buffer;
(void) area; (void) area;
} }
static GFXINLINE void dma_with_inc(GDisplay *g, color_t *buffer, int area) { static GFXINLINE void dma_with_inc(GDisplay *g, gColor *buffer, int area) {
(void) g; (void) g;
(void) buffer; (void) buffer;
(void) area; (void) area;

View File

@ -223,7 +223,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
setreadmode(g); setreadmode(g);
dummy_read(g); dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -266,7 +266,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
gCoord x, y; gCoord x, y;
switch(g->g.Orientation) { switch(g->g.Orientation) {

View File

@ -219,7 +219,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
gCoord x, y; gCoord x, y;
LLDCOLOR_TYPE c; LLDCOLOR_TYPE c;

View File

@ -170,7 +170,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
setreadmode(g); setreadmode(g);
//dummy_read(g); //dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -434,7 +434,7 @@ LLDSPEC void gdisp_lld_draw_pixel (GDisplay *g)
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color (GDisplay *g) LLDSPEC gColor gdisp_lld_get_pixel_color (GDisplay *g)
{ {
gCoord x, y; gCoord x, y;

View File

@ -65,13 +65,13 @@ static GFXINLINE uint16_t read_data(GDisplay *g) {
#if defined(GDISP_USE_DMA) && GDISP_USE_DMA #if defined(GDISP_USE_DMA) && GDISP_USE_DMA
static GFXINLINE void dma_with_noinc(GDisplay *g, color_t *buffer, int area) { static GFXINLINE void dma_with_noinc(GDisplay *g, gColor *buffer, int area) {
(void) g; (void) g;
(void) buffer; (void) buffer;
(void) area; (void) area;
} }
static GFXINLINE void dma_with_inc(GDisplay *g, color_t *buffer, int area) { static GFXINLINE void dma_with_inc(GDisplay *g, gColor *buffer, int area) {
(void) g; (void) g;
(void) buffer; (void) buffer;
(void) area; (void) area;

View File

@ -259,7 +259,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay* g) {
setreadmode(g); setreadmode(g);
dummy_read(g); dummy_read(g);
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay* g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay* g) {
uint16_t data; uint16_t data;
data = read_data(g); data = read_data(g);

View File

@ -196,7 +196,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
gCoord x, y; gCoord x, y;
switch(g->g.Orientation) { switch(g->g.Orientation) {

View File

@ -332,7 +332,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay* g) {
#endif #endif
} }
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay* g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay* g) {
unsigned pos; unsigned pos;
LLDCOLOR_TYPE color; LLDCOLOR_TYPE color;

View File

@ -171,7 +171,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
gCoord x, y; gCoord x, y;
switch(g->g.Orientation) { switch(g->g.Orientation) {

View File

@ -47,7 +47,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
color_t gdisp_lld_get_pixel_color(GDisplay *g) { gColor gdisp_lld_get_pixel_color(GDisplay *g) {
(void) g; (void) g;
return 0; return 0;
} }

View File

@ -176,7 +176,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
gCoord x, y; gCoord x, y;
switch(g->g.Orientation) { switch(g->g.Orientation) {

View File

@ -84,7 +84,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
PIXEL_ADDR(g, pos)[0] = gdispColor2Native(g->p.color); PIXEL_ADDR(g, pos)[0] = gdispColor2Native(g->p.color);
} }
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
unsigned pos; unsigned pos;
LLDCOLOR_TYPE color; LLDCOLOR_TYPE color;

View File

@ -425,7 +425,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g)
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
if (context) if (context)
return gdispNative2Color(context->framebuf[(g->p.y*GDISP_SCREEN_WIDTH)+g->p.x]); return gdispNative2Color(context->framebuf[(g->p.y*GDISP_SCREEN_WIDTH)+g->p.x]);
return 0; return 0;

View File

@ -1043,7 +1043,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
g->flags |= GDISP_FLG_WSTREAM; g->flags |= GDISP_FLG_WSTREAM;
g->flags &= ~GDISP_FLG_WRAPPED; g->flags &= ~GDISP_FLG_WRAPPED;
} }
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_read_color(GDisplay *g) {
winPriv * priv; winPriv * priv;
COLORREF color; COLORREF color;
@ -1372,7 +1372,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
winPriv * priv; winPriv * priv;
COLORREF color; COLORREF color;

View File

@ -452,7 +452,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g)
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
xPriv * priv = (xPriv *)g->priv; xPriv * priv = (xPriv *)g->priv;
XColor color; XColor color;
XImage *img; XImage *img;

View File

@ -574,10 +574,10 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
netPriv * priv; netPriv * priv;
uint16_t buf[3]; uint16_t buf[3];
color_t data; gColor data;
#if GDISP_DONT_WAIT_FOR_NET_DISPLAY #if GDISP_DONT_WAIT_FOR_NET_DISPLAY
if (!(g->flags & GDISP_FLG_CONNECTED)) if (!(g->flags & GDISP_FLG_CONNECTED))

View File

@ -457,10 +457,10 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
#endif #endif
#if GDISP_HARDWARE_PIXELREAD #if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
netPriv * priv; netPriv * priv;
uint16_t buf[3]; uint16_t buf[3];
color_t data; gColor data;
#if GDISP_DONT_WAIT_FOR_NET_DISPLAY #if GDISP_DONT_WAIT_FOR_NET_DISPLAY
if (!(g->flags & GDISP_FLG_CONNECTED)) if (!(g->flags & GDISP_FLG_CONNECTED))

View File

@ -792,7 +792,7 @@ void gdispGFlush(GDisplay *g) {
// Don't release the mutex as gdispStreamEnd() will do that. // Don't release the mutex as gdispStreamEnd() will do that.
} }
void gdispGStreamColor(GDisplay *g, color_t color) { void gdispGStreamColor(GDisplay *g, gColor color) {
#if !GDISP_HARDWARE_STREAM_WRITE && GDISP_LINEBUF_SIZE != 0 && GDISP_HARDWARE_BITFILLS #if !GDISP_HARDWARE_STREAM_WRITE && GDISP_LINEBUF_SIZE != 0 && GDISP_HARDWARE_BITFILLS
gCoord sx1, sy1; gCoord sx1, sy1;
#endif #endif
@ -978,7 +978,7 @@ void gdispGFlush(GDisplay *g) {
} }
#endif #endif
void gdispGDrawPixel(GDisplay *g, gCoord x, gCoord y, color_t color) { void gdispGDrawPixel(GDisplay *g, gCoord x, gCoord y, gColor color) {
MUTEX_ENTER(g); MUTEX_ENTER(g);
g->p.x = x; g->p.x = x;
g->p.y = y; g->p.y = y;
@ -988,7 +988,7 @@ void gdispGDrawPixel(GDisplay *g, gCoord x, gCoord y, color_t color) {
MUTEX_EXIT(g); MUTEX_EXIT(g);
} }
void gdispGDrawLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, color_t color) { void gdispGDrawLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gColor color) {
MUTEX_ENTER(g); MUTEX_ENTER(g);
g->p.x = x0; g->p.x = x0;
g->p.y = y0; g->p.y = y0;
@ -1000,7 +1000,7 @@ void gdispGDrawLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, col
MUTEX_EXIT(g); MUTEX_EXIT(g);
} }
void gdispGClear(GDisplay *g, color_t color) { void gdispGClear(GDisplay *g, gColor color) {
// Note - clear() ignores the clipping area. It clears the screen. // Note - clear() ignores the clipping area. It clears the screen.
MUTEX_ENTER(g); MUTEX_ENTER(g);
@ -1083,7 +1083,7 @@ void gdispGClear(GDisplay *g, color_t color) {
#endif #endif
} }
void gdispGFillArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_t color) { void gdispGFillArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color) {
MUTEX_ENTER(g); MUTEX_ENTER(g);
g->p.x = x; g->p.x = x;
g->p.y = y; g->p.y = y;
@ -1271,7 +1271,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#endif #endif
#if GDISP_NEED_CIRCLE #if GDISP_NEED_CIRCLE
void gdispGDrawCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius, color_t color) { void gdispGDrawCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius, gColor color) {
gCoord a, b, P; gCoord a, b, P;
MUTEX_ENTER(g); MUTEX_ENTER(g);
@ -1313,7 +1313,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#endif #endif
#if GDISP_NEED_CIRCLE #if GDISP_NEED_CIRCLE
void gdispGFillCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius, color_t color) { void gdispGFillCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius, gColor color) {
gCoord a, b, P; gCoord a, b, P;
MUTEX_ENTER(g); MUTEX_ENTER(g);
@ -1357,7 +1357,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
g->p.x = x+r2+1; g->p.x1 = x+r1; g->p.color = color1; hline_clip(g) g->p.x = x+r2+1; g->p.x1 = x+r1; g->p.color = color1; hline_clip(g)
#define DRAW_SINGLELINE(yval, r) g->p.y = yval; g->p.x = x-r; g->p.x1 = x+r; hline_clip(g) #define DRAW_SINGLELINE(yval, r) g->p.y = yval; g->p.x = x-r; g->p.x1 = x+r; hline_clip(g)
void gdispGFillDualCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius1, color_t color1, gCoord radius2, color_t color2) { void gdispGFillDualCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius1, gColor color1, gCoord radius2, gColor color2) {
gCoord a, b1, b2, p1, p2; gCoord a, b1, b2, p1, p2;
MUTEX_ENTER(g); MUTEX_ENTER(g);
@ -1426,7 +1426,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#endif #endif
#if GDISP_NEED_ELLIPSE #if GDISP_NEED_ELLIPSE
void gdispGDrawEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, color_t color) { void gdispGDrawEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, gColor color) {
gCoord dx, dy; gCoord dx, dy;
int32_t a2, b2; int32_t a2, b2;
int32_t err, e2; int32_t err, e2;
@ -1465,7 +1465,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#endif #endif
#if GDISP_NEED_ELLIPSE #if GDISP_NEED_ELLIPSE
void gdispGFillEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, color_t color) { void gdispGFillEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, gColor color) {
gCoord dx, dy; gCoord dx, dy;
int32_t a2, b2; int32_t a2, b2;
int32_t err, e2; int32_t err, e2;
@ -1502,7 +1502,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#endif #endif
#if GDISP_NEED_ARCSECTORS #if GDISP_NEED_ARCSECTORS
void gdispGDrawArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, color_t color) { void gdispGDrawArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, gColor color) {
gCoord a, b, P; gCoord a, b, P;
MUTEX_ENTER(g); MUTEX_ENTER(g);
@ -1546,7 +1546,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#endif #endif
#if GDISP_NEED_ARCSECTORS #if GDISP_NEED_ARCSECTORS
void gdispGFillArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, color_t color) { void gdispGFillArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, gColor color) {
gCoord a, b, P; gCoord a, b, P;
MUTEX_ENTER(g); MUTEX_ENTER(g);
@ -1731,7 +1731,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#include <math.h> #include <math.h>
#endif #endif
void gdispGDrawArc(GDisplay *g, gCoord x, gCoord y, gCoord radius, gCoord start, gCoord end, color_t color) { void gdispGDrawArc(GDisplay *g, gCoord x, gCoord y, gCoord radius, gCoord start, gCoord end, gColor color) {
gCoord a, b, P, sedge, eedge; gCoord a, b, P, sedge, eedge;
uint8_t full, sbit, ebit, tbit; uint8_t full, sbit, ebit, tbit;
@ -1917,7 +1917,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#include <math.h> #include <math.h>
#endif #endif
void gdispGDrawThickArc(GDisplay *g, gCoord xc, gCoord yc, gCoord radiusStart, gCoord radiusEnd, gCoord start, gCoord end, color_t color) { void gdispGDrawThickArc(GDisplay *g, gCoord xc, gCoord yc, gCoord radiusStart, gCoord radiusEnd, gCoord start, gCoord end, gColor color) {
gCoord x, y, d, r; gCoord x, y, d, r;
gCoord startTan, endTan, curangle; gCoord startTan, endTan, curangle;
gCoord precision = 512; gCoord precision = 512;
@ -2032,7 +2032,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#endif #endif
#if GDISP_NEED_ARC #if GDISP_NEED_ARC
void gdispGFillArc(GDisplay *g, gCoord x, gCoord y, gCoord radius, gCoord start, gCoord end, color_t color) { void gdispGFillArc(GDisplay *g, gCoord x, gCoord y, gCoord radius, gCoord start, gCoord end, gColor color) {
gCoord a, b, P; gCoord a, b, P;
gCoord sy, ey; gCoord sy, ey;
fixed sxa, sxb, sxd, exa, exb, exd; fixed sxa, sxb, sxd, exa, exb, exd;
@ -2534,7 +2534,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#endif #endif
#if GDISP_NEED_ARC || GDISP_NEED_ARCSECTORS #if GDISP_NEED_ARC || GDISP_NEED_ARCSECTORS
void gdispGDrawRoundedBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord radius, color_t color) { void gdispGDrawRoundedBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord radius, gColor color) {
if (2*radius > cx || 2*radius > cy) { if (2*radius > cx || 2*radius > cy) {
gdispGDrawBox(g, x, y, cx, cy, color); gdispGDrawBox(g, x, y, cx, cy, color);
return; return;
@ -2559,7 +2559,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#endif #endif
#if GDISP_NEED_ARC || GDISP_NEED_ARCSECTORS #if GDISP_NEED_ARC || GDISP_NEED_ARCSECTORS
void gdispGFillRoundedBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord radius, color_t color) { void gdispGFillRoundedBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord radius, gColor color) {
gCoord radius2; gCoord radius2;
radius2 = radius*2; radius2 = radius*2;
@ -2585,8 +2585,8 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#endif #endif
#if GDISP_NEED_PIXELREAD #if GDISP_NEED_PIXELREAD
color_t gdispGGetPixelColor(GDisplay *g, gCoord x, gCoord y) { gColor gdispGGetPixelColor(GDisplay *g, gCoord x, gCoord y) {
color_t c; gColor c;
/* Always synchronous as it must return a value */ /* Always synchronous as it must return a value */
MUTEX_ENTER(g); MUTEX_ENTER(g);
@ -2632,7 +2632,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#endif #endif
#if GDISP_NEED_SCROLL #if GDISP_NEED_SCROLL
void gdispGVerticalScroll(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, int lines, color_t bgcolor) { void gdispGVerticalScroll(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, int lines, gColor bgcolor) {
gCoord abslines; gCoord abslines;
#if GDISP_HARDWARE_SCROLL != GFXON #if GDISP_HARDWARE_SCROLL != GFXON
gCoord fy, dy, ix, fx, i, j; gCoord fy, dy, ix, fx, i, j;
@ -2955,7 +2955,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
/* High Level Driver Routines. */ /* High Level Driver Routines. */
/*===========================================================================*/ /*===========================================================================*/
void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_t color) { void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color) {
if (cx <= 0 || cy <= 0) return; if (cx <= 0 || cy <= 0) return;
cx = x+cx-1; cy = y+cy-1; // cx, cy are now the end point. cx = x+cx-1; cy = y+cy-1; // cx, cy are now the end point.
@ -2985,7 +2985,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
} }
#if GDISP_NEED_CONVEX_POLYGON #if GDISP_NEED_CONVEX_POLYGON
void gdispGDrawPoly(GDisplay *g, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt, color_t color) { void gdispGDrawPoly(GDisplay *g, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt, gColor color) {
const gPoint *epnt, *p; const gPoint *epnt, *p;
epnt = &pntarray[cnt-1]; epnt = &pntarray[cnt-1];
@ -3001,7 +3001,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
MUTEX_EXIT(g); MUTEX_EXIT(g);
} }
void gdispGFillConvexPoly(GDisplay *g, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt, color_t color) { void gdispGFillConvexPoly(GDisplay *g, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt, gColor color) {
const gPoint *lpnt, *rpnt, *epnts; const gPoint *lpnt, *rpnt, *epnts;
fixed lx, rx, lk, rk; fixed lx, rx, lk, rk;
gCoord y, ymax, lxc, rxc; gCoord y, ymax, lxc, rxc;
@ -3150,7 +3150,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
return; return;
} }
void gdispGDrawThickLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, color_t color, gCoord width, gBool round) { void gdispGDrawThickLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gColor color, gCoord width, gBool round) {
gCoord dx, dy, nx = 0, ny = 0; gCoord dx, dy, nx = 0, ny = 0;
/* Compute the direction vector for the line */ /* Compute the direction vector for the line */
@ -3363,7 +3363,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
} }
#endif #endif
void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, font_t font, color_t color) { void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, font_t font, gColor color) {
if (!font) if (!font)
return; return;
MUTEX_ENTER(g); MUTEX_ENTER(g);
@ -3378,7 +3378,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
MUTEX_EXIT(g); MUTEX_EXIT(g);
} }
void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, font_t font, color_t color, color_t bgcolor) { void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, font_t font, gColor color, gColor bgcolor) {
if (!font) if (!font)
return; return;
MUTEX_ENTER(g); MUTEX_ENTER(g);
@ -3400,7 +3400,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
MUTEX_EXIT(g); MUTEX_EXIT(g);
} }
void gdispGDrawString(GDisplay *g, gCoord x, gCoord y, const char *str, font_t font, color_t color) { void gdispGDrawString(GDisplay *g, gCoord x, gCoord y, const char *str, font_t font, gColor color) {
if (!font) if (!font)
return; return;
MUTEX_ENTER(g); MUTEX_ENTER(g);
@ -3416,7 +3416,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
MUTEX_EXIT(g); MUTEX_EXIT(g);
} }
void gdispGFillString(GDisplay *g, gCoord x, gCoord y, const char *str, font_t font, color_t color, color_t bgcolor) { void gdispGFillString(GDisplay *g, gCoord x, gCoord y, const char *str, font_t font, gColor color, gColor bgcolor) {
if (!font) if (!font)
return; return;
MUTEX_ENTER(g); MUTEX_ENTER(g);
@ -3439,7 +3439,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
MUTEX_EXIT(g); MUTEX_EXIT(g);
} }
void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, color_t color, justify_t justify) { void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, justify_t justify) {
gCoord totalHeight; gCoord totalHeight;
if (!font) if (!font)
@ -3517,7 +3517,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
MUTEX_EXIT(g); MUTEX_EXIT(g);
} }
void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, color_t color, color_t bgcolor, justify_t justify) { void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, gColor bgcolor, justify_t justify) {
gCoord totalHeight; gCoord totalHeight;
if (!font) if (!font)
@ -3652,7 +3652,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
#if GDISP_PIXELFORMAT == GDISP_PIXELFORMAT_RGB888 #if GDISP_PIXELFORMAT == GDISP_PIXELFORMAT_RGB888
// Special alpha hacked version. // Special alpha hacked version.
// Note: this will still work with real RGB888 // Note: this will still work with real RGB888
color_t gdispBlendColor(color_t fg, color_t bg, uint8_t alpha) gColor gdispBlendColor(gColor fg, gColor bg, uint8_t alpha)
{ {
uint32_t ratio; uint32_t ratio;
uint32_t a1, r1, g1, b1; uint32_t a1, r1, g1, b1;
@ -3699,7 +3699,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
return ARGB2COLOR(a1, r1, g1, b1); return ARGB2COLOR(a1, r1, g1, b1);
} }
#else #else
color_t gdispBlendColor(color_t fg, color_t bg, uint8_t alpha) gColor gdispBlendColor(gColor fg, gColor bg, uint8_t alpha)
{ {
uint16_t fg_ratio = alpha + 1; uint16_t fg_ratio = alpha + 1;
uint16_t bg_ratio = 256 - alpha; uint16_t bg_ratio = 256 - alpha;
@ -3721,7 +3721,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
} }
#endif #endif
color_t gdispContrastColor(color_t color) { gColor gdispContrastColor(gColor color) {
uint16_t r, g, b; uint16_t r, g, b;
r = RED_OF(color) > 128 ? 0 : 255; r = RED_OF(color) > 128 ? 0 : 255;
@ -3732,7 +3732,7 @@ color_t gdispContrastColor(color_t color) {
} }
#if (!defined(gdispPackPixels) && !defined(GDISP_PIXELFORMAT_CUSTOM)) #if (!defined(gdispPackPixels) && !defined(GDISP_PIXELFORMAT_CUSTOM))
void gdispPackPixels(gPixel *buf, gCoord cx, gCoord x, gCoord y, color_t color) { void gdispPackPixels(gPixel *buf, gCoord cx, gCoord x, gCoord y, gColor color) {
/* No mutex required as we only read static data */ /* No mutex required as we only read static data */
#if defined(GDISP_PIXELFORMAT_RGB888) #if defined(GDISP_PIXELFORMAT_RGB888)
#error "GDISP: Packed pixels not supported yet" #error "GDISP: Packed pixels not supported yet"

View File

@ -223,7 +223,7 @@ extern GDisplay *GDISP;
/** /**
* @brief The type of a pixel. * @brief The type of a pixel.
*/ */
typedef color_t gPixel; typedef gColor gPixel;
/* Color Utility Functions */ /* Color Utility Functions */
@ -237,7 +237,7 @@ typedef color_t gPixel;
* *
* @api * @api
*/ */
color_t gdispBlendColor(color_t fg, color_t bg, uint8_t alpha); gColor gdispBlendColor(gColor fg, gColor bg, uint8_t alpha);
/** /**
* @brief Find a contrasting color * @brief Find a contrasting color
@ -247,7 +247,7 @@ color_t gdispBlendColor(color_t fg, color_t bg, uint8_t alpha);
* *
* @api * @api
*/ */
color_t gdispContrastColor(color_t color); gColor gdispContrastColor(gColor color);
/* Base Functions */ /* Base Functions */
@ -392,7 +392,7 @@ void gdispGFlush(GDisplay *g);
* *
* @api * @api
*/ */
void gdispGClear(GDisplay *g, color_t color); void gdispGClear(GDisplay *g, gColor color);
#define gdispClear(c) gdispGClear(GDISP, c) #define gdispClear(c) gdispGClear(GDISP, c)
/** /**
@ -404,7 +404,7 @@ void gdispGClear(GDisplay *g, color_t color);
* *
* @api * @api
*/ */
void gdispGDrawPixel(GDisplay *g, gCoord x, gCoord y, color_t color); void gdispGDrawPixel(GDisplay *g, gCoord x, gCoord y, gColor color);
#define gdispDrawPixel(x,y,c) gdispGDrawPixel(GDISP,x,y,c) #define gdispDrawPixel(x,y,c) gdispGDrawPixel(GDISP,x,y,c)
/** /**
@ -417,7 +417,7 @@ void gdispGDrawPixel(GDisplay *g, gCoord x, gCoord y, color_t color);
* *
* @api * @api
*/ */
void gdispGDrawLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, color_t color); void gdispGDrawLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gColor color);
#define gdispDrawLine(x0,y0,x1,y1,c) gdispGDrawLine(GDISP,x0,y0,x1,y1,c) #define gdispDrawLine(x0,y0,x1,y1,c) gdispGDrawLine(GDISP,x0,y0,x1,y1,c)
/** /**
@ -430,7 +430,7 @@ void gdispGDrawLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, col
* *
* @api * @api
*/ */
void gdispGFillArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_t color); void gdispGFillArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color);
#define gdispFillArea(x,y,cx,cy,c) gdispGFillArea(GDISP,x,y,cx,cy,c) #define gdispFillArea(x,y,cx,cy,c) gdispGFillArea(GDISP,x,y,cx,cy,c)
/** /**
@ -465,7 +465,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
* *
* @api * @api
*/ */
void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_t color); void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color);
#define gdispDrawBox(x,y,cx,cy,c) gdispGDrawBox(GDISP,x,y,cx,cy,c) #define gdispDrawBox(x,y,cx,cy,c) gdispGDrawBox(GDISP,x,y,cx,cy,c)
/* Streaming Functions */ /* Streaming Functions */
@ -511,7 +511,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGStreamColor(GDisplay *g, color_t color); void gdispGStreamColor(GDisplay *g, gColor color);
#define gdispStreamColor(c) gdispGStreamColor(GDISP,c) #define gdispStreamColor(c) gdispGStreamColor(GDISP,c)
/** /**
@ -561,7 +561,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGDrawCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius, color_t color); void gdispGDrawCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius, gColor color);
#define gdispDrawCircle(x,y,r,c) gdispGDrawCircle(GDISP,x,y,r,c) #define gdispDrawCircle(x,y,r,c) gdispGDrawCircle(GDISP,x,y,r,c)
/** /**
@ -575,7 +575,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGFillCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius, color_t color); void gdispGFillCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius, gColor color);
#define gdispFillCircle(x,y,r,c) gdispGFillCircle(GDISP,x,y,r,c) #define gdispFillCircle(x,y,r,c) gdispGFillCircle(GDISP,x,y,r,c)
#endif #endif
@ -593,7 +593,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGFillDualCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius1, color_t color1, gCoord radius2, color_t color2); void gdispGFillDualCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius1, gColor color1, gCoord radius2, gColor color2);
#define gdispFillDualCircle(x,y,r1,c1,r2,c2) gdispGFillDualCircle(GDISP,x,y,r1,c1,r2,c2) #define gdispFillDualCircle(x,y,r1,c1,r2,c2) gdispGFillDualCircle(GDISP,x,y,r1,c1,r2,c2)
#endif #endif
@ -611,7 +611,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGDrawEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, color_t color); void gdispGDrawEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, gColor color);
#define gdispDrawEllipse(x,y,a,b,c) gdispGDrawEllipse(GDISP,x,y,a,b,c) #define gdispDrawEllipse(x,y,a,b,c) gdispGDrawEllipse(GDISP,x,y,a,b,c)
/** /**
@ -625,7 +625,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGFillEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, color_t color); void gdispGFillEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, gColor color);
#define gdispFillEllipse(x,y,a,b,c) gdispGFillEllipse(GDISP,x,y,a,b,c) #define gdispFillEllipse(x,y,a,b,c) gdispGFillEllipse(GDISP,x,y,a,b,c)
#endif #endif
@ -657,7 +657,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGDrawArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, color_t color); void gdispGDrawArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, gColor color);
#define gdispDrawArcSectors(x,y,r,s,c) gdispGDrawArcSectors(GDISP,x,y,r,s,c) #define gdispDrawArcSectors(x,y,r,s,c) gdispGDrawArcSectors(GDISP,x,y,r,s,c)
/** /**
@ -686,7 +686,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGFillArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, color_t color); void gdispGFillArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, gColor color);
#define gdispFillArcSectors(x,y,r,s,c) gdispGFillArcSectors(GDISP,x,y,r,s,c) #define gdispFillArcSectors(x,y,r,s,c) gdispGFillArcSectors(GDISP,x,y,r,s,c)
#endif #endif
@ -713,7 +713,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGDrawArc(GDisplay *g, gCoord x, gCoord y, gCoord radius, gCoord startangle, gCoord endangle, color_t color); void gdispGDrawArc(GDisplay *g, gCoord x, gCoord y, gCoord radius, gCoord startangle, gCoord endangle, gColor color);
#define gdispDrawArc(x,y,r,s,e,c) gdispGDrawArc(GDISP,x,y,r,s,e,c) #define gdispDrawArc(x,y,r,s,e,c) gdispGDrawArc(GDISP,x,y,r,s,e,c)
/** /**
@ -738,7 +738,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGDrawThickArc(GDisplay *g, gCoord xc, gCoord yc, gCoord startradius, gCoord endradius, gCoord startangle, gCoord endangle, color_t color); void gdispGDrawThickArc(GDisplay *g, gCoord xc, gCoord yc, gCoord startradius, gCoord endradius, gCoord startangle, gCoord endangle, gColor color);
#define gdispDrawThickArc(x,y,rs,re,s,e,c) gdispGDrawThickArc(GDISP,x,y,rs,re,s,e,c) #define gdispDrawThickArc(x,y,rs,re,s,e,c) gdispGDrawThickArc(GDISP,x,y,rs,re,s,e,c)
/** /**
@ -763,7 +763,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGFillArc(GDisplay *g, gCoord x, gCoord y, gCoord radius, gCoord startangle, gCoord endangle, color_t color); void gdispGFillArc(GDisplay *g, gCoord x, gCoord y, gCoord radius, gCoord startangle, gCoord endangle, gColor color);
#define gdispFillArc(x,y,r,s,e,c) gdispGFillArc(GDISP,x,y,r,s,e,c) #define gdispFillArc(x,y,r,s,e,c) gdispGFillArc(GDISP,x,y,r,s,e,c)
#endif #endif
@ -780,7 +780,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
color_t gdispGGetPixelColor(GDisplay *g, gCoord x, gCoord y); gColor gdispGGetPixelColor(GDisplay *g, gCoord x, gCoord y);
#define gdispGetPixelColor(x,y) gdispGGetPixelColor(GDISP,x,y) #define gdispGetPixelColor(x,y) gdispGGetPixelColor(GDISP,x,y)
#endif #endif
@ -801,7 +801,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGVerticalScroll(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, int lines, color_t bgcolor); void gdispGVerticalScroll(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, int lines, gColor bgcolor);
#define gdispVerticalScroll(x,y,cx,cy,l,b) gdispGVerticalScroll(GDISP,x,y,cx,cy,l,b) #define gdispVerticalScroll(x,y,cx,cy,l,b) gdispGVerticalScroll(GDISP,x,y,cx,cy,l,b)
#endif #endif
@ -855,7 +855,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGDrawPoly(GDisplay *g, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt, color_t color); void gdispGDrawPoly(GDisplay *g, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt, gColor color);
#define gdispDrawPoly(x,y,p,i,c) gdispGDrawPoly(GDISP,x,y,p,i,c) #define gdispDrawPoly(x,y,p,i,c) gdispGDrawPoly(GDISP,x,y,p,i,c)
/** /**
@ -879,7 +879,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGFillConvexPoly(GDisplay *g, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt, color_t color); void gdispGFillConvexPoly(GDisplay *g, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt, gColor color);
#define gdispFillConvexPoly(x,y,p,i,c) gdispGFillConvexPoly(GDISP,x,y,p,i,c) #define gdispFillConvexPoly(x,y,p,i,c) gdispGFillConvexPoly(GDISP,x,y,p,i,c)
/** /**
@ -898,7 +898,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGDrawThickLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, color_t color, gCoord width, gBool round); void gdispGDrawThickLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gColor color, gCoord width, gBool round);
#define gdispDrawThickLine(x0,y0,x1,y1,c,w,r) gdispGDrawThickLine(GDISP,x0,y0,x1,y1,c,w,r) #define gdispDrawThickLine(x0,y0,x1,y1,c,w,r) gdispGDrawThickLine(GDISP,x0,y0,x1,y1,c,w,r)
#endif #endif
@ -917,7 +917,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, font_t font, color_t color); void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, font_t font, gColor color);
#define gdispDrawChar(x,y,s,f,c) gdispGDrawChar(GDISP,x,y,s,f,c) #define gdispDrawChar(x,y,s,f,c) gdispGDrawChar(GDISP,x,y,s,f,c)
/** /**
@ -933,7 +933,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, font_t font, color_t color, color_t bgcolor); void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, font_t font, gColor color, gColor bgcolor);
#define gdispFillChar(x,y,s,f,c,b) gdispGFillChar(GDISP,x,y,s,f,c,b) #define gdispFillChar(x,y,s,f,c,b) gdispGFillChar(GDISP,x,y,s,f,c,b)
/** /**
@ -948,7 +948,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGDrawString(GDisplay *g, gCoord x, gCoord y, const char *str, font_t font, color_t color); void gdispGDrawString(GDisplay *g, gCoord x, gCoord y, const char *str, font_t font, gColor color);
#define gdispDrawString(x,y,s,f,c) gdispGDrawString(GDISP,x,y,s,f,c) #define gdispDrawString(x,y,s,f,c) gdispGDrawString(GDISP,x,y,s,f,c)
/** /**
@ -964,7 +964,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGFillString(GDisplay *g, gCoord x, gCoord y, const char *str, font_t font, color_t color, color_t bgcolor); void gdispGFillString(GDisplay *g, gCoord x, gCoord y, const char *str, font_t font, gColor color, gColor bgcolor);
#define gdispFillString(x,y,s,f,c,b) gdispGFillString(GDISP,x,y,s,f,c,b) #define gdispFillString(x,y,s,f,c,b) gdispGFillString(GDISP,x,y,s,f,c,b)
/** /**
@ -981,7 +981,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, color_t color, justify_t justify); void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, justify_t justify);
#define gdispDrawStringBox(x,y,cx,cy,s,f,c,j) gdispGDrawStringBox(GDISP,x,y,cx,cy,s,f,c,j) #define gdispDrawStringBox(x,y,cx,cy,s,f,c,j) gdispGDrawStringBox(GDISP,x,y,cx,cy,s,f,c,j)
/** /**
@ -1000,7 +1000,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, color_t color, color_t bgColor, justify_t justify); void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, gColor bgColor, justify_t justify);
#define gdispFillStringBox(x,y,cx,cy,s,f,c,b,j) gdispGFillStringBox(GDISP,x,y,cx,cy,s,f,c,b,j) #define gdispFillStringBox(x,y,cx,cy,s,f,c,b,j) gdispGFillStringBox(GDISP,x,y,cx,cy,s,f,c,b,j)
/** /**
@ -1130,7 +1130,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGDrawRoundedBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord radius, color_t color); void gdispGDrawRoundedBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord radius, gColor color);
#define gdispDrawRoundedBox(x,y,cx,cy,r,c) gdispGDrawRoundedBox(GDISP,x,y,cx,cy,r,c) #define gdispDrawRoundedBox(x,y,cx,cy,r,c) gdispGDrawRoundedBox(GDISP,x,y,cx,cy,r,c)
/** /**
@ -1145,7 +1145,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
* *
* @api * @api
*/ */
void gdispGFillRoundedBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord radius, color_t color); void gdispGFillRoundedBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord radius, gColor color);
#define gdispFillRoundedBox(x,y,cx,cy,r,c) gdispGFillRoundedBox(GDISP,x,y,cx,cy,r,c) #define gdispFillRoundedBox(x,y,cx,cy,r,c) gdispGFillRoundedBox(GDISP,x,y,cx,cy,r,c)
#endif #endif
@ -1230,6 +1230,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, color_
/* V2 compatibility */ /* V2 compatibility */
#if GFX_COMPAT_V2 #if GFX_COMPAT_V2
typedef gColor color_t;
typedef gPixel pixel_t; typedef gPixel pixel_t;
typedef gCoord coord_t; typedef gCoord coord_t;
typedef gPoint point, point_t; typedef gPoint point, point_t;

View File

@ -188,17 +188,17 @@ typedef uint16_t colorformat;
* tv luminance (0.26126R + 0.7152G + 0.0722B), digital tv luminance of (0.299R + 0.587G + 0.114B), or * tv luminance (0.26126R + 0.7152G + 0.0722B), digital tv luminance of (0.299R + 0.587G + 0.114B), or
* @p LUMA_OF() which uses (0.25R + 0.5G + 0.25B). * @p LUMA_OF() which uses (0.25R + 0.5G + 0.25B).
*/ */
#define LUMA2COLOR(l) ((color_t)((((l) & 0xF8)<<8) | (((l) & 0xFC)<<3) | (((l) & 0xF8)>>3))) #define LUMA2COLOR(l) ((gColor)((((l) & 0xF8)<<8) | (((l) & 0xFC)<<3) | (((l) & 0xF8)>>3)))
/** /**
* @brief Convert red, green, blue (each 0 to 255) into a color value. * @brief Convert red, green, blue (each 0 to 255) into a color value.
*/ */
#define RGB2COLOR(r,g,b) ((color_t)((((r) & 0xF8)<<8) | (((g) & 0xFC)<<3) | (((b) & 0xF8)>>3))) #define RGB2COLOR(r,g,b) ((gColor)((((r) & 0xF8)<<8) | (((g) & 0xFC)<<3) | (((b) & 0xF8)>>3)))
/** /**
* @brief Convert a 6 digit HTML code (hex) into a color value. * @brief Convert a 6 digit HTML code (hex) into a color value.
*/ */
#define HTML2COLOR(h) ((color_t)((((h) & 0xF80000)>>8) | (((h) & 0x00FC00)>>5) | (((h) & 0x0000F8)>>3))) #define HTML2COLOR(h) ((gColor)((((h) & 0xF80000)>>8) | (((h) & 0x00FC00)>>5) | (((h) & 0x0000F8)>>3)))
/** /**
* @name Extraction macros (quick) * @name Extraction macros (quick)
@ -434,7 +434,7 @@ typedef uint16_t colorformat;
/** /**
* @brief The color type definition * @brief The color type definition
*/ */
typedef COLOR_TYPE color_t; typedef COLOR_TYPE gColor;
#endif /* GFX_USE_GDISP */ #endif /* GFX_USE_GDISP */

View File

@ -284,7 +284,7 @@
/* Verify information for packed pixels and define a non-packed pixel macro */ /* Verify information for packed pixels and define a non-packed pixel macro */
#if !GDISP_PACKED_PIXELS #if !GDISP_PACKED_PIXELS
#define gdispPackPixels(buf,cx,x,y,c) { ((color_t *)(buf))[(y)*(cx)+(x)] = (c); } #define gdispPackPixels(buf,cx,x,y,c) { ((gColor *)(buf))[(y)*(cx)+(x)] = (c); }
#elif !GDISP_HARDWARE_BITFILLS #elif !GDISP_HARDWARE_BITFILLS
#error "GDISP: packed pixel formats are only supported for hardware accelerated drivers." #error "GDISP: packed pixel formats are only supported for hardware accelerated drivers."
#elif GDISP_PIXELFORMAT != GDISP_PIXELFORMAT_RGB888 \ #elif GDISP_PIXELFORMAT != GDISP_PIXELFORMAT_RGB888 \
@ -308,7 +308,7 @@
* *
* @api * @api
*/ */
void gdispPackPixels(const gPixel *buf, gCoord cx, gCoord x, gCoord y, color_t color); void gdispPackPixels(const gPixel *buf, gCoord cx, gCoord x, gCoord y, gColor color);
#endif #endif
//------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------
@ -353,7 +353,7 @@ struct GDisplay {
gCoord cx, cy; gCoord cx, cy;
gCoord x1, y1; gCoord x1, y1;
gCoord x2, y2; gCoord x2, y2;
color_t color; gColor color;
void *ptr; void *ptr;
} p; } p;
@ -363,8 +363,8 @@ struct GDisplay {
// Text rendering parameters // Text rendering parameters
struct { struct {
font_t font; font_t font;
color_t color; gColor color;
color_t bgcolor; gColor bgcolor;
gCoord clipx0, clipy0; gCoord clipx0, clipy0;
gCoord clipx1, clipy1; gCoord clipx1, clipy1;
#if GDISP_NEED_TEXT_WORDWRAP #if GDISP_NEED_TEXT_WORDWRAP
@ -375,7 +375,7 @@ struct GDisplay {
#endif #endif
#if GDISP_LINEBUF_SIZE != 0 && ((GDISP_NEED_SCROLL && !GDISP_HARDWARE_SCROLL) || (!GDISP_HARDWARE_STREAM_WRITE && GDISP_HARDWARE_BITFILLS)) #if GDISP_LINEBUF_SIZE != 0 && ((GDISP_NEED_SCROLL && !GDISP_HARDWARE_SCROLL) || (!GDISP_HARDWARE_STREAM_WRITE && GDISP_HARDWARE_BITFILLS))
// A pixel line buffer // A pixel line buffer
color_t linebuf[GDISP_LINEBUF_SIZE]; gColor linebuf[GDISP_LINEBUF_SIZE];
#endif #endif
}; };
@ -390,13 +390,13 @@ typedef struct GDISPVMT {
void (*writecolor)(GDisplay *g); // Uses p.color void (*writecolor)(GDisplay *g); // Uses p.color
void (*writestop)(GDisplay *g); // Uses no parameters void (*writestop)(GDisplay *g); // Uses no parameters
void (*readstart)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy void (*readstart)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy
color_t (*readcolor)(GDisplay *g); // Uses no parameters gColor (*readcolor)(GDisplay *g); // Uses no parameters
void (*readstop)(GDisplay *g); // Uses no parameters void (*readstop)(GDisplay *g); // Uses no parameters
void (*pixel)(GDisplay *g); // Uses p.x,p.y p.color void (*pixel)(GDisplay *g); // Uses p.x,p.y p.color
void (*clear)(GDisplay *g); // Uses p.color void (*clear)(GDisplay *g); // Uses p.color
void (*fill)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy p.color void (*fill)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy p.color
void (*blit)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy p.x1,p.y1 (=srcx,srcy) p.x2 (=srccx), p.ptr (=buffer) void (*blit)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy p.x1,p.y1 (=srcx,srcy) p.x2 (=srccx), p.ptr (=buffer)
color_t (*get)(GDisplay *g); // Uses p.x,p.y gColor (*get)(GDisplay *g); // Uses p.x,p.y
void (*vscroll)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy, p.y1 (=lines) p.color void (*vscroll)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy, p.y1 (=lines) p.color
void (*control)(GDisplay *g); // Uses p.x (=what) p.ptr (=value) void (*control)(GDisplay *g); // Uses p.x (=what) p.ptr (=value)
void *(*query)(GDisplay *g); // Uses p.x (=what); void *(*query)(GDisplay *g); // Uses p.x (=what);
@ -526,7 +526,7 @@ typedef struct GDISPVMT {
* *
* @note The parameter variables must not be altered by the driver. * @note The parameter variables must not be altered by the driver.
*/ */
LLDSPEC color_t gdisp_lld_read_color(GDisplay *g); LLDSPEC gColor gdisp_lld_read_color(GDisplay *g);
/** /**
* @brief End the current streaming operation * @brief End the current streaming operation
@ -609,7 +609,7 @@ typedef struct GDISPVMT {
* *
* @note The parameter variables must not be altered by the driver. * @note The parameter variables must not be altered by the driver.
*/ */
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g); LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g);
#endif #endif
#if (GDISP_HARDWARE_SCROLL && GDISP_NEED_SCROLL) || defined(__DOXYGEN__) #if (GDISP_HARDWARE_SCROLL && GDISP_NEED_SCROLL) || defined(__DOXYGEN__)

View File

@ -34,8 +34,8 @@
extern gdispImageError gdispGImageDraw_BMP(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy); extern gdispImageError gdispGImageDraw_BMP(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
extern delaytime_t gdispImageNext_BMP(gdispImage *img); extern delaytime_t gdispImageNext_BMP(gdispImage *img);
extern uint16_t gdispImageGetPaletteSize_BMP(gdispImage *img); extern uint16_t gdispImageGetPaletteSize_BMP(gdispImage *img);
extern color_t gdispImageGetPalette_BMP(gdispImage *img, uint16_t index); extern gColor gdispImageGetPalette_BMP(gdispImage *img, uint16_t index);
extern gBool gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, color_t newColor); extern gBool gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, gColor newColor);
#endif #endif
#if GDISP_NEED_IMAGE_JPG #if GDISP_NEED_IMAGE_JPG
@ -66,8 +66,8 @@ typedef struct gdispImageHandlers {
gCoord sx, gCoord sy); /* The draw function */ gCoord sx, gCoord sy); /* The draw function */
delaytime_t (*next)(gdispImage *img); /* The next frame function */ delaytime_t (*next)(gdispImage *img); /* The next frame function */
uint16_t (*getPaletteSize)(gdispImage *img); /* Retrieve the size of the palette (number of entries) */ uint16_t (*getPaletteSize)(gdispImage *img); /* Retrieve the size of the palette (number of entries) */
color_t (*getPalette)(gdispImage *img, uint16_t index); /* Retrieve a specific color value of the palette */ gColor (*getPalette)(gdispImage *img, uint16_t index); /* Retrieve a specific color value of the palette */
gBool (*adjustPalette)(gdispImage *img, uint16_t index, color_t newColor); /* Replace a color value in the palette */ gBool (*adjustPalette)(gdispImage *img, uint16_t index, gColor newColor); /* Replace a color value in the palette */
} gdispImageHandlers; } gdispImageHandlers;
static gdispImageHandlers ImageHandlers[] = { static gdispImageHandlers ImageHandlers[] = {
@ -158,7 +158,7 @@ gBool gdispImageIsOpen(gdispImage *img) {
return img && img->type != GDISP_IMAGE_TYPE_UNKNOWN && img->fns != 0; return img && img->type != GDISP_IMAGE_TYPE_UNKNOWN && img->fns != 0;
} }
void gdispImageSetBgColor(gdispImage *img, color_t bgcolor) { void gdispImageSetBgColor(gdispImage *img, gColor bgcolor) {
if (!img) if (!img)
return; return;
img->bgcolor = bgcolor; img->bgcolor = bgcolor;
@ -198,13 +198,13 @@ uint16_t gdispImageGetPaletteSize(gdispImage *img) {
return img->fns->getPaletteSize(img); return img->fns->getPaletteSize(img);
} }
color_t gdispImageGetPalette(gdispImage *img, uint16_t index) { gColor gdispImageGetPalette(gdispImage *img, uint16_t index) {
if (!img || !img->fns) return 0; if (!img || !img->fns) return 0;
if (!img->fns->getPalette) return 0; if (!img->fns->getPalette) return 0;
return img->fns->getPalette(img, index); return img->fns->getPalette(img, index);
} }
gBool gdispImageAdjustPalette(gdispImage *img, uint16_t index, color_t newColor) { gBool gdispImageAdjustPalette(gdispImage *img, uint16_t index, gColor newColor) {
if (!img || !img->fns) return gFalse; if (!img || !img->fns) return gFalse;
if (!img->fns->adjustPalette) return gFalse; if (!img->fns->adjustPalette) return gFalse;
return img->fns->adjustPalette(img, index, newColor); return img->fns->adjustPalette(img, index, newColor);

View File

@ -59,7 +59,7 @@ typedef uint16_t gdispImageFlags;
typedef struct gdispImage { typedef struct gdispImage {
gdispImageType type; /* @< The image type */ gdispImageType type; /* @< The image type */
gdispImageFlags flags; /* @< The image flags */ gdispImageFlags flags; /* @< The image flags */
color_t bgcolor; /* @< The default background color */ gColor bgcolor; /* @< The default background color */
gCoord width, height; /* @< The image dimensions */ gCoord width, height; /* @< The image dimensions */
GFILE * f; /* @< The underlying GFILE */ GFILE * f; /* @< The underlying GFILE */
#if GDISP_NEED_IMAGE_ACCOUNTING #if GDISP_NEED_IMAGE_ACCOUNTING
@ -182,7 +182,7 @@ gBool gdispImageIsOpen(gdispImage *img);
* @note This color is only used when an image has to restore part of the background before * @note This color is only used when an image has to restore part of the background before
* continuing with drawing that includes transparency eg some GIF animations. * continuing with drawing that includes transparency eg some GIF animations.
*/ */
void gdispImageSetBgColor(gdispImage *img, color_t bgcolor); void gdispImageSetBgColor(gdispImage *img, gColor bgcolor);
/** /**
* @brief Cache the image * @brief Cache the image
@ -266,7 +266,7 @@ uint16_t gdispImageGetPaletteSize(gdispImage *img);
* *
* @note This function will return 0 if the index is out of bounds or if the image doesn't use a color palette. * @note This function will return 0 if the index is out of bounds or if the image doesn't use a color palette.
*/ */
color_t gdispImageGetPalette(gdispImage *img, uint16_t index); gColor gdispImageGetPalette(gdispImage *img, uint16_t index);
/** /**
* @brief Modify an entry in the color palette. * @brief Modify an entry in the color palette.
@ -279,7 +279,7 @@ color_t gdispImageGetPalette(gdispImage *img, uint16_t index);
* @pre gdispImageOpen() must have returned successfully. * @pre gdispImageOpen() must have returned successfully.
* @note This function will return @p gFalse if the index is out of bounds or if the image doesn't use a color palette. * @note This function will return @p gFalse if the index is out of bounds or if the image doesn't use a color palette.
*/ */
gBool gdispImageAdjustPalette(gdispImage *img, uint16_t index, color_t newColor); gBool gdispImageAdjustPalette(gdispImage *img, uint16_t index, gColor newColor);
#endif /* GFX_USE_GDISP && GDISP_NEED_IMAGE */ #endif /* GFX_USE_GDISP && GDISP_NEED_IMAGE */
#endif /* _GDISP_IMAGE_H */ #endif /* _GDISP_IMAGE_H */

View File

@ -52,7 +52,7 @@ void gdispImageClose_BMP(gdispImage *img) {
if (priv) { if (priv) {
#if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_4_RLE || GDISP_NEED_IMAGE_BMP_8 || GDISP_NEED_IMAGE_BMP_8_RLE #if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_4_RLE || GDISP_NEED_IMAGE_BMP_8 || GDISP_NEED_IMAGE_BMP_8_RLE
if (priv->palette) if (priv->palette)
gdispImageFree(img, (void *)priv->palette, priv->palsize*sizeof(color_t)); gdispImageFree(img, (void *)priv->palette, priv->palsize*sizeof(gColor));
#endif #endif
if (priv->frame0cache) if (priv->frame0cache)
gdispImageFree(img, (void *)priv->frame0cache, img->width*img->height*sizeof(gPixel)); gdispImageFree(img, (void *)priv->frame0cache, img->width*img->height*sizeof(gPixel));
@ -262,7 +262,7 @@ gdispImageError gdispImageOpen_BMP(gdispImage *img) {
if (priv->bmpflags & BMP_PALETTE) { if (priv->bmpflags & BMP_PALETTE) {
gfileSetPos(img->f, offsetColorTable); gfileSetPos(img->f, offsetColorTable);
if (!(priv->palette = (color_t *)gdispImageAlloc(img, priv->palsize*sizeof(color_t)))) if (!(priv->palette = (gColor *)gdispImageAlloc(img, priv->palsize*sizeof(gColor))))
return GDISP_IMAGE_ERR_NOMEMORY; return GDISP_IMAGE_ERR_NOMEMORY;
if (priv->bmpflags & BMP_V2) { if (priv->bmpflags & BMP_V2) {
for(aword = 0; aword < priv->palsize; aword++) { for(aword = 0; aword < priv->palsize; aword++) {
@ -354,7 +354,7 @@ unsupportedcleanup:
static gCoord getPixels(gdispImage *img, gCoord x) { static gCoord getPixels(gdispImage *img, gCoord x) {
gdispImagePrivate_BMP * priv; gdispImagePrivate_BMP * priv;
color_t * pc; gColor * pc;
gCoord len; gCoord len;
priv = (gdispImagePrivate_BMP *)img->priv; priv = (gdispImagePrivate_BMP *)img->priv;
@ -591,7 +591,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
case 16: case 16:
{ {
uint16_t w[2]; uint16_t w[2];
color_t r, g, b; gColor r, g, b;
while(x < img->width && len <= GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE-2) { while(x < img->width && len <= GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE-2) {
if (gfileRead(img->f, &w, 4) != 4) if (gfileRead(img->f, &w, 4) != 4)
@ -599,29 +599,29 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
gdispImageMakeLE16(w[0]); gdispImageMakeLE16(w[0]);
gdispImageMakeLE16(w[1]); gdispImageMakeLE16(w[1]);
if (priv->shiftred < 0) if (priv->shiftred < 0)
r = (color_t)((w[0] & priv->maskred) << -priv->shiftred); r = (gColor)((w[0] & priv->maskred) << -priv->shiftred);
else else
r = (color_t)((w[0] & priv->maskred) >> priv->shiftred); r = (gColor)((w[0] & priv->maskred) >> priv->shiftred);
if (priv->shiftgreen < 0) if (priv->shiftgreen < 0)
g = (color_t)((w[0] & priv->maskgreen) << -priv->shiftgreen); g = (gColor)((w[0] & priv->maskgreen) << -priv->shiftgreen);
else else
g = (color_t)((w[0] & priv->maskgreen) >> priv->shiftgreen); g = (gColor)((w[0] & priv->maskgreen) >> priv->shiftgreen);
if (priv->shiftblue < 0) if (priv->shiftblue < 0)
b = (color_t)((w[0] & priv->maskblue) << -priv->shiftblue); b = (gColor)((w[0] & priv->maskblue) << -priv->shiftblue);
else else
b = (color_t)((w[0] & priv->maskblue) >> priv->shiftblue); b = (gColor)((w[0] & priv->maskblue) >> priv->shiftblue);
/* We don't support alpha yet */ /* We don't support alpha yet */
*pc++ = RGB2COLOR(r, g, b); *pc++ = RGB2COLOR(r, g, b);
if (priv->shiftred < 0) if (priv->shiftred < 0)
r = (color_t)((w[1] & priv->maskred) << -priv->shiftred); r = (gColor)((w[1] & priv->maskred) << -priv->shiftred);
else else
r = (color_t)((w[1] & priv->maskred) >> priv->shiftred); r = (gColor)((w[1] & priv->maskred) >> priv->shiftred);
if (priv->shiftgreen < 0) if (priv->shiftgreen < 0)
g = (color_t)((w[1] & priv->maskgreen) << -priv->shiftgreen); g = (gColor)((w[1] & priv->maskgreen) << -priv->shiftgreen);
else else
g = (color_t)((w[1] & priv->maskgreen) >> priv->shiftgreen); g = (gColor)((w[1] & priv->maskgreen) >> priv->shiftgreen);
if (priv->shiftblue < 0) if (priv->shiftblue < 0)
b = (color_t)((w[1] & priv->maskblue) << -priv->shiftblue); b = (gColor)((w[1] & priv->maskblue) << -priv->shiftblue);
else else
b = (uint8_t)((w[1] & priv->maskblue) >> priv->shiftblue); b = (uint8_t)((w[1] & priv->maskblue) >> priv->shiftblue);
/* We don't support alpha yet */ /* We don't support alpha yet */
@ -659,24 +659,24 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
case 32: case 32:
{ {
uint32_t dw; uint32_t dw;
color_t r, g, b; gColor r, g, b;
while(x < img->width && len < GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE) { while(x < img->width && len < GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE) {
if (gfileRead(img->f, &dw, 4) != 4) if (gfileRead(img->f, &dw, 4) != 4)
return 0; return 0;
gdispImageMakeLE32(dw); gdispImageMakeLE32(dw);
if (priv->shiftred < 0) if (priv->shiftred < 0)
r = (color_t)((dw & priv->maskred) << -priv->shiftred); r = (gColor)((dw & priv->maskred) << -priv->shiftred);
else else
r = (color_t)((dw & priv->maskred) >> priv->shiftred); r = (gColor)((dw & priv->maskred) >> priv->shiftred);
if (priv->shiftgreen < 0) if (priv->shiftgreen < 0)
g = (color_t)((dw & priv->maskgreen) << -priv->shiftgreen); g = (gColor)((dw & priv->maskgreen) << -priv->shiftgreen);
else else
g = (color_t)((dw & priv->maskgreen) >> priv->shiftgreen); g = (gColor)((dw & priv->maskgreen) >> priv->shiftgreen);
if (priv->shiftblue < 0) if (priv->shiftblue < 0)
b = (color_t)((dw & priv->maskblue) << -priv->shiftblue); b = (gColor)((dw & priv->maskblue) << -priv->shiftblue);
else else
b = (color_t)((dw & priv->maskblue) >> priv->shiftblue); b = (gColor)((dw & priv->maskblue) >> priv->shiftblue);
/* We don't support alpha yet */ /* We don't support alpha yet */
*pc++ = RGB2COLOR(r, g, b); *pc++ = RGB2COLOR(r, g, b);
x++; x++;
@ -693,8 +693,8 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
gdispImageError gdispImageCache_BMP(gdispImage *img) { gdispImageError gdispImageCache_BMP(gdispImage *img) {
gdispImagePrivate_BMP * priv; gdispImagePrivate_BMP * priv;
color_t * pcs; gColor * pcs;
color_t * pcd; gColor * pcd;
gCoord pos, x, y; gCoord pos, x, y;
size_t len; size_t len;
@ -839,7 +839,7 @@ uint16_t gdispImageGetPaletteSize_BMP(gdispImage *img) {
#endif #endif
} }
color_t gdispImageGetPalette_BMP(gdispImage *img, uint16_t index) { gColor gdispImageGetPalette_BMP(gdispImage *img, uint16_t index) {
#if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8 #if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8
gdispImagePrivate_BMP *priv; gdispImagePrivate_BMP *priv;
@ -860,7 +860,7 @@ color_t gdispImageGetPalette_BMP(gdispImage *img, uint16_t index) {
#endif #endif
} }
gBool gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, color_t newColor) { gBool gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, gColor newColor) {
#if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8 #if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8
gdispImagePrivate_BMP *priv; gdispImagePrivate_BMP *priv;

View File

@ -43,7 +43,7 @@ typedef struct gifimgdecode {
uint16_t code_max; uint16_t code_max;
uint16_t code_last; uint16_t code_last;
uint32_t shiftdata; uint32_t shiftdata;
color_t * palette; gColor * palette;
uint8_t buf[GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE]; // Buffer for decoded pixels uint8_t buf[GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE]; // Buffer for decoded pixels
uint16_t prefix[1<<GIF_MAX_CODE_BITS]; // The LZW table uint16_t prefix[1<<GIF_MAX_CODE_BITS]; // The LZW table
uint8_t suffix[1<<GIF_MAX_CODE_BITS]; // So we can trace the codes uint8_t suffix[1<<GIF_MAX_CODE_BITS]; // So we can trace the codes
@ -71,7 +71,7 @@ typedef struct gifimgframe {
// The data for a cache // The data for a cache
typedef struct gifimgcache { typedef struct gifimgcache {
gifimgframe frame; gifimgframe frame;
color_t * palette; // Local palette gColor * palette; // Local palette
uint8_t * imagebits; // Image bits - only saved when caching uint8_t * imagebits; // Image bits - only saved when caching
struct gifimgcache *next; // Next cached frame struct gifimgcache *next; // Next cached frame
} gifimgcache; } gifimgcache;
@ -114,7 +114,7 @@ static gdispImageError startDecodeGif(gdispImage *img) {
priv = (gdispImagePrivate_GIF *)img->priv; priv = (gdispImagePrivate_GIF *)img->priv;
// We need the decode ram, and possibly a palette // We need the decode ram, and possibly a palette
if (!(decode = (gifimgdecode *)gdispImageAlloc(img, sizeof(gifimgdecode)+priv->frame.palsize*sizeof(color_t)))) if (!(decode = (gifimgdecode *)gdispImageAlloc(img, sizeof(gifimgdecode)+priv->frame.palsize*sizeof(gColor))))
return GDISP_IMAGE_ERR_NOMEMORY; return GDISP_IMAGE_ERR_NOMEMORY;
// We currently have not read any image data block // We currently have not read any image data block
@ -124,7 +124,7 @@ static gdispImageError startDecodeGif(gdispImage *img) {
if (priv->frame.palsize) { if (priv->frame.palsize) {
// Local palette // Local palette
decode->maxpixel = priv->frame.palsize-1; decode->maxpixel = priv->frame.palsize-1;
decode->palette = (color_t *)(decode+1); decode->palette = (gColor *)(decode+1);
gfileSetPos(img->f, priv->frame.pospal); gfileSetPos(img->f, priv->frame.pospal);
for(cnt = 0; cnt < priv->frame.palsize; cnt++) { for(cnt = 0; cnt < priv->frame.palsize; cnt++) {
if (gfileRead(img->f, &decode->buf, 3) != 3) if (gfileRead(img->f, &decode->buf, 3) != 3)
@ -161,7 +161,7 @@ static gdispImageError startDecodeGif(gdispImage *img) {
return GDISP_IMAGE_ERR_OK; return GDISP_IMAGE_ERR_OK;
baddatacleanup: baddatacleanup:
gdispImageFree(img, decode, sizeof(gifimgdecode)+priv->frame.palsize*sizeof(color_t)); gdispImageFree(img, decode, sizeof(gifimgdecode)+priv->frame.palsize*sizeof(gColor));
return GDISP_IMAGE_ERR_BADDATA; return GDISP_IMAGE_ERR_BADDATA;
} }
@ -177,7 +177,7 @@ static void stopDecodeGif(gdispImage *img) {
// Free the decode data // Free the decode data
if (priv->decode) { if (priv->decode) {
gdispImageFree(img, (void *)priv->decode, sizeof(gifimgdecode)+priv->frame.palsize*sizeof(color_t)); gdispImageFree(img, (void *)priv->decode, sizeof(gifimgdecode)+priv->frame.palsize*sizeof(gColor));
priv->decode = 0; priv->decode = 0;
} }
} }
@ -504,11 +504,11 @@ void gdispImageClose_GIF(gdispImage *img) {
cache = priv->cache; cache = priv->cache;
while(cache) { while(cache) {
ncache = cache->next; ncache = cache->next;
gdispImageFree(img, (void *)cache, sizeof(gifimgcache)+cache->frame.width*cache->frame.height+cache->frame.palsize*sizeof(color_t)); gdispImageFree(img, (void *)cache, sizeof(gifimgcache)+cache->frame.width*cache->frame.height+cache->frame.palsize*sizeof(gColor));
cache = ncache; cache = ncache;
} }
if (priv->palette) if (priv->palette)
gdispImageFree(img, (void *)priv->palette, priv->palsize*sizeof(color_t)); gdispImageFree(img, (void *)priv->palette, priv->palsize*sizeof(gColor));
gdispImageFree(img, (void *)priv, sizeof(gdispImagePrivate_GIF)); gdispImageFree(img, (void *)priv, sizeof(gdispImagePrivate_GIF));
img->priv = 0; img->priv = 0;
} }
@ -559,7 +559,7 @@ gdispImageError gdispImageOpen_GIF(gdispImage *img) {
// Global color table // Global color table
priv->palsize = 2 << (((uint8_t *)priv->buf)[4] & 0x07); priv->palsize = 2 << (((uint8_t *)priv->buf)[4] & 0x07);
// Allocate the global palette // Allocate the global palette
if (!(priv->palette = (color_t *)gdispImageAlloc(img, priv->palsize*sizeof(color_t)))) if (!(priv->palette = (gColor *)gdispImageAlloc(img, priv->palsize*sizeof(gColor))))
goto nomemcleanup; goto nomemcleanup;
// Read the global palette // Read the global palette
for(aword = 0; aword < priv->palsize; aword++) { for(aword = 0; aword < priv->palsize; aword++) {
@ -610,13 +610,13 @@ gdispImageError gdispImageCache_GIF(gdispImage *img) {
return GDISP_IMAGE_ERR_OK; return GDISP_IMAGE_ERR_OK;
/* We need to allocate the frame, the palette and bits for the image */ /* We need to allocate the frame, the palette and bits for the image */
if (!(cache = (gifimgcache *)gdispImageAlloc(img, sizeof(gifimgcache) + priv->frame.palsize*sizeof(color_t) + priv->frame.width*priv->frame.height))) if (!(cache = (gifimgcache *)gdispImageAlloc(img, sizeof(gifimgcache) + priv->frame.palsize*sizeof(gColor) + priv->frame.width*priv->frame.height)))
return GDISP_IMAGE_ERR_NOMEMORY; return GDISP_IMAGE_ERR_NOMEMORY;
/* Initialise the cache */ /* Initialise the cache */
decode = 0; decode = 0;
cache->frame = priv->frame; cache->frame = priv->frame;
cache->imagebits = (uint8_t *)(cache+1) + cache->frame.palsize*sizeof(color_t); cache->imagebits = (uint8_t *)(cache+1) + cache->frame.palsize*sizeof(gColor);
cache->next = 0; cache->next = 0;
/* Start the decode */ /* Start the decode */
@ -630,7 +630,7 @@ gdispImageError gdispImageCache_GIF(gdispImage *img) {
// Save the palette // Save the palette
if (cache->frame.palsize) { if (cache->frame.palsize) {
cache->palette = (color_t *)(cache+1); cache->palette = (gColor *)(cache+1);
/* Copy the local palette into the cache */ /* Copy the local palette into the cache */
for(cnt = 0; cnt < cache->frame.palsize; cnt++) for(cnt = 0; cnt < cache->frame.palsize; cnt++)
@ -757,12 +757,12 @@ gdispImageError gdispImageCache_GIF(gdispImage *img) {
nomemcleanup: nomemcleanup:
stopDecodeGif(img); stopDecodeGif(img);
gdispImageFree(img, cache, sizeof(gifimgcache) + priv->frame.palsize*sizeof(color_t) + priv->frame.width*priv->frame.height); gdispImageFree(img, cache, sizeof(gifimgcache) + priv->frame.palsize*sizeof(gColor) + priv->frame.width*priv->frame.height);
return GDISP_IMAGE_ERR_NOMEMORY; return GDISP_IMAGE_ERR_NOMEMORY;
baddatacleanup: baddatacleanup:
stopDecodeGif(img); stopDecodeGif(img);
gdispImageFree(img, cache, sizeof(gifimgcache) + priv->frame.palsize*sizeof(color_t) + priv->frame.width*priv->frame.height); gdispImageFree(img, cache, sizeof(gifimgcache) + priv->frame.palsize*sizeof(gColor) + priv->frame.width*priv->frame.height);
return GDISP_IMAGE_ERR_BADDATA; return GDISP_IMAGE_ERR_BADDATA;
} }

View File

@ -39,7 +39,7 @@ typedef struct PNG_info {
void (*out)(struct PNG_decode *); // The scan line output function void (*out)(struct PNG_decode *); // The scan line output function
#if GDISP_NEED_IMAGE_PNG_BACKGROUND #if GDISP_NEED_IMAGE_PNG_BACKGROUND
color_t bg; // The background color gColor bg; // The background color
#endif #endif
#if GDISP_NEED_IMAGE_PNG_TRANSPARENCY #if GDISP_NEED_IMAGE_PNG_TRANSPARENCY
uint16_t trans_r; // Red/grayscale component of the transparent color (PNG_COLORMODE_GRAY and PNG_COLORMODE_RGB only) uint16_t trans_r; // Red/grayscale component of the transparent color (PNG_COLORMODE_GRAY and PNG_COLORMODE_RGB only)
@ -231,7 +231,7 @@ static gBool PNG_oStartY(PNG_output *o, gCoord y) {
} }
// Feed a pixel color to the display buffer // Feed a pixel color to the display buffer
static void PNG_oColor(PNG_output *o, color_t c) { static void PNG_oColor(PNG_output *o, gColor c) {
// Is it in the window // Is it in the window
if (o->ix+(gCoord)o->cnt < o->sx || o->ix+(gCoord)o->cnt >= o->sx+o->cx) { if (o->ix+(gCoord)o->cnt < o->sx || o->ix+(gCoord)o->cnt >= o->sx+o->cx) {
// No - just skip the pixel // No - just skip the pixel

View File

@ -46,7 +46,7 @@ typedef struct pixmap {
#if GDISP_NEED_PIXMAP_IMAGE #if GDISP_NEED_PIXMAP_IMAGE
uint8_t imghdr[8]; // This field must come just before the data member. uint8_t imghdr[8]; // This field must come just before the data member.
#endif #endif
color_t pixels[1]; // We really want pixels[0] but some compilers don't allow that even though it is C standard. gColor pixels[1]; // We really want pixels[0] but some compilers don't allow that even though it is C standard.
} pixmap; } pixmap;
GDisplay *gdispPixmapCreate(gCoord width, gCoord height) { GDisplay *gdispPixmapCreate(gCoord width, gCoord height) {
@ -55,7 +55,7 @@ GDisplay *gdispPixmapCreate(gCoord width, gCoord height) {
unsigned i; unsigned i;
// Calculate the size of the display surface in bytes // Calculate the size of the display surface in bytes
i = width*height*sizeof(color_t); i = width*height*sizeof(gColor);
if (i < 2*sizeof(gCoord)) if (i < 2*sizeof(gCoord))
i = 2*sizeof(gCoord); i = 2*sizeof(gCoord);
@ -159,7 +159,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
((pixmap *)(g)->priv)->pixels[pos] = g->p.color; ((pixmap *)(g)->priv)->pixels[pos] = g->p.color;
} }
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
unsigned pos; unsigned pos;
#if GDISP_NEED_CONTROL #if GDISP_NEED_CONTROL

View File

@ -30,8 +30,8 @@ static const gwinVMT basegwinVMT = {
0, // The after-clear routine 0, // The after-clear routine
}; };
static color_t defaultFgColor = GFX_WHITE; static gColor defaultFgColor = GFX_WHITE;
static color_t defaultBgColor = GFX_BLACK; static gColor defaultBgColor = GFX_BLACK;
#if GDISP_NEED_TEXT #if GDISP_NEED_TEXT
static font_t defaultFont; static font_t defaultFont;
#endif #endif
@ -161,19 +161,19 @@ void gwinClearInit(GWindowInit *pwi) {
*p++ = 0; *p++ = 0;
} }
void gwinSetDefaultColor(color_t clr) { void gwinSetDefaultColor(gColor clr) {
defaultFgColor = clr; defaultFgColor = clr;
} }
color_t gwinGetDefaultColor(void) { gColor gwinGetDefaultColor(void) {
return defaultFgColor; return defaultFgColor;
} }
void gwinSetDefaultBgColor(color_t bgclr) { void gwinSetDefaultBgColor(gColor bgclr) {
defaultBgColor = bgclr; defaultBgColor = bgclr;
} }
color_t gwinGetDefaultBgColor(void) { gColor gwinGetDefaultBgColor(void) {
return defaultBgColor; return defaultBgColor;
} }
@ -338,8 +338,8 @@ void gwinBlitArea(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord s
#endif #endif
#if GDISP_NEED_PIXELREAD #if GDISP_NEED_PIXELREAD
color_t gwinGetPixelColor(GHandle gh, gCoord x, gCoord y) { gColor gwinGetPixelColor(GHandle gh, gCoord x, gCoord y) {
if (!_gwinDrawStart(gh)) return (color_t)0; if (!_gwinDrawStart(gh)) return (gColor)0;
return gdispGGetPixelColor(gh->display, gh->x+x, gh->y+y); return gdispGGetPixelColor(gh->display, gh->x+x, gh->y+y);
_gwinDrawEnd(gh); _gwinDrawEnd(gh);
} }

View File

@ -48,8 +48,8 @@ typedef struct GWindowObject {
gCoord y; /**< The position relative to the screen */ gCoord y; /**< The position relative to the screen */
gCoord width; /**< The width of this window */ gCoord width; /**< The width of this window */
gCoord height; /**< The height of this window */ gCoord height; /**< The height of this window */
color_t color; /**< The current foreground drawing color */ gColor color; /**< The current foreground drawing color */
color_t bgcolor; /**< The current background drawing color */ gColor bgcolor; /**< The current background drawing color */
uint32_t flags; /**< Window flags (the meaning is private to the GWIN class) */ uint32_t flags; /**< Window flags (the meaning is private to the GWIN class) */
#if GDISP_NEED_TEXT #if GDISP_NEED_TEXT
font_t font; /**< The current font */ font_t font; /**< The current font */
@ -137,7 +137,7 @@ void gwinClearInit(GWindowInit *pwi);
* *
* @api * @api
*/ */
void gwinSetDefaultColor(color_t clr); void gwinSetDefaultColor(gColor clr);
/** /**
* @brief Get the default foreground color for all new GWIN windows * @brief Get the default foreground color for all new GWIN windows
@ -146,7 +146,7 @@ void gwinSetDefaultColor(color_t clr);
* *
* @api * @api
*/ */
color_t gwinGetDefaultColor(void); gColor gwinGetDefaultColor(void);
/** /**
* @brief Set the default background color for all new GWIN windows * @brief Set the default background color for all new GWIN windows
@ -155,7 +155,7 @@ color_t gwinGetDefaultColor(void);
* *
* @api * @api
*/ */
void gwinSetDefaultBgColor(color_t bgclr); void gwinSetDefaultBgColor(gColor bgclr);
/** /**
* @brief Get the default background color for all new GWIN windows * @brief Get the default background color for all new GWIN windows
@ -164,7 +164,7 @@ void gwinSetDefaultBgColor(color_t bgclr);
* *
* @api * @api
*/ */
color_t gwinGetDefaultBgColor(void); gColor gwinGetDefaultBgColor(void);
#if GDISP_NEED_TEXT || defined(__DOXYGEN__) #if GDISP_NEED_TEXT || defined(__DOXYGEN__)
/** /**
@ -871,7 +871,7 @@ void gwinBlitArea(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord s
* *
* @api * @api
*/ */
color_t gwinGetPixelColor(GHandle gh, gCoord x, gCoord y); gColor gwinGetPixelColor(GHandle gh, gCoord x, gCoord y);
#endif #endif
/*------------------------------------------------- /*-------------------------------------------------

View File

@ -184,7 +184,7 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
fixed alpha; fixed alpha;
fixed dalpha; fixed dalpha;
gCoord i; gCoord i;
color_t tcol, bcol; gColor tcol, bcol;
(void) param; (void) param;

View File

@ -255,7 +255,7 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) {
fixed alpha; fixed alpha;
fixed dalpha; fixed dalpha;
gCoord i; gCoord i;
color_t tcol, bcol; gColor tcol, bcol;
(void) param; (void) param;
if (gw->g.vmt != (gwinVMT *)&checkboxVMT) return; if (gw->g.vmt != (gwinVMT *)&checkboxVMT) return;

View File

@ -113,7 +113,7 @@
return gTrue; return gTrue;
} }
static color_t ESCPrintColor(GConsoleObject *gcw) { static gColor ESCPrintColor(GConsoleObject *gcw) {
switch(gcw->currattr & (ESC_REDBIT|ESC_GREENBIT|ESC_BLUEBIT|ESC_USECOLOR)) { switch(gcw->currattr & (ESC_REDBIT|ESC_GREENBIT|ESC_BLUEBIT|ESC_USECOLOR)) {
case (ESC_USECOLOR): case (ESC_USECOLOR):
return GFX_BLACK; return GFX_BLACK;

View File

@ -230,8 +230,8 @@ GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint
void gwinFrameDraw_Transparent(GWidgetObject *gw, void *param) { void gwinFrameDraw_Transparent(GWidgetObject *gw, void *param) {
const GColorSet *pcol; const GColorSet *pcol;
gCoord pos; gCoord pos;
color_t contrast; gColor contrast;
color_t btn; gColor btn;
(void)param; (void)param;
if (gw->g.vmt != (gwinVMT *)&frameVMT) if (gw->g.vmt != (gwinVMT *)&frameVMT)

View File

@ -86,7 +86,7 @@ static void gl3dRedraw(GWindowObject *gh) {
ZBuffer * zb; ZBuffer * zb;
zb = ((GGL3DObject *)gh)->glcxt->zb; zb = ((GGL3DObject *)gh)->glcxt->zb;
gdispGBlitArea(gh->display, gh->x, gh->y, zb->xsize, zb->ysize, 0, 0, zb->linesize/sizeof(color_t), (const gPixel *)zb->pbuf); gdispGBlitArea(gh->display, gh->x, gh->y, zb->xsize, zb->ysize, 0, 0, zb->linesize/sizeof(gColor), (const gPixel *)zb->pbuf);
} }
static int gl3dResizeGLViewport(GLContext *c, int *xsize_ptr, int *ysize_ptr) { static int gl3dResizeGLViewport(GLContext *c, int *xsize_ptr, int *ysize_ptr) {

View File

@ -34,7 +34,7 @@ typedef enum GGraphPointType_e {
typedef struct GGraphPointStyle_t { typedef struct GGraphPointStyle_t {
GGraphPointType type; GGraphPointType type;
gCoord size; gCoord size;
color_t color; gColor color;
} GGraphPointStyle; } GGraphPointStyle;
typedef enum GGraphLineType_e { typedef enum GGraphLineType_e {
@ -44,13 +44,13 @@ typedef enum GGraphLineType_e {
typedef struct GGraphLineStyle_t { typedef struct GGraphLineStyle_t {
GGraphLineType type; GGraphLineType type;
gCoord size; gCoord size;
color_t color; gColor color;
} GGraphLineStyle; } GGraphLineStyle;
typedef struct GGraphGridStyle_t { typedef struct GGraphGridStyle_t {
GGraphLineType type; GGraphLineType type;
gCoord size; gCoord size;
color_t color; gColor color;
gCoord spacing; gCoord spacing;
} GGraphGridStyle; } GGraphGridStyle;

View File

@ -35,7 +35,7 @@ static void ImageDestroy(GWindowObject *gh) {
static void ImageRedraw(GHandle gh) { static void ImageRedraw(GHandle gh) {
gCoord x, y, w, h, dx, dy; gCoord x, y, w, h, dx, dy;
color_t bg; gColor bg;
#if GWIN_NEED_IMAGE_ANIMATION #if GWIN_NEED_IMAGE_ANIMATION
delaytime_t delay; delaytime_t delay;
#endif #endif

View File

@ -131,7 +131,7 @@ void gwinLabelSetBorder(GHandle gh, gBool border) {
static void gwinLabelDraw(GWidgetObject *gw, justify_t justify) { static void gwinLabelDraw(GWidgetObject *gw, justify_t justify) {
gCoord w, h; gCoord w, h;
color_t c; gColor c;
// is it a valid handle? // is it a valid handle?
if (gw->g.vmt != (gwinVMT *)&labelVMT) if (gw->g.vmt != (gwinVMT *)&labelVMT)

View File

@ -704,7 +704,7 @@ void gwinListDefaultDraw(GWidgetObject* gw, void* param) {
const gfxQueueASyncItem* qi; const gfxQueueASyncItem* qi;
int i; int i;
gCoord x, y, iheight, iwidth; gCoord x, y, iheight, iwidth;
color_t fill; gColor fill;
const GColorSet * ps; const GColorSet * ps;
#if GWIN_NEED_LIST_IMAGES #if GWIN_NEED_LIST_IMAGES
gCoord sy; gCoord sy;

View File

@ -264,7 +264,7 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) {
fixed alpha; fixed alpha;
fixed dalpha; fixed dalpha;
gCoord i; gCoord i;
color_t tcol, bcol; gColor tcol, bcol;
(void) param; (void) param;
if (gw->g.vmt != (gwinVMT *)&radioVMT) return; if (gw->g.vmt != (gwinVMT *)&radioVMT) return;
@ -289,7 +289,7 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) {
fixed alpha; fixed alpha;
fixed dalpha; fixed dalpha;
gCoord i; gCoord i;
color_t tcol, bcol; gColor tcol, bcol;
(void) param; (void) param;
if (gw->g.vmt != (gwinVMT *)&radioVMT) return; if (gw->g.vmt != (gwinVMT *)&radioVMT) return;

View File

@ -423,7 +423,7 @@ void gwinTabsetSetTab(GHandle gh) {
#else #else
static void fgarea(GWidgetObject *gw, const char *text, gCoord y, gCoord x, gCoord w) { static void fgarea(GWidgetObject *gw, const char *text, gCoord y, gCoord x, gCoord w) {
const GColorSet * pcol; const GColorSet * pcol;
color_t tcol; gColor tcol;
pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->pressed : &gw->pstyle->disabled; pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->pressed : &gw->pstyle->disabled;
@ -439,7 +439,7 @@ void gwinTabsetSetTab(GHandle gh) {
const GColorSet * pcol; const GColorSet * pcol;
fixed alpha; fixed alpha;
gCoord i; gCoord i;
color_t tcol, bcol; gColor tcol, bcol;
pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->enabled : &gw->pstyle->disabled; pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->enabled : &gw->pstyle->disabled;

View File

@ -35,10 +35,10 @@ struct GWidgetObject;
* @{ * @{
*/ */
typedef struct GColorSet { typedef struct GColorSet {
color_t text; /**< The text color */ gColor text; /**< The text color */
color_t edge; /**< The edge color */ gColor edge; /**< The edge color */
color_t fill; /**< The fill color */ gColor fill; /**< The fill color */
color_t progress; /**< The color of progress bars */ gColor progress; /**< The color of progress bars */
} GColorSet; } GColorSet;
/** @} */ /** @} */
@ -50,8 +50,8 @@ typedef struct GColorSet {
* @{ * @{
*/ */
typedef struct GWidgetStyle { typedef struct GWidgetStyle {
color_t background; /**< The window background color */ gColor background; /**< The window background color */
color_t focus; /**< The color when a widget is focused */ gColor focus; /**< The color when a widget is focused */
GColorSet enabled; /**< The colors when enabled */ GColorSet enabled; /**< The colors when enabled */
GColorSet disabled; /**< The colors when disabled */ GColorSet disabled; /**< The colors when disabled */
GColorSet pressed; /**< The colors when pressed */ GColorSet pressed; /**< The colors when pressed */