CFrameBuffer: Add functions to draw color gradients

This commit is contained in:
M. Liebmann
2014-09-20 21:33:48 +02:00
committed by [CST] Focus
parent 98511b686d
commit a428a1f583
2 changed files with 158 additions and 1 deletions

View File

@@ -40,6 +40,14 @@
typedef struct fb_var_screeninfo t_fb_var_screeninfo;
typedef struct gradientData_t
{
fb_pixel_t* gradientBuf;
fb_pixel_t* boxBuf;
bool direction;
int mode;
} gradientData_struct_t;
#define CORNER_TOP_LEFT 0x1
#define CORNER_TOP_RIGHT 0x2
#define CORNER_TOP 0x3
@@ -131,6 +139,7 @@ class CFrameBuffer
void paintHLineRelInternal(int x, int dx, int y, const fb_pixel_t col);
void paintVLineRelInternal(int x, int y, int dy, const fb_pixel_t col);
inline void paintHLineRelInternal2Buf(const int& x, const int& dx, const int& y, const int& box_dx, const fb_pixel_t& col, fb_pixel_t* buf);
void paintShortHLineRelInternal(const int& x, const int& dx, const int& y, const fb_pixel_t& col);
int limitRadius(const int& dx, const int& dy, int& radius);
void setCornerFlags(const int& type);
@@ -139,6 +148,18 @@ class CFrameBuffer
bool calcCorners(int *ofs, int *ofl, int *ofr, const int& dy, const int& line, const int& radius, const int& type);
public:
enum {
gradientHorizontal,
gradientVertical
};
enum {
pbrg_noOption = 0x00,
pbrg_noPaint = 0x01,
pbrg_noFree = 0x02
};
fb_pixel_t realcolor[256];
~CFrameBuffer();
@@ -184,6 +205,9 @@ class CFrameBuffer
};
void paintPixel(int x, int y, const fb_pixel_t col);
fb_pixel_t* paintBoxRel2Buf(const int dx, const int dy, const fb_pixel_t col, fb_pixel_t* buf = NULL, int radius = 0, int type = CORNER_ALL);
fb_pixel_t* paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, gradientData_t *gradientData, int radius = 0, int type = CORNER_ALL);
void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL);
inline void paintBox(int xa, int ya, int xb, int yb, const fb_pixel_t col) { paintBoxRel(xa, ya, xb - xa, yb - ya, col); }
inline void paintBox(int xa, int ya, int xb, int yb, const fb_pixel_t col, int radius, int type) { paintBoxRel(xa, ya, xb - xa, yb - ya, col, radius, type); }
@@ -245,7 +269,7 @@ class CFrameBuffer
void* convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y);
void displayRGB(unsigned char *rgbbuff, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs, bool clearfb = true, int transp = 0xFF);
void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false);
bool blitToPrimary(unsigned int * data, int dx, int dy, int sw, int sh);
void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff);
enum
{