X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fgdi%2Fgpixmap.h;h=202cd01d7c0e2971c1d076c58c36fe94d52f1022;hp=e3798bf72fd27ef9d1b940eea88aa422b6067105;hb=059fdda03072b1be0d67a525f20284df68a84a3c;hpb=ed40f6f85c9c07c3c1224ae20601082c0309a631 diff --git a/lib/gdi/gpixmap.h b/lib/gdi/gpixmap.h index e3798bf..202cd01 100644 --- a/lib/gdi/gpixmap.h +++ b/lib/gdi/gpixmap.h @@ -18,6 +18,23 @@ struct gRGB gRGB(unsigned long val): b(val&0xFF), g((val>>8)&0xFF), r((val>>16)&0xFF), a((val>>24)&0xFF) // ARGB { } + gRGB(const char *colorstring) + { + unsigned long val = 0; + if (colorstring) + { + for (int i = 0; i < 8; i++) + { + if (i) val <<= 4; + if (!colorstring[i]) break; + val |= (colorstring[i]) & 0x0f; + } + } + b = val&0xFF; + g = (val>>8)&0xFF; + r = (val>>16)&0xFF; + a = (val>>24)&0xFF; + } gRGB(): b(0), g(0), r(0), a(0) { } @@ -56,6 +73,22 @@ struct gRGB { return (b == c.b) && (g == c.g) && (r == c.r) && (a == c.a); } + bool operator != (const gRGB &c) const + { + return (b != c.b) || (g != c.g) || (r != c.r) || (a != c.a); + } + operator const std::string () const + { + unsigned long val = (a<<24)|(r<<16)|(g<<8)|b; + std::string escapecolor = "\\c"; + escapecolor.resize(10); + for (int i = 9; i >= 2; i--) + { + escapecolor[i] = 0x40 | (val & 0xf); + val >>= 4; + } + return escapecolor; + } }; #ifndef SWIG @@ -116,7 +149,8 @@ public: enum { blitAlphaTest=1, - blitAlphaBlend=2 + blitAlphaBlend=2, + blitScale=4 }; gPixmap(gSurface *surface); @@ -139,7 +173,7 @@ private: void fill(const gRegion &clip, const gColor &color); void fill(const gRegion &clip, const gRGB &color); - void blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flags=0); + void blit(const gPixmap &src, const eRect &pos, const gRegion &clip, int flags=0); void mergePalette(const gPixmap &target); void line(const gRegion &clip, ePoint start, ePoint end, gColor color);