diff options
author | Andreas Mair <amair.sob@googlemail.com> | 2007-04-02 11:38:08 +0200 |
---|---|---|
committer | Andreas Mair <amair.sob@googlemail.com> | 2007-04-02 11:38:08 +0200 |
commit | c562d549bc6274265991eec634f99b1e311323df (patch) | |
tree | 2f4f23396e60f381cb2899ef7be87c1b54dc153c /bitmap.c | |
parent | de39678a54ab87364a3c8c5e3b058d313451db5b (diff) | |
download | vdr-plugin-skinenigmang-c562d549bc6274265991eec634f99b1e311323df.tar.gz vdr-plugin-skinenigmang-c562d549bc6274265991eec634f99b1e311323df.tar.bz2 |
2007-04-02: Version 0.0.4v0.0.4
- Changed text color in themes for green and yellow buttons.
- Fixed false colors problem after theme changes.
- Updated Finnish translation. (Submitted by Rolf Ahrenberg)
- Updated French translation. (Submitted by pat @vdr-portal.de)
- Do not overwrite status messages in mainmenu with list items.
- New setup option that replaces SKINENIGMA_FULL_CHANNELINFO_TITLE define.
- Disable logos/symbols/flags if 4bpp single area is configured in setup. (Will eventually replace SKINENIGMA_NO_MENULOGO define)
- Added support for mailbox plugin; shows mail symbol in channel info (Based on patch by triple955 @vdr-portal.de).
- Introduced new HAVE_IMAGEMAGICK define to enable non-xpm images in event's and recording's details.
- Fixed "blinking" date in channel info (Reported by several people).
- Changed background for recording symbol in channel info to white (Suggested by gromit @vdr-portal.de).
- Long channel group names are no longer drawn at the right side of the date (Reported by several people).
- New setup option for displaying a recording's size and use size.vdr (Suggested by vejoun @vdr-portal.de).
- Show stop time of running timers in info area in main menu. (Suggested by viking @vdr-portal.de)
- Updated Russian translation. (Submitted by neptunvasja @vdr-portal.de)
- New defines "ListProgressBarGap" & "ListProgressBarBorder" to customize the progressbar in lists:
* "ListProgressBarGap" sets the gap above/below the progressbar (relative to the font's height).
* "ListProgressBarBorder" sets the border's width.
- Added fallback to "classic" skin if any of the OSD menus fails to open.
- Fix possible NULL pointer accesses.
- Fixed compiler error with certain gcc versions.
- Minor bugfixes and graphical changes.
Diffstat (limited to 'bitmap.c')
-rw-r--r-- | bitmap.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/bitmap.c b/bitmap.c new file mode 100644 index 0000000..59bf98b --- /dev/null +++ b/bitmap.c @@ -0,0 +1,79 @@ +#ifdef HAVE_IMAGEMAGICK +#include "bitmap.h" +#include "config.h" + +#include <vdr/themes.h> + +#define X_DISPLAY_MISSING +#include <Magick++.h> +using namespace Magick; + +#include <vector> +using namespace std; + +cOSDImageBitmap::cOSDImageBitmap() +{} + + +cOSDImageBitmap::~cOSDImageBitmap() +{} + +bool cOSDImageBitmap::LoadImage(const char *fileNameP, int w, int h, int colors, cBitmap &bmp) +{ + return LoadMagick(fileNameP, w, h, colors, bmp); +} + +bool cOSDImageBitmap::LoadMagick(const char *Filename, int width, int height, int colors, cBitmap &bmp) +{ + Image image; + try { + image.read(Filename); + int w = image.columns(); + int h = image.rows(); + if (height != h || width != w) { + switch (EnigmaConfig.resizeImages) { + case 0: + image.sample(Geometry(width, height)); + break; + case 1: + image.scale(Geometry(width, height)); + break; + case 2: + image.zoom(Geometry(width, height)); + break; + } + } + w = image.columns(); + h = image.rows(); + if (colors != 0){ + image.opacity(OpaqueOpacity); + image.backgroundColor(Color(0, 0, 0, 0)); + image.quantizeColorSpace(RGBColorspace); + image.quantizeColors(colors); + image.quantize(); + } + bmp.SetSize(w, h); + bmp.SetBpp(colors <= 16 ? 4 : 8); + + const PixelPacket *pix = image.getConstPixels(0, 0, w, h); + for (int iy = 0; iy < h; ++iy) { + for (int ix = 0; ix < w; ++ix) { + tColor col = (~(pix->opacity * 255 / MaxRGB) << 24) + | ((pix->red * 255 / MaxRGB) << 16) + | ((pix->green * 255 / MaxRGB) << 8) + | (pix->blue * 255 / MaxRGB); + bmp.DrawPixel(ix, iy, col); + ++pix; + } + } + } catch (Exception &e) { + esyslog("ERROR: Couldn't load %s: %s", Filename, e.what()); + return false; + } catch (...) { + esyslog("ERROR: Couldn't load %s: Unknown exception caught", Filename); + return false; + } + return true; +} +#endif //HAVE_IMAGEMAGICK +// vim:et:sw=2:ts=2: |