Mailing List archive

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

[vdr] Re: non-transparent osd skin



Torgeir Veimo wrote:
> 
> On Mon, 2004-10-18 at 13:43 +0200, Klaus Schmidinger wrote:
> > Torgeir Veimo wrote:
> > >
> > > I think it could be implemented as a mod for vdr's osd itself so
> > > that it does the dithering as a step after rendering just
> > > before being displayed.
> >
> > What _exactly_ is it that you have to do special here?
> > The OSD is basically just a bitmap where each byte corresponds
> > to a color from a palette. I'm afraid I don't understand what
> > that "non-transparent" stuff is about. Can you please elaborate?
> 
> The idea is to make a pass over the complete osd bitmap which replaces
> every pixel which has non-zero transparency with either the colour (but
> with zero transparency), or completely transparent, depending on the
> coordinate of the pixel.
> 
> void dither(cOsd *osd, int x1, int y1, int x2, int y2) {
>   if (x2 < x1) { int tmp = x1; x1 = x2; x2 = tmp; }
>   if (y2 < y1) { int tmp = y1; y1 = y2; y2 = tmp; }
>   for (int y = y1; y <= y2; y++)
>     for (int x = x1; x <= x2; x++)
>       if (/* colour at x,y is transparent*/) {
>         if ((x % 2 == 1 && y % 2 == 1) || x % 2 == 0 && y % 2 == 0)
>           osd->DrawPixel(x, y, /* colour with opacity=255, or black */);
>         else
>           osd->DrawPixel(x, y, x, y, clrTransparent);
>       }
> }

Well, this should definitely be done in the OSD, not in the individual skins.

Klaus




Home | Main Index | Thread Index