From 2a96976d47841f61587c2022c2d5264c7e8f9ec8 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Thu, 16 Apr 2020 17:42:30 +0100 Subject: [PATCH] Reformat Colour class and move enum into SkinFactory class --- colour.cc | 764 +++++++++++++++++++++++++++--------------------------- colour.h | 216 ++++++++------- 2 files changed, 493 insertions(+), 487 deletions(-) diff --git a/colour.cc b/colour.cc index 699dd0c..904097b 100644 --- a/colour.cc +++ b/colour.cc @@ -40,7 +40,7 @@ DrawStyle DrawStyle::PROGRESSBAR(255, 255, 255); DrawStyle DrawStyle::LIGHTTEXT(255, 255, 255); DrawStyle DrawStyle::DARKTEXT(0, 0, 100); DrawStyle DrawStyle::DANGER(200, 0, 0); -DrawStyle DrawStyle::OSDBACKGROUND(0,0,0,128); +DrawStyle DrawStyle::OSDBACKGROUND(0, 0, 0, 128); DrawStyle DrawStyle::BUTTONBACKGROUND(0, 0, 200); DrawStyle DrawStyle::PROGRAMMEB(80, 80, 240); // two colours used as alterating backgrounds for individual programmes in EPG DrawStyle DrawStyle::PROGRAMMEA(40, 40, 120); // TODO fit epg style (colours) in with rest of application @@ -48,415 +48,405 @@ DrawStyle DrawStyle::NOPROGRAMME(180, 180, 180); // no programme details colour DrawStyle DrawStyle::WALLPAPER(0xFF000000); -enum SkinNames{ -#ifdef GRADIENT_DRAWING - NoopacityInspired, - ClassicEnhanced, -#endif - Classic, - MaxSkins -}; - -const char *skinnames[]={ +const char* skinnames[] = +{ #ifdef GRADIENT_DRAWING -"Noopacity inspired", -"VompClassic Enhanced", + "Noopacity inspired", + "VompClassic Enhanced", #endif - "VompClassic" + "VompClassic" }; - const char* *SkinFactory::getSkinNames() - { - - return skinnames; - } - +const char ** SkinFactory::getSkinNames() +{ + return skinnames; +} int SkinFactory::getNumberofSkins() { - return MaxSkins; + return MaxSkins; } - - 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::WALLPAPER=DrawStyle(0, 0, 150); - DrawStyle::VIEWBACKGROUND=DrawStyle(0, 0, 100); - DrawStyle::SELECTBACKGROUND=DrawStyle(0, 0, 100); - DrawStyle::VIEWTRANSPARENTBACKGROUND=DrawStyle(0, 0, 100, 128); - DrawStyle::TABVIEWBACKGROUND=DrawStyle(0, 0, 120); - DrawStyle::TITLEBARBACKGROUND=DrawStyle(0, 0, 200); - DrawStyle::LIVETVSYMBOLS=DrawStyle(240, 250, 80); - DrawStyle::SELECTHIGHLIGHT=DrawStyle(240, 250, 80); - DrawStyle::SELECTDARKHIGHLIGHT=DrawStyle(120, 125, 40); - DrawStyle::PROGRESSBAR=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::OSDBACKGROUND=DrawStyle(0,0,0,128); - 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); -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); - */ + /* + 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::WALLPAPER = DrawStyle(0, 0, 150); + DrawStyle::VIEWBACKGROUND = DrawStyle(0, 0, 100); + DrawStyle::SELECTBACKGROUND = DrawStyle(0, 0, 100); + DrawStyle::VIEWTRANSPARENTBACKGROUND = DrawStyle(0, 0, 100, 128); + DrawStyle::TABVIEWBACKGROUND = DrawStyle(0, 0, 120); + DrawStyle::TITLEBARBACKGROUND = DrawStyle(0, 0, 200); + DrawStyle::LIVETVSYMBOLS = DrawStyle(240, 250, 80); + DrawStyle::SELECTHIGHLIGHT = DrawStyle(240, 250, 80); + DrawStyle::SELECTDARKHIGHLIGHT = DrawStyle(120, 125, 40); + DrawStyle::PROGRESSBAR = 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::OSDBACKGROUND = DrawStyle(0, 0, 0, 128); + 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); + 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); + */ } 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(80, 80, 80); - 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::WALLPAPER=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::VIEWTRANSPARENTBACKGROUND=DrawStyle(0, 0, 100, 128); - DrawStyle::VIEWTRANSPARENTBACKGROUND.grad_col[0]=Colour(0,0,160,128); - DrawStyle::VIEWTRANSPARENTBACKGROUND.num_colors=1; - DrawStyle::VIEWTRANSPARENTBACKGROUND.ft=DrawStyle::GradientLinear; - DrawStyle::VIEWTRANSPARENTBACKGROUND.x1=0.0; - DrawStyle::VIEWTRANSPARENTBACKGROUND.y1=0.0; - DrawStyle::VIEWTRANSPARENTBACKGROUND.x2=0.0; - DrawStyle::VIEWTRANSPARENTBACKGROUND.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::LIVETVSYMBOLS = DrawStyle::SELECTHIGHLIGHT; - - - DrawStyle::SELECTDARKHIGHLIGHT=DrawStyle(60, 65, 20); - DrawStyle::SELECTDARKHIGHLIGHT.grad_col[0]=DrawStyle(120, 125, 40); - DrawStyle::SELECTDARKHIGHLIGHT.num_colors=1; - DrawStyle::SELECTDARKHIGHLIGHT.ft=DrawStyle::GradientLinear; - DrawStyle::SELECTDARKHIGHLIGHT.x1=0.0; - DrawStyle::SELECTDARKHIGHLIGHT.y1=0.0; - DrawStyle::SELECTDARKHIGHLIGHT.x2=0.0; - DrawStyle::SELECTDARKHIGHLIGHT.y2=1.0; - - DrawStyle::SELECTBACKGROUND=DrawStyle(0, 0, 100); - DrawStyle::SELECTBACKGROUND.grad_col[0]=Colour(0,0,160); - DrawStyle::SELECTBACKGROUND.num_colors=1; - DrawStyle::SELECTBACKGROUND.ft=DrawStyle::GradientLinear; - DrawStyle::SELECTBACKGROUND.x1=0.0; - DrawStyle::SELECTBACKGROUND.y1=0.0; - DrawStyle::SELECTBACKGROUND.x2=0.0; - DrawStyle::SELECTBACKGROUND.y2=1.0; - - DrawStyle::LIGHTTEXT=DrawStyle(255, 255, 255); - DrawStyle::LIGHTTEXT.grad_col[0]=DrawStyle(150, 150, 150); - DrawStyle::LIGHTTEXT.num_colors=1; - DrawStyle::LIGHTTEXT.ft=DrawStyle::GradientLinear; - DrawStyle::LIGHTTEXT.x1=0.0; - DrawStyle::LIGHTTEXT.y1=0.0; - DrawStyle::LIGHTTEXT.x2=0.0; - DrawStyle::LIGHTTEXT.y2=1.0; - DrawStyle::PROGRESSBAR=DrawStyle::LIGHTTEXT; - - 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::OSDBACKGROUND=DrawStyle(0,0,0,128); - - - 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); - */ + /* + 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(80, 80, 80); + 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::WALLPAPER = 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::VIEWTRANSPARENTBACKGROUND = DrawStyle(0, 0, 100, 128); + DrawStyle::VIEWTRANSPARENTBACKGROUND.grad_col[0] = Colour(0, 0, 160, 128); + DrawStyle::VIEWTRANSPARENTBACKGROUND.num_colors = 1; + DrawStyle::VIEWTRANSPARENTBACKGROUND.ft = DrawStyle::GradientLinear; + DrawStyle::VIEWTRANSPARENTBACKGROUND.x1 = 0.0; + DrawStyle::VIEWTRANSPARENTBACKGROUND.y1 = 0.0; + DrawStyle::VIEWTRANSPARENTBACKGROUND.x2 = 0.0; + DrawStyle::VIEWTRANSPARENTBACKGROUND.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::LIVETVSYMBOLS = DrawStyle::SELECTHIGHLIGHT; + + + DrawStyle::SELECTDARKHIGHLIGHT = DrawStyle(60, 65, 20); + DrawStyle::SELECTDARKHIGHLIGHT.grad_col[0] = DrawStyle(120, 125, 40); + DrawStyle::SELECTDARKHIGHLIGHT.num_colors = 1; + DrawStyle::SELECTDARKHIGHLIGHT.ft = DrawStyle::GradientLinear; + DrawStyle::SELECTDARKHIGHLIGHT.x1 = 0.0; + DrawStyle::SELECTDARKHIGHLIGHT.y1 = 0.0; + DrawStyle::SELECTDARKHIGHLIGHT.x2 = 0.0; + DrawStyle::SELECTDARKHIGHLIGHT.y2 = 1.0; + + DrawStyle::SELECTBACKGROUND = DrawStyle(0, 0, 100); + DrawStyle::SELECTBACKGROUND.grad_col[0] = Colour(0, 0, 160); + DrawStyle::SELECTBACKGROUND.num_colors = 1; + DrawStyle::SELECTBACKGROUND.ft = DrawStyle::GradientLinear; + DrawStyle::SELECTBACKGROUND.x1 = 0.0; + DrawStyle::SELECTBACKGROUND.y1 = 0.0; + DrawStyle::SELECTBACKGROUND.x2 = 0.0; + DrawStyle::SELECTBACKGROUND.y2 = 1.0; + + DrawStyle::LIGHTTEXT = DrawStyle(255, 255, 255); + DrawStyle::LIGHTTEXT.grad_col[0] = DrawStyle(150, 150, 150); + DrawStyle::LIGHTTEXT.num_colors = 1; + DrawStyle::LIGHTTEXT.ft = DrawStyle::GradientLinear; + DrawStyle::LIGHTTEXT.x1 = 0.0; + DrawStyle::LIGHTTEXT.y1 = 0.0; + DrawStyle::LIGHTTEXT.x2 = 0.0; + DrawStyle::LIGHTTEXT.y2 = 1.0; + DrawStyle::PROGRESSBAR = DrawStyle::LIGHTTEXT; + + 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::OSDBACKGROUND = DrawStyle(0, 0, 0, 128); + + + 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); + */ } void SkinFactory::InitNoopacityInspiredSkin() { - /* -Real colours - */ - DrawStyle::BLACK=DrawStyle(0, 0, 0); - DrawStyle::RED=DrawStyle(0x99BB0000); - DrawStyle::GREY=DrawStyle(0xFE777777); - DrawStyle::DARKGREY=DrawStyle(0x7D000000); - DrawStyle::GREEN=DrawStyle(0x9900BB00); - DrawStyle::BLUE=DrawStyle(0x990000BB); - DrawStyle::YELLOW=DrawStyle(0x99BBBB00); - DrawStyle::VIEWBACKGROUND=DrawStyle(0xB012273f); - DrawStyle::VIEWTRANSPARENTBACKGROUND=DrawStyle(0x99242A38); - DrawStyle::OSDBACKGROUND=DrawStyle(0xB012273f); - DrawStyle::TABVIEWBACKGROUND=DrawStyle(0x99242A38); - - DrawStyle::LIVETVSYMBOLS=DrawStyle(0xFF9a9a9a); - DrawStyle::PROGRESSBAR=DrawStyle(0xFFC6D590); - - - - DrawStyle::SELECTHIGHLIGHT=DrawStyle(0xFF999999); - DrawStyle::SELECTHIGHLIGHT.grad_col[0]=DrawStyle(0xFFa4fd15); - DrawStyle::SELECTHIGHLIGHT.grad_col[1]=DrawStyle(0xFFa4fd15); - DrawStyle::SELECTHIGHLIGHT.grad_col[2]=DrawStyle(0x7D000000); - DrawStyle::SELECTHIGHLIGHT.grad_pos[0]=0.3f; - DrawStyle::SELECTHIGHLIGHT.grad_pos[1]=0.9f; - DrawStyle::SELECTHIGHLIGHT.num_colors=3; - DrawStyle::SELECTHIGHLIGHT.ft=DrawStyle::GradientLinear; - DrawStyle::SELECTHIGHLIGHT.x1=0.0f; - DrawStyle::SELECTHIGHLIGHT.y1=0.2f; - DrawStyle::SELECTHIGHLIGHT.x2=1.1f; - DrawStyle::SELECTHIGHLIGHT.y2=0.8f; - - - DrawStyle::SELECTDARKHIGHLIGHT=DrawStyle(0xFD999999); - DrawStyle::SELECTDARKHIGHLIGHT.grad_col[0]=DrawStyle(0xFF7bbd0f); - DrawStyle::SELECTDARKHIGHLIGHT.grad_col[1]=DrawStyle(0xFF7bbd0f); - DrawStyle::SELECTDARKHIGHLIGHT.grad_col[2]=DrawStyle(0x7D000000); - DrawStyle::SELECTDARKHIGHLIGHT.grad_pos[0]=0.3f; - DrawStyle::SELECTDARKHIGHLIGHT.grad_pos[1]=0.9f; - DrawStyle::SELECTDARKHIGHLIGHT.num_colors=3; - DrawStyle::SELECTDARKHIGHLIGHT.ft=DrawStyle::GradientLinear; - DrawStyle::SELECTDARKHIGHLIGHT.x1=0.0f; - DrawStyle::SELECTDARKHIGHLIGHT.y1=0.2f; - DrawStyle::SELECTDARKHIGHLIGHT.x2=1.1f; - DrawStyle::SELECTDARKHIGHLIGHT.y2=0.8f; - - - DrawStyle::SELECTBACKGROUND=DrawStyle(0xFE999999); - DrawStyle::SELECTBACKGROUND.grad_col[0]=DrawStyle(0xFF353b50); - DrawStyle::SELECTBACKGROUND.grad_col[1]=DrawStyle(0xFF353b50); - DrawStyle::SELECTBACKGROUND.grad_col[2]=DrawStyle(0x7D000000); - DrawStyle::SELECTBACKGROUND.grad_pos[0]=0.3f; - DrawStyle::SELECTBACKGROUND.grad_pos[1]=0.9f; - DrawStyle::SELECTBACKGROUND.num_colors=3; - DrawStyle::SELECTBACKGROUND.ft=DrawStyle::GradientLinear; - DrawStyle::SELECTBACKGROUND.x1=0.0f; - DrawStyle::SELECTBACKGROUND.y1=0.2f; - DrawStyle::SELECTBACKGROUND.x2=1.1f; - DrawStyle::SELECTBACKGROUND.y2=0.8f; - - DrawStyle::TITLEBARBACKGROUND=DrawStyle::SELECTBACKGROUND; - - DrawStyle::LIGHTTEXT=DrawStyle(0xFFFFFFFF); - DrawStyle::DARKTEXT=DrawStyle(0xFF363636); - DrawStyle::DANGER=DrawStyle(200, 0, 0); - DrawStyle::BUTTONBACKGROUND=DrawStyle::SELECTBACKGROUND; - // two colours used as alterating backgrounds for individual programmes in EPG - DrawStyle::PROGRAMMEB=DrawStyle::SELECTBACKGROUND; - - - - DrawStyle::PROGRAMMEA=DrawStyle(0x7D000000); - DrawStyle::PROGRAMMEA.grad_col[0]=DrawStyle(0xFF353b50); - DrawStyle::PROGRAMMEA.grad_col[1]=DrawStyle(0xFF353b50); - DrawStyle::PROGRAMMEA.grad_col[2]=DrawStyle(0xFE999999); - DrawStyle::PROGRAMMEA.grad_pos[0]=0.3f; - DrawStyle::PROGRAMMEA.grad_pos[1]=0.9f; - DrawStyle::PROGRAMMEA.num_colors=3; - DrawStyle::PROGRAMMEA.ft=DrawStyle::GradientLinear; - DrawStyle::PROGRAMMEA.x1=0.0f; - DrawStyle::PROGRAMMEA.y1=0.2f; - DrawStyle::PROGRAMMEA.x2=1.0f; - DrawStyle::PROGRAMMEA.y2=0.8f; - - - DrawStyle::NOPROGRAMME=DrawStyle(0xFF353b50); // no programme details colour - - DrawStyle::WALLPAPER=DrawStyle(0x00000000); // two colours used as alternating backgrounds for individual programmes in EPG - DrawStyle::WALLPAPER.grad_col[0]=DrawStyle(0x0012273f); - DrawStyle::WALLPAPER.num_colors=1; - DrawStyle::WALLPAPER.ft=DrawStyle::GradientLinear; - DrawStyle::WALLPAPER.x1=0.0f; - DrawStyle::WALLPAPER.y1=0.0f; - DrawStyle::WALLPAPER.x2=0.0f; - DrawStyle::WALLPAPER.y2=1.0f; - - /* -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); - */ + /* + Real colours + */ + DrawStyle::BLACK = DrawStyle(0, 0, 0); + DrawStyle::RED = DrawStyle(0x99BB0000); + DrawStyle::GREY = DrawStyle(0xFE777777); + DrawStyle::DARKGREY = DrawStyle(0x7D000000); + DrawStyle::GREEN = DrawStyle(0x9900BB00); + DrawStyle::BLUE = DrawStyle(0x990000BB); + DrawStyle::YELLOW = DrawStyle(0x99BBBB00); + DrawStyle::VIEWBACKGROUND = DrawStyle(0xB012273f); + DrawStyle::VIEWTRANSPARENTBACKGROUND = DrawStyle(0x99242A38); + DrawStyle::OSDBACKGROUND = DrawStyle(0xB012273f); + DrawStyle::TABVIEWBACKGROUND = DrawStyle(0x99242A38); + + DrawStyle::LIVETVSYMBOLS = DrawStyle(0xFF9a9a9a); + DrawStyle::PROGRESSBAR = DrawStyle(0xFFC6D590); + + + + DrawStyle::SELECTHIGHLIGHT = DrawStyle(0xFF999999); + DrawStyle::SELECTHIGHLIGHT.grad_col[0] = DrawStyle(0xFFa4fd15); + DrawStyle::SELECTHIGHLIGHT.grad_col[1] = DrawStyle(0xFFa4fd15); + DrawStyle::SELECTHIGHLIGHT.grad_col[2] = DrawStyle(0x7D000000); + DrawStyle::SELECTHIGHLIGHT.grad_pos[0] = 0.3f; + DrawStyle::SELECTHIGHLIGHT.grad_pos[1] = 0.9f; + DrawStyle::SELECTHIGHLIGHT.num_colors = 3; + DrawStyle::SELECTHIGHLIGHT.ft = DrawStyle::GradientLinear; + DrawStyle::SELECTHIGHLIGHT.x1 = 0.0f; + DrawStyle::SELECTHIGHLIGHT.y1 = 0.2f; + DrawStyle::SELECTHIGHLIGHT.x2 = 1.1f; + DrawStyle::SELECTHIGHLIGHT.y2 = 0.8f; + + + DrawStyle::SELECTDARKHIGHLIGHT = DrawStyle(0xFD999999); + DrawStyle::SELECTDARKHIGHLIGHT.grad_col[0] = DrawStyle(0xFF7bbd0f); + DrawStyle::SELECTDARKHIGHLIGHT.grad_col[1] = DrawStyle(0xFF7bbd0f); + DrawStyle::SELECTDARKHIGHLIGHT.grad_col[2] = DrawStyle(0x7D000000); + DrawStyle::SELECTDARKHIGHLIGHT.grad_pos[0] = 0.3f; + DrawStyle::SELECTDARKHIGHLIGHT.grad_pos[1] = 0.9f; + DrawStyle::SELECTDARKHIGHLIGHT.num_colors = 3; + DrawStyle::SELECTDARKHIGHLIGHT.ft = DrawStyle::GradientLinear; + DrawStyle::SELECTDARKHIGHLIGHT.x1 = 0.0f; + DrawStyle::SELECTDARKHIGHLIGHT.y1 = 0.2f; + DrawStyle::SELECTDARKHIGHLIGHT.x2 = 1.1f; + DrawStyle::SELECTDARKHIGHLIGHT.y2 = 0.8f; + + + DrawStyle::SELECTBACKGROUND = DrawStyle(0xFE999999); + DrawStyle::SELECTBACKGROUND.grad_col[0] = DrawStyle(0xFF353b50); + DrawStyle::SELECTBACKGROUND.grad_col[1] = DrawStyle(0xFF353b50); + DrawStyle::SELECTBACKGROUND.grad_col[2] = DrawStyle(0x7D000000); + DrawStyle::SELECTBACKGROUND.grad_pos[0] = 0.3f; + DrawStyle::SELECTBACKGROUND.grad_pos[1] = 0.9f; + DrawStyle::SELECTBACKGROUND.num_colors = 3; + DrawStyle::SELECTBACKGROUND.ft = DrawStyle::GradientLinear; + DrawStyle::SELECTBACKGROUND.x1 = 0.0f; + DrawStyle::SELECTBACKGROUND.y1 = 0.2f; + DrawStyle::SELECTBACKGROUND.x2 = 1.1f; + DrawStyle::SELECTBACKGROUND.y2 = 0.8f; + + DrawStyle::TITLEBARBACKGROUND = DrawStyle::SELECTBACKGROUND; + + DrawStyle::LIGHTTEXT = DrawStyle(0xFFFFFFFF); + DrawStyle::DARKTEXT = DrawStyle(0xFF363636); + DrawStyle::DANGER = DrawStyle(200, 0, 0); + DrawStyle::BUTTONBACKGROUND = DrawStyle::SELECTBACKGROUND; + // two colours used as alterating backgrounds for individual programmes in EPG + DrawStyle::PROGRAMMEB = DrawStyle::SELECTBACKGROUND; + + + + DrawStyle::PROGRAMMEA = DrawStyle(0x7D000000); + DrawStyle::PROGRAMMEA.grad_col[0] = DrawStyle(0xFF353b50); + DrawStyle::PROGRAMMEA.grad_col[1] = DrawStyle(0xFF353b50); + DrawStyle::PROGRAMMEA.grad_col[2] = DrawStyle(0xFE999999); + DrawStyle::PROGRAMMEA.grad_pos[0] = 0.3f; + DrawStyle::PROGRAMMEA.grad_pos[1] = 0.9f; + DrawStyle::PROGRAMMEA.num_colors = 3; + DrawStyle::PROGRAMMEA.ft = DrawStyle::GradientLinear; + DrawStyle::PROGRAMMEA.x1 = 0.0f; + DrawStyle::PROGRAMMEA.y1 = 0.2f; + DrawStyle::PROGRAMMEA.x2 = 1.0f; + DrawStyle::PROGRAMMEA.y2 = 0.8f; + + + DrawStyle::NOPROGRAMME = DrawStyle(0xFF353b50); // no programme details colour + + DrawStyle::WALLPAPER = DrawStyle(0x00000000); // two colours used as alternating backgrounds for individual programmes in EPG + DrawStyle::WALLPAPER.grad_col[0] = DrawStyle(0x0012273f); + DrawStyle::WALLPAPER.num_colors = 1; + DrawStyle::WALLPAPER.ft = DrawStyle::GradientLinear; + DrawStyle::WALLPAPER.x1 = 0.0f; + DrawStyle::WALLPAPER.y1 = 0.0f; + DrawStyle::WALLPAPER.x2 = 0.0f; + DrawStyle::WALLPAPER.y2 = 1.0f; + + /* + 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); + */ } bool SkinFactory::InitSkin(int n) { - switch(n) - { - default: - case Classic: InitDefaultSkin(); break; + switch (n) + { + default: + case Classic: + InitDefaultSkin(); + break; #ifdef GRADIENT_DRAWING - case ClassicEnhanced: InitEnhancedSkin(); break; - case NoopacityInspired: InitNoopacityInspiredSkin(); break; + case ClassicEnhanced: + InitEnhancedSkin(); + break; + case NoopacityInspired: + InitNoopacityInspiredSkin(); + break; #endif - }; - return true; -} + } + return true; +} diff --git a/colour.h b/colour.h index 47f338a..f5d5e36 100644 --- a/colour.h +++ b/colour.h @@ -20,31 +20,33 @@ #ifndef COLOUR_H #define COLOUR_H +#include "defines.h" + class Colour { public: Colour() - { red = 0; green = 0; blue = 0; alpha = 255; } + { red = 0; green = 0; blue = 0; alpha = 255; } Colour(int Tred, int Tgreen, int Tblue) - { red = Tred; green = Tgreen; blue = Tblue; alpha = 255; } + { red = Tred; green = Tgreen; blue = Tblue; alpha = 255; } Colour(int Tred, int Tgreen, int Tblue, int Talpha) - { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; } + { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; } Colour(unsigned int color) - { - red = (color & 0x00ff0000)>>16; - green = (color & 0x0000ff00)>>8; - blue = (color & 0x000000ff); - alpha = (color & 0xff000000)>>24; - } + { + red = (color & 0x00ff0000) >> 16; + green = (color & 0x0000ff00) >> 8; + blue = (color & 0x000000ff); + alpha = (color & 0xff000000) >> 24; + } void set(int Tred, int Tgreen, int Tblue) - { red = Tred; green = Tgreen; blue = Tblue; alpha = 255; } + { red = Tred; green = Tgreen; blue = Tblue; alpha = 255; } void set(int Tred, int Tgreen, int Tblue, int Talpha) - { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; } + { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; } inline unsigned long rgba() const { @@ -55,58 +57,57 @@ class Colour int green; int blue; int alpha; - - - - }; + // TODO move to seperate File class DrawStyle: public Colour { -public: - DrawStyle() - { 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 ;ft=Color;ct=Global; } - - DrawStyle(int Tred, int Tgreen, int Tblue, int Talpha) - { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; ft=Color;ct=Global;} - DrawStyle(unsigned int color) - { - red = (color & 0x00ff0000)>>16; - green = (color & 0x0000ff00)>>8; - blue = (color & 0x000000ff); - alpha = (color & 0xff000000)>>24; - ft=Color;ct=Global; - } - - DrawStyle(const Colour &c) - { - red = c.red; - green = c.green; - blue = c.blue; - alpha = c.alpha; - 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 + public: + DrawStyle() + { 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 ; ft = Color; ct = Global; } + + DrawStyle(int Tred, int Tgreen, int Tblue, int Talpha) + { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; ft = Color; ct = Global;} + DrawStyle(unsigned int color) + { + red = (color & 0x00ff0000) >> 16; + green = (color & 0x0000ff00) >> 8; + blue = (color & 0x000000ff); + alpha = (color & 0xff000000) >> 24; + ft = Color; ct = Global; + } + + DrawStyle(const Colour& c) + { + red = c.red; + green = c.green; + blue = c.blue; + alpha = c.alpha; + 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; @@ -134,76 +135,91 @@ public: static DrawStyle PROGRAMMEB; static DrawStyle NOPROGRAMME; static DrawStyle WALLPAPER; // this one is special, if transparent it means picture - }; -#define COMPARE_TEST(x) if (rhs.x!=lhs.x) { \ - return rhs.x < lhs.x; \ - } +#define COMPARE_TEST(x) if (rhs.x != lhs.x) { return rhs.x < lhs.x; } inline bool operator<(const DrawStyle& rhs, const DrawStyle& lhs) { - COMPARE_TEST(rgba()) - COMPARE_TEST(ft) + COMPARE_TEST(rgba()) + COMPARE_TEST(ft) - if (rhs.ft==DrawStyle::Color) return false; + if (rhs.ft == DrawStyle::Color) return false; - COMPARE_TEST(num_colors) - COMPARE_TEST(x1) - COMPARE_TEST(x2) - COMPARE_TEST(y1) - COMPARE_TEST(y2) - if (rhs.ft==DrawStyle::GradientRadial) COMPARE_TEST(r) + COMPARE_TEST(num_colors) + COMPARE_TEST(x1) + COMPARE_TEST(x2) + COMPARE_TEST(y1) + COMPARE_TEST(y2) + if (rhs.ft == DrawStyle::GradientRadial) COMPARE_TEST(r) - for (int i=0;i0) COMPARE_TEST(grad_pos[i-1]) - } - COMPARE_TEST(ct) + for (int i = 0; i < lhs.num_colors; i++) + { + COMPARE_TEST(grad_col[i].rgba()) - return false; -} + if (i > 0) COMPARE_TEST(grad_pos[i - 1]) + } + COMPARE_TEST(ct) + + return false; +} #undef COMPARE_TEST -#define COMPARE_TEST(x) if (rhs.x!=lhs.x) return true; +#define COMPARE_TEST(x) if (rhs.x!=lhs.x) return true; inline bool operator!=(const DrawStyle& rhs, const DrawStyle& lhs) { - COMPARE_TEST(rgba()) - COMPARE_TEST(ft) + COMPARE_TEST(rgba()) + COMPARE_TEST(ft) + + if (rhs.ft == DrawStyle::Color) return false; - if (rhs.ft==DrawStyle::Color) return false; + COMPARE_TEST(num_colors) + COMPARE_TEST(x1) + COMPARE_TEST(x2) + COMPARE_TEST(y1) + COMPARE_TEST(y2) - COMPARE_TEST(num_colors) - COMPARE_TEST(x1) - COMPARE_TEST(x2) - COMPARE_TEST(y1) - COMPARE_TEST(y2) - if (rhs.ft==DrawStyle::GradientRadial) COMPARE_TEST(r) + if (rhs.ft == DrawStyle::GradientRadial) COMPARE_TEST(r) + for (int i = 0; i < lhs.num_colors; i++) + { + COMPARE_TEST(grad_col[i].rgba()) - for (int i=0;i0) COMPARE_TEST(grad_pos[i-1]) - } - COMPARE_TEST(ct) + if (i > 0) COMPARE_TEST(grad_pos[i - 1]) + } - return false; + COMPARE_TEST(ct) + + return false; } #undef COMPARE_TEST -class SkinFactory { -public: - static int getNumberofSkins(); - static const char* *getSkinNames(); - static bool InitSkin(int n); -private: +class SkinFactory +{ + public: + + enum SkinNames + { +#ifdef GRADIENT_DRAWING + NoopacityInspired, + ClassicEnhanced, +#endif + Classic, + MaxSkins + }; + + static int getNumberofSkins(); + static const char ** getSkinNames(); + static bool InitSkin(int n); + + private: static void InitDefaultSkin(); static void InitEnhancedSkin(); static void InitNoopacityInspiredSkin(); -- 2.39.5