- disabled gui for a moment
[enigma2.git] / lib / gdi / gpixmap.h
index f68a57480f896efedcdc1ef8a51733c0b98b40df..0d123b3fe526823753ef13e8bf0210e00409046c 100644 (file)
@@ -3,11 +3,10 @@
 
 #include <pthread.h>
 #include <lib/base/estring.h>
+#include <lib/base/object.h>
+#include <lib/base/elock.h>
 #include <lib/gdi/erect.h>
 #include <lib/gdi/fb.h>
-#include <lib/base/elock.h>
-
-#include <lib/base/object.h>
 
 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 virtual 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