diff options
author | lordjaxom <lordjaxom> | 2005-01-25 20:27:12 +0000 |
---|---|---|
committer | lordjaxom <lordjaxom> | 2005-01-25 20:27:12 +0000 |
commit | 75fbf0137aafad470843d1b27a1716645dd38de8 (patch) | |
tree | 36f3f7d89f22ad2251f7610a37f1761525b5fc84 /screen.c | |
parent | f5308255a9b3630439b8fe115f45d68150588acb (diff) | |
download | vdr-plugin-text2skin-75fbf0137aafad470843d1b27a1716645dd38de8.tar.gz vdr-plugin-text2skin-75fbf0137aafad470843d1b27a1716645dd38de8.tar.bz2 |
- implemented mask color for DrawBitmap calls
Diffstat (limited to 'screen.c')
-rw-r--r-- | screen.c | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -1,5 +1,5 @@ /* - * $Id: screen.c,v 1.1 2004/12/19 22:03:18 lordjaxom Exp $ + * $Id: screen.c,v 1.2 2005/01/25 20:27:12 lordjaxom Exp $ */ #include "screen.h" @@ -59,7 +59,8 @@ void cText2SkinScreen::Clear(void) { void cText2SkinScreen::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tColor ColorBg) { #ifndef DIRECTBLIT for (int i = 0; i < mNumRegions; ++i) - mRegions[i]->DrawBitmap(x, y, Bitmap, ColorFg, ColorBg); + DrawBitmapOverlay(*mRegions[i], x, y, (cBitmap&)Bitmap, ColorFg, ColorBg); + //mRegions[i]->DrawBitmap(x, y, Bitmap, ColorFg, ColorBg); #else mOsd->DrawBitmap(x, y, Bitmap, ColorFg, ColorBg); #endif @@ -114,3 +115,22 @@ void cText2SkinScreen::Flush(void) { mOsd->Flush(); } +void cText2SkinScreen::DrawBitmapOverlay(cBitmap &Dest, int x, int y, cBitmap &Bitmap, tColor ColorFg, + tColor ColorBg, tColor *ColorMask) +{ + const tIndex *bitmap = Dest.Data(0, 0); + if (bitmap && Bitmap.Data(0, 0) && Dest.Intersects(x, y, x + Bitmap.Width() - 1, y + Bitmap.Height() - 1)) { + if (Dest.Covers(x, y, x + Bitmap.Width() - 1, y + Bitmap.Height() - 1)) + Dest.Reset(); + x -= Dest.X0(); + y -= Dest.Y0(); + tIndex Indexes[MAXNUMCOLORS]; + Dest.Take(Bitmap, &Indexes, ColorFg, ColorBg); + for (int ix = 0; ix < Bitmap.Width(); ix++) { + for (int iy = 0; iy < Bitmap.Height(); iy++) { + if (ColorMask == NULL || *ColorMask != *Bitmap.Data(ix, iy)) + Dest.SetIndex(x + ix, y + iy, Indexes[int(*Bitmap.Data(ix, iy))]); + } + } + } +} |