Subversion Repositories Code-Repo

Rev

Blame | Last modification | View Log | RSS feed

#ifndef ADAFRUIT_GFX_H
#define ADAFRUIT_GFX_H

#define GFX_STRING_BUFFER_SIZE  150

typedef struct __GFX_DATA {
    unsigned char buffer[GFX_STRING_BUFFER_SIZE];
    int WIDTH, HEIGHT; // raw display size
    int _width, _height; // size depending on rotation
    int cursor_x, cursor_y;
    unsigned int textcolor, textbgcolor;
    unsigned char textsize;
    unsigned char rotation;
    unsigned char wrap; // If set, wrap text at right side
} GFX_DATA;

int GFX_Abs(int i);
void GFX_Swap(int *a, int *b);

void GFX_Init(int w, int h);
void GFX_drawLine(int x0, int y0, int x1, int y1, unsigned int color);
void GFX_drawFastVLine(int x, int y, int h, unsigned int color);
void GFX_drawFastHLine(int x, int y, int w, unsigned int color);
void GFX_drawRect(int x, int y, int w, int h, unsigned int color);
void GFX_fillRect(int x, int y, int w, int h, unsigned int color);
void GFX_fillScreen(unsigned int color);
void GFX_clearScreen(void);

void GFX_drawCircle(int x0, int y0, int r, unsigned int color);
void GFX_drawCircleHelper(int x0, int y0, int r, unsigned char cornername, unsigned int color);
void GFX_fillCircle(int x0, int y0, int r, unsigned int color);
void GFX_fillCircleHelper(int x0, int y0, int r, unsigned char cornername, int delta, unsigned int color);

void GFX_drawTriangle(int x0, int y0, int x1, int y1, int x2, int y2, unsigned int color);
void GFX_fillTriangle(int x0, int y0, int x1, int y1, int x2, int y2, unsigned int color);
void GFX_drawRoundRect(int x0, int y0, int w, int h, int radius, unsigned int color);
void GFX_fillRoundRect(int x0, int y0, int w, int h, int radius, unsigned int color);

void GFX_drawBitmap(int x, int y, const unsigned char *bitmap, int w, int h, unsigned int color);
void GFX_drawChar(int x, int y, unsigned char c, unsigned int color, unsigned int bg, unsigned char size);

void GFX_write(unsigned char c);
void GFX_writeString(const rom char *fmt, ...);

void GFX_setCursor(int x, int y);
void GFX_setTextColor(unsigned int c);
void GFX_setTextColorBG(unsigned int c, unsigned int bg);
void GFX_setTextSize(unsigned char s);
void GFX_setTextWrap(unsigned char w);

void GFX_setRotation(unsigned char r);
unsigned char GFX_getRotation(void);

int GFX_height(void);
int GFX_width(void);

#endif  /* ADAFRUIT_GFX_H */