dithernPatch and Demo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vdr-ditherndemo-0.0.1.tgz
Type: application/x-compressed-tar
Size: 9813 bytes
Desc: not available
Url : http://www.linuxtv.org/pipermail/vdr/attachments/20060104/cba496a9/vdr-ditherndemo-0.0.1-0001.bin
-------------- next part --------------
--- ../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);

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux