X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/d63d2c3c6cbbd574dda4f8b00ebe6c661735edd5..1aeefd997cc362c3b37c1587c5f08891b35c3a75:/lib/gdi/gpixmap.h diff --git a/lib/gdi/gpixmap.h b/lib/gdi/gpixmap.h index f68a5748..f0912334 100644 --- a/lib/gdi/gpixmap.h +++ b/lib/gdi/gpixmap.h @@ -3,11 +3,10 @@ #include #include +#include +#include #include #include -#include - -#include struct gColor { @@ -24,16 +23,23 @@ struct gColor struct gRGB { - int b, g, r, a; + unsigned char b, g, r, a; gRGB(int r, int g, int b, int a=0): b(b), g(g), r(r), a(a) { } gRGB(unsigned long val): b(val&0xFF), g((val>>8)&0xFF), r((val>>16)&0xFF), a((val>>24)&0xFF) // ARGB { } - gRGB() + gRGB(): b(0), g(0), r(0), a(0) { } + void operator=(unsigned long val) + { + b = val&0xFF; + g = (val>>8)&0xFF; + r = (val>>16)&0xFF; + a = (val>>24)&0xFF; + } bool operator < (const gRGB &c) const { if (b < c.b) @@ -71,6 +77,7 @@ struct gLookup gColor *lookup; gLookup(int size, const gPalette &pal, const gRGB &start, const gRGB &end); gLookup(); + ~gLookup() { delete [] lookup; } void build(int size, const gPalette &pal, const gRGB &start, const gRGB &end); }; @@ -80,8 +87,11 @@ struct gLookup * The font is specified by a name and a size. * \c gFont is part of the \ref gdi. */ -struct gFont +class gFont: public iObject { +DECLARE_REF; +public: + eString family; int pointSize; @@ -95,12 +105,9 @@ struct gFont { } - enum + virtual ~gFont() { - tRegular, tFixed - }; - - gFont(int type, int pointSize); + } gFont() :pointSize(0) @@ -108,35 +115,51 @@ struct gFont } }; -struct gPixmap: public iObject +struct gSurface { -DECLARE_REF; -public: + int type; int x, y, bpp, bypp, stride; - void *data; - gPalette clut; - eSize getSize() const { return eSize(x, y); } - - void fill(const eRect &area, const gColor &color); + void *data; + virtual ~gSurface(); +}; + +struct gSurfaceSystem: gSurface +{ + gSurfaceSystem(eSize size, int bpp); + ~gSurfaceSystem(); +}; + +struct gPixmap: public iObject +{ +DECLARE_REF; +private: + friend class gDC; + void fill(const gRegion &clip, const gColor &color); enum { blitAlphaTest=1 }; - void blit(const gPixmap &src, ePoint pos, const eRect &clip=eRect(), int flags=0); + void blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flags=0); void mergePalette(const gPixmap &target); - void line(ePoint start, ePoint end, gColor color); - gPixmap(); + void line(const gRegion &clip, ePoint start, ePoint end, gColor color); +public: + gSurface *surface; + + eLock contentlock; + int final; + + gPixmap *lock(); + void unlock(); + + eSize getSize() const { return eSize(surface->x, surface->y); } + + gPixmap(gSurface *surface); + gPixmap(eSize, int bpp); virtual ~gPixmap(); }; -struct gImage: gPixmap -{ - gImage(eSize size, int bpp); - ~gImage(); -}; - #endif