6 #include <lib/base/object.h>
7 #include <lib/base/smartptr.h>
8 #include <lib/base/elock.h>
9 #include <lib/gdi/erect.h>
10 #include <lib/gdi/fb.h>
14 unsigned char b, g, r, a;
15 gRGB(int r, int g, int b, int a=0): b(b), g(g), r(r), a(a)
18 gRGB(unsigned long val): b(val&0xFF), g((val>>8)&0xFF), r((val>>16)&0xFF), a((val>>24)&0xFF) // ARGB
21 gRGB(const char *colorstring)
23 unsigned long val = 0;
26 for (int i = 0; i < 8; i++)
29 if (!colorstring[i]) break;
30 val |= (colorstring[i]) & 0x0f;
38 gRGB(): b(0), g(0), r(0), a(0)
42 unsigned long argb() const
44 return (a<<24)|(r<<16)|(g<<8)|b;
47 void operator=(unsigned long val)
54 bool operator < (const gRGB &c) const
72 bool operator==(const gRGB &c) const
74 return (b == c.b) && (g == c.g) && (r == c.r) && (a == c.a);
76 bool operator != (const gRGB &c) const
78 return (b != c.b) || (g != c.g) || (r != c.r) || (a != c.a);
80 operator const std::string () const
82 unsigned long val = (a<<24)|(r<<16)|(g<<8)|b;
83 std::string escapecolor = "\\c";
84 escapecolor.resize(10);
85 for (int i = 9; i >= 2; i--)
87 escapecolor[i] = 0x40 | (val & 0xf);
98 gColor(int color): color(color)
104 operator int() const { return color; }
105 bool operator==(const gColor &o) const { return o.color==color; }
112 gColor findColor(const gRGB &rgb) const;
119 gLookup(int size, const gPalette &pal, const gRGB &start, const gRGB &end);
121 ~gLookup() { delete [] lookup; }
122 void build(int size, const gPalette &pal, const gRGB &start, const gRGB &end);
128 int x, y, bpp, bypp, stride;
133 int offset; // only for backbuffers
136 gSurface(eSize size, int bpp, int accel);
143 SWIG_IGNORE(gPixmap);
144 class gPixmap: public iObject
146 DECLARE_REF(gPixmap);
156 gPixmap(gSurface *surface);
157 gPixmap(eSize, int bpp, int accel = 0);
166 inline bool needClut() const { return surface && surface->bpp <= 8; }
169 eSize size() const { return eSize(surface->x, surface->y); }
171 bool must_delete_surface;
173 void fill(const gRegion &clip, const gColor &color);
174 void fill(const gRegion &clip, const gRGB &color);
176 void blit(const gPixmap &src, const eRect &pos, const gRegion &clip, int flags=0);
178 void mergePalette(const gPixmap &target);
179 void line(const gRegion &clip, ePoint start, ePoint end, gColor color);
184 SWIG_TEMPLATE_TYPEDEF(ePtr<gPixmap>, gPixmapPtr);