From patchwork Wed Jan 4 16:23:45 2006 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Fischer X-Patchwork-Id: 12136 Received: from mail.gmx.net ([213.165.64.21]) by www.linuxtv.org with smtp (Exim 4.50) id 1EuBOR-0000dG-Aj for vdr@linuxtv.org; Wed, 04 Jan 2006 17:21:43 +0100 Received: (qmail invoked by alias); 04 Jan 2006 16:21:09 -0000 Received: from p5499145C.dip0.t-ipconnect.de (EHLO [192.168.2.10]) [84.153.20.92] by mail.gmx.net (mp004) with SMTP; 04 Jan 2006 17:21:09 +0100 X-Authenticated: #1735141 Message-ID: <43BBF691.8090308@gmx.de> Date: Wed, 04 Jan 2006 17:23:45 +0100 From: Patrick Fischer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20051002 Thunderbird/1.0.2 Mnenhy/0.7.2.0 X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: vdr@linuxtv.org X-Y-GMX-Trusted: 0 Subject: [vdr] dithernPatch and Demo X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2006 16:21:43 -0000 Status: O X-Status: X-Keywords: X-UID: 6919 In the last days of 2005 I have written an small but effect full patch for VDR. It allows the developer to mix two Colors. So if your Memory only allows you to use 4 Colors, you can mix them to 16 Colors :-) If you can use 8 Colors then you can mix them to 64 Colors. This is the theory. Not all colors looks nice. But you can use them. An other limitation is that you only can use the new colors for rectangles. (maybe I will expand this to the other elements) If you mix two colors the pixel will be alternating plotted. Like: if(((x%2)&&(y%2)) || (!(x%2)&&!(y%2))) SetIndex(x, y, color1); else SetIndex(x, y, color2); In the case of using mixed Colors, the OSD will be drawn a little bit slower. (you will not notice it) In the case of normal drawing nothing will be different. Full compatibility. I have written a demoplugin to show how it works. You can use the demoplugin with or without the patch. If you have patched vdr, you need to define #define USEVDRWITHPATCH at the beginning of the ditherndemo.c file. (commented out) If you use the demo without patching the vdr, it will work much slower. DithernDemo You can install the demo like every other plugin. if you start it, you can change the base colors by pressing the color buttons on your RC. The first line shows you the base colors. All other colors are mixed. I have written this demo to test this Plugin on my Activy300. So it is limited to 4 Colors. With this patch we can create other skins with more colors. If Klaus find it usefully, I will look for the other elements. Greetings Patrick --- ../vdr-1.3.37_orig/osd.c 2005-11-04 15:19:31.000000000 +0100 +++ osd.c 2006-01-04 16:00:55.000000000 +0100 @@ -435,7 +435,7 @@ } } -void cBitmap::DrawRectangle(int x1, int y1, int x2, int y2, tColor Color) +void cBitmap::DrawRectangle(int x1, int y1, int x2, int y2, tColor Color, tColor Color2) { if (bitmap && Intersects(x1, y1, x2, y2)) { if (Covers(x1, y1, x2, y2)) @@ -449,10 +449,21 @@ x2 = min(x2, width - 1); y2 = min(y2, height - 1); tIndex c = Index(Color); - for (int y = y1; y <= y2; y++) + if(!Color2){ + for (int y = y1; y <= y2; y++) for (int x = x1; x <= x2; x++) - SetIndex(x, y, c); + SetIndex(x, y, c); + }else{ + //Color2 is set, so use dithern + tIndex c2 = Index(Color2); + for (int y = y1; y <= y2; y++) + for (int x = x1; x <= x2; x++) + if(((x%2)&&(y%2)) || (!(x%2)&&!(y%2))) + SetIndex(x, y, c); + else + SetIndex(x, y, c2); } + } } void cBitmap::DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quadrants) @@ -695,10 +706,10 @@ bitmaps[i]->DrawText(x, y, s, ColorFg, ColorBg, Font, Width, Height, Alignment); } -void cOsd::DrawRectangle(int x1, int y1, int x2, int y2, tColor Color) +void cOsd::DrawRectangle(int x1, int y1, int x2, int y2, tColor Color, tColor Color2) { for (int i = 0; i < numBitmaps; i++) - bitmaps[i]->DrawRectangle(x1, y1, x2, y2, Color); + bitmaps[i]->DrawRectangle(x1, y1, x2, y2, Color,Color2); } void cOsd::DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quadrants) --- ../vdr-1.3.37_orig/osd.h 2005-06-19 12:35:25.000000000 +0200 +++ osd.h 2006-01-04 15:57:18.000000000 +0100 @@ -169,7 +169,7 @@ ///< will be drawn into a rectangle with the given size and the given ///< Alignment (default is top-left). If ColorBg is clrTransparent, no ///< background pixels will be drawn, which allows drawing "transparent" text. - void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color); + void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color, tColor Color2=0); ///< Draws a filled rectangle defined by the upper left (x1, y1) and lower right ///< (x2, y2) corners with the given Color. If the rectangle covers the entire ///< bitmap area, the color palette will be reset, so that new colors can be @@ -290,7 +290,7 @@ ///< will be drawn into a rectangle with the given size and the given ///< Alignment (default is top-left). If ColorBg is clrTransparent, no ///< background pixels will be drawn, which allows drawing "transparent" text. - virtual void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color); + virtual void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color, tColor Color2=0); ///< Draws a filled rectangle defined by the upper left (x1, y1) and lower right ///< (x2, y2) corners with the given Color. virtual void DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quadrants = 0);