]> git.vomp.tv Git - vompclient.git/commitdiff
Add support for gradients, slightly facelift of menues
authorMarten Richter <marten.richter@freenet.de>
Sat, 29 Jun 2013 15:32:46 +0000 (17:32 +0200)
committerMarten Richter <marten.richter@freenet.de>
Sat, 29 Jun 2013 15:32:46 +0000 (17:32 +0200)
19 files changed:
boxx.cc
boxx.h
colour.cc
colour.h
command.cc
defines.h
osdopenvg.cc
surface.cc
surface.h
surfacevector.cc
surfacevector.h
vchannellist.cc
vchannellist.h
vepg.cc
vrecordinglist.cc
vrecordinglist.h
vtimerlist.cc
vtimerlist.h
wsymbol.h

diff --git a/boxx.cc b/boxx.cc
index a1b31b1741eab8370892e52f79117ec6f622772e..08683a5cc7ff73240073aefe2f207511681bd84c 100644 (file)
--- a/boxx.cc
+++ b/boxx.cc
@@ -403,7 +403,7 @@ void Boxx::drawJpeg(const char *fileName,int x, int y,int *width, int *height)
        else if (surface) surface->drawJpeg(fileName,x,y,width,height);
 }
 
-void Boxx::drawMonoBitmap(UCHAR*base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour)
+void Boxx::drawMonoBitmap(UCHAR*base, int dx, int dy, unsigned int height,unsigned int width, DrawStyle& nextColour)
 {
        if (parent) parent->drawMonoBitmap(base, area.x +dx,area.y +dy, height,width, nextColour);
        else if (surface) surface->drawMonoBitmap(base, dx,dy, height,width, nextColour);
diff --git a/boxx.h b/boxx.h
index 06b3c9289814f35d9b85a8902ffcb66e4c031285..a90a070e321c3b2500e805f762bd3b8ee22e87f4 100644 (file)
--- a/boxx.h
+++ b/boxx.h
@@ -111,7 +111,7 @@ class Boxx
     void drawJpeg(const char *fileName,int x, int y,int *width, int *height);
 
     void drawTTChar(int ox, int oy,int x, int y, cTeletextChar c);
-    void drawMonoBitmap(UCHAR*base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour);
+    void drawMonoBitmap(UCHAR*base, int dx, int dy, unsigned int height,unsigned int width, DrawStyle& nextColour);
 
     /* This is for system which need a locking of the drawing surface to speed up drawing */
     void startFastDraw();
index 82bfa8390a706fb3588298e5211f10b9864d407f..b4083e6b0b35f9900d4e9803026571ba1d4679fa 100644 (file)
--- a/colour.cc
+++ b/colour.cc
 
 #include "colour.h"
 
-/*
-Real colours
-*/
+
 DrawStyle DrawStyle::BLACK(0, 0, 0);
 DrawStyle DrawStyle::RED(255, 0, 0);
 DrawStyle DrawStyle::GREEN(0, 255, 0);
+DrawStyle DrawStyle::GREY(180, 180, 180);
+DrawStyle DrawStyle::DARKGREY(100, 100, 100);
 DrawStyle DrawStyle::BLUE(0, 0, 255);
 DrawStyle DrawStyle::YELLOW(255, 255, 0);
 DrawStyle DrawStyle::VIDEOBLUE(0, 0, 150);
@@ -43,7 +43,34 @@ DrawStyle DrawStyle::PROGRAMMEA(40, 40, 120); // TODO fit epg style (colours) in
 DrawStyle DrawStyle::NOPROGRAMME(180, 180, 180); // no programme details colour
 
 
-/*
+void SkinFactory::InitDefaultSkin()
+{
+       /*
+Real colours
+        */
+       DrawStyle::BLACK=DrawStyle(0, 0, 0);
+       DrawStyle::RED=DrawStyle(255, 0, 0);
+       DrawStyle::GREY=DrawStyle(180, 180, 180);
+       DrawStyle::DARKGREY=DrawStyle(100, 100, 100);
+       DrawStyle::GREEN=DrawStyle(0, 255, 0);
+       DrawStyle::BLUE=DrawStyle(0, 0, 255);
+       DrawStyle::YELLOW=DrawStyle(255, 255, 0);
+       DrawStyle::VIDEOBLUE=DrawStyle(0, 0, 150);
+       DrawStyle::VIEWBACKGROUND=DrawStyle(0, 0, 100);
+       DrawStyle::TABVIEWBACKGROUND=DrawStyle(0, 0, 120);
+       DrawStyle::TITLEBARBACKGROUND=DrawStyle(0, 0, 200);
+       DrawStyle::SELECTHIGHLIGHT=DrawStyle(240, 250, 80);
+       DrawStyle::SELECTDARKHIGHLIGHT=DrawStyle(120, 125, 40);
+       DrawStyle::LIGHTTEXT=DrawStyle(255, 255, 255);
+       DrawStyle::DARKTEXT=DrawStyle(0, 0, 100);
+       DrawStyle::DANGER=DrawStyle(200, 0, 0);
+       DrawStyle::BUTTONBACKGROUND=DrawStyle(0, 0, 200);
+       DrawStyle::PROGRAMMEB=DrawStyle(80, 80, 240); // two colours used as alterating backgrounds for individual programmes in EPG
+       DrawStyle::PROGRAMMEA=DrawStyle(40, 40, 120); // TODO fit epg style (colours) in with rest of application
+       DrawStyle::NOPROGRAMME=DrawStyle(180, 180, 180); // no programme details colour
+
+
+       /*
 Silly colours
 
 Colour Colour::VIDEOBLUE(250, 0, 0);
@@ -54,4 +81,172 @@ Colour Colour::LIGHTTEXT(255, 0, 255);
 Colour Colour::DARKTEXT(0, 0, 255);
 Colour Colour::DANGER(200, 200, 0);
 Colour Colour::BUTTONBACKGROUND(255, 255, 255);
-*/
+        */
+}
+
+void SkinFactory::InitEnhancedSkin()
+{
+       /*
+Real colours
+        */
+       DrawStyle::BLACK=DrawStyle(0, 0, 0);
+
+       DrawStyle::RED=DrawStyle(100, 0, 0);
+       DrawStyle::RED.grad_col[0]=Colour(255, 0, 0);
+       DrawStyle::RED.grad_col[1]=Colour(100, 0, 0);
+       DrawStyle::RED.grad_pos[0]=0.5;
+       DrawStyle::RED.num_colors=2;
+       DrawStyle::RED.ft=DrawStyle::GradientLinear;
+       DrawStyle::RED.x1=0.0;
+       DrawStyle::RED.y1=0.0;
+       DrawStyle::RED.x2=0.0;
+       DrawStyle::RED.y2=1.0;
+
+       DrawStyle::GREEN=DrawStyle(0, 100, 0);
+       DrawStyle::GREEN.grad_col[0]=Colour(0, 255, 0);
+       DrawStyle::GREEN.grad_col[1]=Colour(0, 100, 0);
+       DrawStyle::GREEN.grad_pos[0]=0.5;
+       DrawStyle::GREEN.num_colors=2;
+       DrawStyle::GREEN.ft=DrawStyle::GradientLinear;
+       DrawStyle::GREEN.x1=0.0;
+       DrawStyle::GREEN.y1=0.0;
+       DrawStyle::GREEN.x2=0.0;
+       DrawStyle::GREEN.y2=1.0;
+
+       DrawStyle::BLUE=DrawStyle(0, 0, 100);
+       DrawStyle::BLUE.grad_col[0]=Colour(0, 0, 255);
+       DrawStyle::BLUE.grad_col[1]=Colour(0, 0, 100);
+       DrawStyle::BLUE.grad_pos[0]=0.5;
+       DrawStyle::BLUE.num_colors=2;
+       DrawStyle::BLUE.ft=DrawStyle::GradientLinear;
+       DrawStyle::BLUE.x1=0.0;
+       DrawStyle::BLUE.y1=0.0;
+       DrawStyle::BLUE.x2=0.0;
+       DrawStyle::BLUE.y2=1.0;
+
+       DrawStyle::YELLOW=DrawStyle(100, 100, 0);
+       DrawStyle::YELLOW.grad_col[0]=Colour(255, 255, 0);
+       DrawStyle::YELLOW.grad_col[1]=Colour(100, 100, 0);
+       DrawStyle::YELLOW.grad_pos[0]=0.5;
+       DrawStyle::YELLOW.num_colors=2;
+       DrawStyle::YELLOW.ft=DrawStyle::GradientLinear;
+       DrawStyle::YELLOW.x1=0.0;
+       DrawStyle::YELLOW.y1=0.0;
+       DrawStyle::YELLOW.x2=0.0;
+       DrawStyle::YELLOW.y2=1.0;
+
+       DrawStyle::GREY=DrawStyle(100, 100, 100);
+       DrawStyle::GREY.grad_col[0]=Colour(180, 180, 180);
+       DrawStyle::GREY.grad_col[1]=Colour(100, 100, 100);
+       DrawStyle::GREY.grad_pos[0]=0.5;
+       DrawStyle::GREY.num_colors=2;
+       DrawStyle::GREY.ft=DrawStyle::GradientLinear;
+       DrawStyle::GREY.x1=0.0;
+       DrawStyle::GREY.y1=0.0;
+       DrawStyle::GREY.x2=0.0;
+       DrawStyle::GREY.y2=1.0;
+
+       DrawStyle::DARKGREY=DrawStyle(50, 50, 50);
+       DrawStyle::DARKGREY.grad_col[0]=Colour(100, 100, 100);
+       DrawStyle::DARKGREY.grad_col[1]=Colour(50, 50, 50);
+       DrawStyle::DARKGREY.grad_pos[0]=0.5;
+       DrawStyle::DARKGREY.num_colors=2;
+       DrawStyle::DARKGREY.ft=DrawStyle::GradientLinear;
+       DrawStyle::DARKGREY.x1=0.0;
+       DrawStyle::DARKGREY.y1=0.0;
+       DrawStyle::DARKGREY.x2=0.0;
+       DrawStyle::DARKGREY.y2=1.0;
+
+
+       DrawStyle::VIDEOBLUE=DrawStyle(0, 0, 150);
+
+       DrawStyle::VIEWBACKGROUND=DrawStyle(0, 0, 100);
+       DrawStyle::VIEWBACKGROUND.grad_col[0]=Colour(0,0,160);
+       DrawStyle::VIEWBACKGROUND.num_colors=1;
+       DrawStyle::VIEWBACKGROUND.ft=DrawStyle::GradientLinear;
+       DrawStyle::VIEWBACKGROUND.x1=0.0;
+       DrawStyle::VIEWBACKGROUND.y1=0.0;
+       DrawStyle::VIEWBACKGROUND.x2=0.0;
+       DrawStyle::VIEWBACKGROUND.y2=1.0;
+
+       DrawStyle::TABVIEWBACKGROUND=DrawStyle(0, 0, 120);
+
+
+       DrawStyle::TITLEBARBACKGROUND=DrawStyle(0, 0, 160);
+       DrawStyle::TITLEBARBACKGROUND.grad_col[0]=Colour(0,0,250);
+       DrawStyle::TITLEBARBACKGROUND.num_colors=1;
+       DrawStyle::TITLEBARBACKGROUND.ft=DrawStyle::GradientLinear;
+       DrawStyle::TITLEBARBACKGROUND.x1=0.0;
+       DrawStyle::TITLEBARBACKGROUND.y1=0.0;
+       DrawStyle::TITLEBARBACKGROUND.x2=0.0;
+       DrawStyle::TITLEBARBACKGROUND.y2=1.0;
+
+
+       DrawStyle::SELECTHIGHLIGHT=DrawStyle(120, 125, 40);
+       DrawStyle::SELECTHIGHLIGHT.grad_col[0]=DrawStyle(240, 250, 80);
+       DrawStyle::SELECTHIGHLIGHT.num_colors=1;
+       DrawStyle::SELECTHIGHLIGHT.ft=DrawStyle::GradientLinear;
+       DrawStyle::SELECTHIGHLIGHT.x1=0.0;
+       DrawStyle::SELECTHIGHLIGHT.y1=0.0;
+       DrawStyle::SELECTHIGHLIGHT.x2=0.0;
+       DrawStyle::SELECTHIGHLIGHT.y2=1.0;
+
+
+       DrawStyle::SELECTDARKHIGHLIGHT=DrawStyle(120, 125, 40);
+       DrawStyle::LIGHTTEXT=DrawStyle(255, 255, 255);
+       DrawStyle::DARKTEXT=DrawStyle(0, 0, 100);
+       DrawStyle::DANGER=DrawStyle(200, 0, 0);
+
+       DrawStyle::BUTTONBACKGROUND=DrawStyle(0, 0, 100);
+       DrawStyle::BUTTONBACKGROUND.grad_col[0]=DrawStyle(0, 0, 200);
+       DrawStyle::BUTTONBACKGROUND.num_colors=1;
+       DrawStyle::BUTTONBACKGROUND.ft=DrawStyle::GradientLinear;
+       DrawStyle::BUTTONBACKGROUND.x1=0.0;
+       DrawStyle::BUTTONBACKGROUND.y1=0.0;
+       DrawStyle::BUTTONBACKGROUND.x2=0.0;
+       DrawStyle::BUTTONBACKGROUND.y2=1.0;
+
+
+       DrawStyle::PROGRAMMEB=DrawStyle(40, 40, 120); // two colours used as alterating backgrounds for individual programmes in EPG
+       DrawStyle::PROGRAMMEB.grad_col[0]=DrawStyle(80, 80, 240);
+       DrawStyle::PROGRAMMEB.num_colors=1;
+       DrawStyle::PROGRAMMEB.ft=DrawStyle::GradientLinear;
+       DrawStyle::PROGRAMMEB.x1=0.0;
+       DrawStyle::PROGRAMMEB.y1=0.0;
+       DrawStyle::PROGRAMMEB.x2=0.0;
+       DrawStyle::PROGRAMMEB.y2=1.0;
+
+
+       DrawStyle::PROGRAMMEA=DrawStyle(80, 80, 240); // TODO fit epg style (colours) in with rest of application
+       DrawStyle::PROGRAMMEA.grad_col[0]=DrawStyle(40, 40, 120);
+       DrawStyle::PROGRAMMEA.num_colors=1;
+       DrawStyle::PROGRAMMEA.ft=DrawStyle::GradientLinear;
+       DrawStyle::PROGRAMMEA.x1=0.0;
+       DrawStyle::PROGRAMMEA.y1=0.0;
+       DrawStyle::PROGRAMMEA.x2=0.0;
+       DrawStyle::PROGRAMMEA.y2=1.0;
+
+
+       DrawStyle::NOPROGRAMME=DrawStyle(180, 180, 180); // no programme details colour
+       DrawStyle::NOPROGRAMME.grad_col[0]=DrawStyle(90, 90, 90);
+       DrawStyle::NOPROGRAMME.num_colors=1;
+       DrawStyle::NOPROGRAMME.ft=DrawStyle::GradientLinear;
+       DrawStyle::NOPROGRAMME.x1=0.0;
+       DrawStyle::NOPROGRAMME.y1=0.0;
+       DrawStyle::NOPROGRAMME.x2=0.0;
+       DrawStyle::NOPROGRAMME.y2=1.0;
+
+
+       /*
+Silly colours
+
+Colour Colour::VIDEOBLUE(250, 0, 0);
+Colour Colour::VIEWBACKGROUND(100, 0, 100);
+Colour Colour::TITLEBARBACKGROUND(100, 0, 200);
+Colour Colour::SELECTHIGHLIGHT(240, 250, 180);
+Colour Colour::LIGHTTEXT(255, 0, 255);
+Colour Colour::DARKTEXT(0, 0, 255);
+Colour Colour::DANGER(200, 200, 0);
+Colour Colour::BUTTONBACKGROUND(255, 255, 255);
+        */
+}
index 9f358c37877b45575c900ceb2c83b3d45dd45514..9b620f804cbb7d1ca6d5a0f074a2a0aa21806be8 100644 (file)
--- a/colour.h
+++ b/colour.h
@@ -59,19 +59,38 @@ class DrawStyle: public Colour
 {
 public:
        DrawStyle()
-    { red = 0; green = 0; blue = 0; alpha = 255; }
+    { red = 0; green = 0; blue = 0; alpha = 255; ft=Color;ct=Global; }
 
        DrawStyle(int Tred, int Tgreen, int Tblue)
-    { red = Tred; green = Tgreen; blue = Tblue; alpha = 255; }
+    { red = Tred; green = Tgreen; blue = Tblue; alpha = 255 ;ft=Color;ct=Global;  }
 
        DrawStyle(int Tred, int Tgreen, int Tblue, int Talpha)
-     { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; }
+     { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; ft=Color;ct=Global;}
+
+       enum FillType {
+                       Color,
+                       GradientLinear,
+                       GradientRadial,
+       };
+       enum CoordType {
+               Global,
+               Local
+       };
+
+       enum FillType ft;
+       enum CoordType ct; //not implemented yet
+       float x1,y1,x2,y2,r; // Parameter for gradient either relative to object or to global coordinate system
+       int num_colors; //max is 4, min is 0
+       Colour grad_col[4];
+       float grad_pos[3]; //Last position is alway 1.0 and first 0.0
 
     static DrawStyle BLACK;
     static DrawStyle RED;
     static DrawStyle GREEN;
     static DrawStyle YELLOW;
     static DrawStyle BLUE;
+    static DrawStyle GREY;
+    static DrawStyle DARKGREY;
     static DrawStyle VIDEOBLUE;
     static DrawStyle VIEWBACKGROUND;
     static DrawStyle TABVIEWBACKGROUND;
@@ -88,4 +107,10 @@ public:
 
 };
 
+class SkinFactory {
+public:
+       static void InitDefaultSkin();
+       static void InitEnhancedSkin();
+};
+
 #endif
index 789fb7e04d796607c59ca5e326e031a9d0e9414e..6fb521e63910e27e78998861fb837f03acdd6f7c 100644 (file)
@@ -99,6 +99,12 @@ int Command::init(bool tcrashed, char* tServer)
     initted = 0;
     return 0;
   }
+#ifdef GRADIENT_DRAWING
+  SkinFactory::InitEnhancedSkin();
+#else
+  SkinFactory::InitDefaultSkin();
+#endif
+
 #ifndef WIN32
   pthread_mutex_init(&masterLock, NULL);
 #else
index 757855368ec2d199aa9cfe4a9d66ff9520d64d1e..c5d6f79a1184ba8931a3d73de3f6003c691df4cb 100644 (file)
--- a/defines.h
+++ b/defines.h
@@ -120,6 +120,7 @@ long long getTimeMS();
   #define PLAYER_MAX_STREAMING_BUFFERS 120 // for video in uints of 50000 KB
   #define TV_NORM_SWITCHABLE
   #define HANDLE_VT_SWITCHING
+  #define GRADIENT_DRAWING
 
   #define VOMP_LINUX_CLOCK  CLOCK_MONOTONIC
 
index 388d47e4c83a977dbd34f8dc73260ea485ec3e00..740272be7de23deb62b99f7684e4a28500449657 100644 (file)
@@ -809,6 +809,7 @@ void OsdOpenVG::executeDrawCommand(SVGCommand & command)
 {
 
        VGfloat  save_matrix[9];
+       VGfloat  save_matrix2[9];
        switch (command.instr) {
        case DrawPath: {
         vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
@@ -829,16 +830,24 @@ void OsdOpenVG::executeDrawCommand(SVGCommand & command)
            vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
                vgGetMatrix(save_matrix);
                vgTranslate(command.x,command.y);
+
+
+
+
                //vgScale(command.w,command.h);
+               VGfloat imagewidth=vgGetParameteri((VGImage) command.target.image, VG_IMAGE_WIDTH);
+               VGfloat imageheight=vgGetParameteri((VGImage) command.target.image, VG_IMAGE_HEIGHT);
                if (command.reference) { //special behaviout for bw images they act as a mask on the current paint
                        vgSetPaint((VGPaint) command.reference,VG_FILL_PATH);
                        vgSetPaint((VGPaint) command.reference,VG_STROKE_PATH);
                        vgSeti(VG_IMAGE_MODE,VG_DRAW_IMAGE_STENCIL);
                        vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER);
                        vgScale(aspect_correction,1.f);
+                       vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);
+                   vgGetMatrix(save_matrix2);
+                   vgScale(0.2f,0.2f);
                } else {
-                       VGfloat imagewidth=vgGetParameteri((VGImage) command.target.image, VG_IMAGE_WIDTH);
-                       VGfloat imageheight=vgGetParameteri((VGImage) command.target.image, VG_IMAGE_HEIGHT);
+
                        //vgScale(720.f/((float)BACKBUFFER_WIDTH), 576.f/((float)BACKBUFFER_HEIGHT));
                        float scalex=command.w/imagewidth;
                        float scaley=command.h/imageheight;
@@ -859,7 +868,11 @@ void OsdOpenVG::executeDrawCommand(SVGCommand & command)
                if (command.reference) {
                        vgSeti(VG_IMAGE_MODE,VG_DRAW_IMAGE_NORMAL);
                        vgSeti(VG_BLEND_MODE, VG_BLEND_SRC);
+                       vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);
+                       vgLoadMatrix(save_matrix2);
                }
+
+               vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
                vgLoadMatrix(save_matrix);
        } break;
        case DrawGlyph: {
@@ -1022,11 +1035,57 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command)
        case OVGcreateColorRef :{
                VGPaint handle;
                handle=vgCreatePaint();
-               vgSetParameteri(handle, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
-               vgSetColor(handle,command.param1);
-               VGuint rgba;
-               rgba = vgGetColor((VGPaint)handle);
-               Log::getInstance()->log("OSD", Log::DEBUG, "Draw Paint %d %x %x",handle,command.param1,rgba);
+               DrawStyle *style=(DrawStyle*)command.data;
+               switch (style->ft) {
+               case DrawStyle::Color: {
+                       vgSetParameteri(handle, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
+                       vgSetColor(handle,command.param1);
+                       VGuint rgba;
+                       rgba = vgGetColor((VGPaint)handle);
+                       Log::getInstance()->log("OSD", Log::DEBUG, "Draw Paint %d %x %x",handle,command.param1,rgba);
+               } break;
+               case DrawStyle::GradientLinear: {
+                       vgSetParameteri(handle, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT);
+                       VGfloat params[]={style->x1,style->y1,style->x2,style->y2,style->r};
+                       Log::getInstance()->log("OSD", Log::DEBUG, "Draw Gradient %d %g %g %g %g",handle,params[0],params[1],params[2],params[3]);
+                       vgSetParameterfv(handle,VG_PAINT_LINEAR_GRADIENT,4,params);
+
+
+
+               } break;
+               case DrawStyle::GradientRadial: {
+                       vgSetParameteri(handle, VG_PAINT_TYPE, VG_PAINT_TYPE_RADIAL_GRADIENT);
+                       VGfloat params[]={style->x1,style->y1,style->x2,style->y2,style->r};
+                       vgSetParameterfv(handle,VG_PAINT_RADIAL_GRADIENT,5,params);
+
+
+
+               } break;
+               };
+               if (style->ft==DrawStyle::GradientLinear ||style->ft==DrawStyle::GradientRadial) {
+                       VGfloat colorramp[5*5];
+                       colorramp[0+0*5]=0.f;
+                       colorramp[1+0*5]=((float)style->red)/255.f;
+                       colorramp[2+0*5]=((float)style->green)/255.f;
+                       colorramp[3+0*5]=((float)style->blue)/255.f;
+                       colorramp[4+0*5]=((float)style->alpha)/255.f;
+                       for (int i=0;i<(style->num_colors-1);i++) {
+                               colorramp[0+(i+1)*5]=style->grad_pos[i];
+                               colorramp[1+(i+1)*5]=((float)style->grad_col[i].red)/255.f;
+                               colorramp[2+(i+1)*5]=((float)style->grad_col[i].green)/255.f;
+                               colorramp[3+(i+1)*5]=((float)style->grad_col[i].blue)/255.f;
+                               colorramp[4+(i+1)*5]=((float)style->grad_col[i].alpha)/255.f;
+                       }
+                       colorramp[0+(style->num_colors)*5]=1.f;
+                       colorramp[1+(style->num_colors)*5]=((float)style->grad_col[style->num_colors-1].red)/255.f;
+                       colorramp[2+(style->num_colors)*5]=((float)style->grad_col[style->num_colors-1].green)/255.f;
+                       colorramp[3+(style->num_colors)*5]=((float)style->grad_col[style->num_colors-1].blue)/255.f;
+                       colorramp[4+(style->num_colors)*5]=((float)style->grad_col[style->num_colors-1].alpha)/255.f;
+                       vgSetParameteri(handle, VG_PAINT_COLOR_RAMP_SPREAD_MODE,VG_COLOR_RAMP_SPREAD_REFLECT);
+                       vgSetParameteri(handle, VG_PAINT_COLOR_RAMP_PREMULTIPLIED,VG_FALSE);
+                       vgSetParameterfv(handle,VG_PAINT_COLOR_RAMP_STOPS,5+(style->num_colors)*5,colorramp);
+               }
+
                return handle;
        } break;
        case OVGimageUploadLine: {
index ba8f7476471ae3f8d90ddd85ac720b7ac56d8b9d..a1f7b607cc94db703b800eaa980ea65e48bfb191 100644 (file)
@@ -301,7 +301,7 @@ void Surface::drawTTChar(int ox, int oy, int x, int y, cTeletextChar c)
 }
 
 void Surface::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,
-               unsigned int width, Colour& nextColour) {
+               unsigned int width, DrawStyle& nextColour) {
        startFastDraw();
        int x, y;
        unsigned int bytesIn, bitsIn;
index 4c5d4e68a5b9f99fabfb721f0c6bf05e2ba0139e..b7232564241497d83be2aca375a620304679dad3 100644 (file)
--- a/surface.h
+++ b/surface.h
@@ -76,7 +76,7 @@ class Surface
     virtual void drawVertLine(int x, int y1, int y2, const DrawStyle& c)=0;
     virtual void drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region)=0;
     virtual void drawPoint(int x, int y, DrawStyle& c, bool fastdraw=false); // This draws a point, must not be a pixel
-    virtual void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour);
+    virtual void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, DrawStyle& nextColour);
     virtual int updateToScreen(int sx, int sy, int w, int h, int dx, int dy)=0;
     virtual void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b)=0;
     virtual void screenShot(const char* fileName)=0;
index aa2cc7b89fe835bd20d3492971fec099d25343e8..fa9659f6f028a5f583e9646e84c4829adbb064c2 100644 (file)
@@ -235,11 +235,11 @@ void SurfaceVector::drawPoint(int x, int y, DrawStyle& c, bool fastdraw){
        commands.push_back(SVGCommand(x,y,1,1,Point,ref));
        if (!fastdraw)  command_mutex.Unlock();
 }
-void SurfaceVector::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour)
+void SurfaceVector::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, DrawStyle& nextColour)
 {
        command_mutex.Lock();
        ImageIndex image=osd->getMonoBitmapRef(base,width,height);
-       unsigned int ref=osd->getColorRef(nextColour);
+       unsigned int ref=osd->getStyleRef(nextColour);
        commands.push_back(SVGCommand(dx,dy,height,width,image,ref));
        command_mutex.Unlock();
 }
index 76a882ff31fe629e6b2492a01416ecf506ef0edf..519abcd18a231e9f528cf8501118213f22560b40 100644 (file)
@@ -52,7 +52,7 @@ class SurfaceVector : public Surface
     void drawVertLine(int x, int y1, int y2, const DrawStyle& c);
     void drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region);
     void drawPoint(int x, int y, DrawStyle& c, bool fastdraw=false); // This draws a point, must not be a pixel
-    void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour);
+    void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, DrawStyle& nextColour);
     int updateToScreen(int sx, int sy, int w, int h, int dx, int dy);
 
 
index 65a4859e8c6d56162e498e6c0a07e02cdd492a17..1646896b53fa55927b560e3bc779c9025317ed6f 100644 (file)
@@ -148,11 +148,21 @@ void VChannelList::doShowingBar()
 
   char showing[200];
   sprintf(showing, tr("%i to %i of %i"), topOption, sl.getBottomOption(), sl.getNumOptions());
-
+#ifndef GRADIENT_DRAWING
   rectangle(220, 385,160, 25, DrawStyle::VIEWBACKGROUND);
+#endif
   drawText(showing, 220, 385, DrawStyle::LIGHTTEXT);
 }
 
+void VChannelList::quickUpdate() { //only quick for plattform that need it!
+#ifdef GRADIENT_DRAWING
+      draw();
+#else
+      sl.draw();
+      doShowingBar();
+#endif
+}
+
 int VChannelList::handleCommand(int command)
 {
   switch(command)
@@ -161,9 +171,8 @@ int VChannelList::handleCommand(int command)
     case Remote::UP:
     {
       sl.up();
-      sl.draw();
+      quickUpdate();
 
-      doShowingBar();
       boxstack->update(this);
       return 2;
     }
@@ -171,27 +180,24 @@ int VChannelList::handleCommand(int command)
     case Remote::DOWN:
     {
       sl.down();
-      sl.draw();
+      quickUpdate();
 
-      doShowingBar();
       boxstack->update(this);
       return 2;
     }
     case Remote::SKIPBACK:
     {
       sl.pageUp();
-      sl.draw();
+      quickUpdate();
 
-      doShowingBar();
       boxstack->update(this);
       return 2;
     }
     case Remote::SKIPFORWARD:
     {
       sl.pageDown();
-      sl.draw();
+      quickUpdate();
 
-      doShowingBar();
       boxstack->update(this);
       return 2;
     }
@@ -249,8 +255,7 @@ void VChannelList::processMessage(Message* m)
   {
     if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      sl.draw();
-      doShowingBar();
+      quickUpdate();
       boxstack->update(this);
     }
   }
index 3d60db22fa2916e0f1f6c394d88077d83824de52..589f6ab246d107daa421775de3ba369511872cf4 100644 (file)
@@ -38,7 +38,7 @@ class VChannelList : public TBBoxx
 {
   public:
     VChannelList(ULONG type);
-    ~VChannelList();
+    virtual ~VChannelList();
 
     void setList(ChannelList* chanList);
     void highlightChannel(Channel* channel);
@@ -53,6 +53,7 @@ class VChannelList : public TBBoxx
     WSelectList sl;
 
     void doShowingBar();
+    void quickUpdate();
 };
 
 #endif
diff --git a/vepg.cc b/vepg.cc
index 72edcae60aa940b547efff78525efd1d7009fb88..7839ca4d974b5281b0aedc3360a6af190b078472 100644 (file)
--- a/vepg.cc
+++ b/vepg.cc
@@ -237,8 +237,7 @@ void VEpg::draw()
 
   UINT keyx = chanListbox.getRootBoxOffsetX();
   UINT keyy = chanListbox.getRootBoxOffsetY() + chanListbox.getHeight() + 2;
-  DrawStyle ref1 = DrawStyle(100, 100, 100, 255); //to do global definition for skin
-  rectangle(keyx, keyy, 605, getFontHeight() * 2 + 14, ref1);
+  rectangle(keyx, keyy, 605, getFontHeight() * 2 + 14, DrawStyle::DARKGREY);
 
   WSymbol w;
   TEMPADD(&w);
@@ -261,40 +260,32 @@ void VEpg::draw()
 
   drawText(tr("OK"), keyx + 18, keyy + 20, DrawStyle::LIGHTTEXT);
 
-  DrawStyle ref2 = DrawStyle(200, 0, 0, 255);
-  rectangle(keyx + 72, keyy + 4, 104, getFontHeight() + 2, ref2);
+  rectangle(keyx + 72, keyy + 4, 104, getFontHeight() + 2, DrawStyle::RED);
   drawText(tr("Page up"), keyx + 74, keyy + 5, DrawStyle::LIGHTTEXT);
 
-  DrawStyle ref3 = DrawStyle(0, 200, 0, 255);
-  rectangle(keyx + 72, keyy + getFontHeight() + 8, 104, getFontHeight() + 2, ref3);
+  rectangle(keyx + 72, keyy + getFontHeight() + 8, 104, getFontHeight() + 2, DrawStyle::GREEN);
   drawText(tr("Page down"), keyx + 74, keyy + getFontHeight() + 9, DrawStyle::LIGHTTEXT);
 
-  DrawStyle ref4 = DrawStyle(200, 200, 0, 255);
-  rectangle(keyx + 180, keyy + 4, 104, getFontHeight() + 2, ref4);
+  rectangle(keyx + 180, keyy + 4, 104, getFontHeight() + 2, DrawStyle::YELLOW);
   drawText(tr("-24 hours"), keyx + 182, keyy + 5, DrawStyle::LIGHTTEXT);
 
-  DrawStyle ref5 = DrawStyle(0, 0, 200, 255);
-  rectangle(keyx + 180, keyy + getFontHeight() + 8, 104, getFontHeight() + 2, ref5);
+  rectangle(keyx + 180, keyy + getFontHeight() + 8, 104, getFontHeight() + 2, DrawStyle::BLUE);
   drawText(tr("+24 hours"), keyx + 182, keyy + getFontHeight() + 9, DrawStyle::LIGHTTEXT);
 
-  DrawStyle ref6 = DrawStyle(180, 180, 180, 255);
-  rectangle(keyx + 290, keyy + 4, 180, getFontHeight() + 2, ref6);
+  rectangle(keyx + 290, keyy + 4, 180, getFontHeight() + 2, DrawStyle::GREY);
   drawText(tr("Guide / Back: Close"), keyx + 292 , keyy + 5, DrawStyle::LIGHTTEXT);
 
-  DrawStyle ref7 = DrawStyle(180, 180, 180, 255);
-  rectangle(keyx + 290, keyy + getFontHeight() + 8, 180, getFontHeight() + 2, ref7);
+  rectangle(keyx + 290, keyy + getFontHeight() + 8, 180, getFontHeight() + 2, DrawStyle::GREY);
   DrawStyle red = DrawStyle(130, 0, 0);
   drawText(tr("Rec: Set timer"), keyx + 292, keyy + getFontHeight() + 9, red);
 
-  DrawStyle ref8 = DrawStyle(180, 180, 180, 255);
-  rectangle(keyx + 474, keyy + 4, 128, getFontHeight() + 2, ref8);
+  rectangle(keyx + 474, keyy + 4, 128, getFontHeight() + 2, DrawStyle::GREY);
   w.nextSymbol = WSymbol::PLAY;
   w.setPosition(keyx + 476, keyy + 5);
   w.draw();
   drawText(tr("Sel channel"), keyx + 496, keyy + 5, DrawStyle::LIGHTTEXT);
 
-  DrawStyle ref9 = DrawStyle(180, 180, 180, 255);
-  rectangle(keyx + 474, keyy + getFontHeight() + 8, 128, getFontHeight() + 2, ref9);
+  rectangle(keyx + 474, keyy + getFontHeight() + 8, 128, getFontHeight() + 2, DrawStyle::GREY);
   drawText(tr("Go: Preview"), keyx + 476, keyy + getFontHeight() + 9, DrawStyle::LIGHTTEXT);
 
 
index 6689ddd058404108e842dfbebf7ea4cd6381219b..65dd57200d0ec7108a46ae0da4665174f5656e48 100644 (file)
@@ -187,13 +187,23 @@ void VRecordingList::doShowingBar()
 {
   int topOption = sl.getTopOption() + 1;
   if (sl.getNumOptions() == 0) topOption = 0;
-
+#ifndef GRADIENT_DRAWING
   rectangle(220, 385, 180, 25, DrawStyle::VIEWBACKGROUND);
+#endif
   char showing[200];
   sprintf(showing, tr("%i to %i of %i"), topOption, sl.getBottomOption(), sl.getNumOptions());
   drawText(showing, 220, 385, DrawStyle::LIGHTTEXT);
 }
 
+void VRecordingList::quickUpdate() { //only quick for plattform that need it!
+#ifdef GRADIENT_DRAWING
+      draw();
+#else
+      sl.draw();
+      doShowingBar();
+#endif
+}
+
 void VRecordingList::processMessage(Message* m)
 {
   Log::getInstance()->log("VRecordingList", Log::DEBUG, "Got message value %lu", m->message);
@@ -202,8 +212,7 @@ void VRecordingList::processMessage(Message* m)
   {
     if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      sl.draw();
-      doShowingBar();
+      quickUpdate();
       boxstack->update(this);
     }
   }
@@ -425,9 +434,8 @@ int VRecordingList::handleCommand(int command)
     case Remote::UP:
     {
       sl.up();
-      sl.draw();
+      quickUpdate();
 
-      doShowingBar();
       boxstack->update(this);
       return 2;
     }
@@ -435,27 +443,24 @@ int VRecordingList::handleCommand(int command)
     case Remote::DOWN:
     {
       sl.down();
-      sl.draw();
+      quickUpdate();
 
-      doShowingBar();
       boxstack->update(this);
       return 2;
     }
     case Remote::SKIPBACK:
     {
       sl.pageUp();
-      sl.draw();
+      quickUpdate();
 
-      doShowingBar();
       boxstack->update(this);
       return 2;
     }
     case Remote::SKIPFORWARD:
     {
       sl.pageDown();
-      sl.draw();
+      quickUpdate();
 
-      doShowingBar();
       boxstack->update(this);
       return 2;
     }
index 0e60dba3b43aae2211564c5ddf561cc8a61ccf24..d2f11db6652b6c8b1e253416afab047c0062c41c 100644 (file)
@@ -40,7 +40,7 @@ class VRecordingList : public TBBoxx
 {
   public:
     VRecordingList();
-    ~VRecordingList();
+    virtual ~VRecordingList();
 
     int handleCommand(int command);
     void processMessage(Message* m);
@@ -56,6 +56,7 @@ class VRecordingList : public TBBoxx
 
     WSelectList sl;
 
+    void quickUpdate();
     void doShowingBar();
     void doDeleteSelected();
     int doPlay(bool resume);
index 58e050144474b49a4e24b7b862f8770bbd4b1caa..e781354ca232b0357f38ce8b4d65c728dd67555a 100644 (file)
@@ -176,22 +176,33 @@ void VTimerList::drawShowing()
 {
   int topOption = sl.getTopOption() + 1;
   if (sl.getNumOptions() == 0) topOption = 0;
-
+#ifndef GRADIENT_DRAWING
   rectangle(220, 385, 180, 25, DrawStyle::VIEWBACKGROUND);
+#endif
   char showing[200];
   sprintf(showing, tr("%i to %i of %i"), topOption, sl.getBottomOption(), sl.getNumOptions());
   drawText(showing, 220, 385, DrawStyle::LIGHTTEXT);
 }
 
+void VTimerList::quickUpdate() { //only quick for plattform that need it!
+#ifdef GRADIENT_DRAWING
+      draw();
+#else
+      sl.draw();
+      drawShowing();
+      drawIndicators();
+#endif
+}
+
 void VTimerList::drawIndicators()
 {
   int top = sl.getTopOption();
   int bottom = sl.getBottomOption();
   int yinc = getFontHeight() + 1;
   RecTimer* recTimer;
-
+#ifndef GRADIENT_DRAWING
   rectangle(6, 44, 18, 15*yinc, DrawStyle::VIEWBACKGROUND);
-
+#endif
   // The indexes recorded from the wselectlist into the index member of the RecTimer
   // Is the same as the position in the vector of RecTimers
   // Because they are in order, they don't change order and wselectlist starts from 0 up consecutively
@@ -246,9 +257,7 @@ int VTimerList::handleCommand(int command)
     case Remote::UP:
     {
       sl.up();
-      sl.draw();
-      drawShowing();
-      drawIndicators();
+      quickUpdate();
       BoxStack::getInstance()->update(this);
       return 2;
     }
@@ -256,27 +265,21 @@ int VTimerList::handleCommand(int command)
     case Remote::DOWN:
     {
       sl.down();
-      sl.draw();
-      drawShowing();
-      drawIndicators();
+      quickUpdate();
       BoxStack::getInstance()->update(this);
       return 2;
     }
     case Remote::SKIPBACK:
     {
       sl.pageUp();
-      sl.draw();
-      drawShowing();
-      drawIndicators();
+      quickUpdate();
       BoxStack::getInstance()->update(this);
       return 2;
     }
     case Remote::SKIPFORWARD:
     {
       sl.pageDown();
-      sl.draw();
-      drawShowing();
-      drawIndicators();
+      quickUpdate();
       BoxStack::getInstance()->update(this);
       return 2;
     }
@@ -309,7 +312,7 @@ void VTimerList::processMessage(Message* m)
   {
     if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      sl.draw();
+       quickUpdate();
       BoxStack::getInstance()->update(this);
     }
   }
index a7f6a10dbcb880edd920e03463e3b9e7de534594..8bd0d3b35e3a47cc929bc57fc8f56ee7a3494001 100644 (file)
@@ -55,6 +55,7 @@ class VTimerList : public TBBoxx, public TimerReceiver
     void drawShowing();
     void drawData();
     void drawIndicators();
+    void quickUpdate();
 
     Region clockRegion;
     Region indicatorsRegion;
index 026627d36582e30cea49308bea51c04c46120092..49754701f3940e7267c86fe1239e345b145fd7ec 100644 (file)
--- a/wsymbol.h
+++ b/wsymbol.h
@@ -32,7 +32,7 @@ class WSymbol : public Boxx
     //TODO add vector based Symbols
     void draw();
     UCHAR nextSymbol;
-    Colour nextColour;
+    DrawStyle nextColour;
 
     bool mouseLBDOWN(int x, int y);