diff options
Diffstat (limited to 'libcore/imageloader.h')
-rw-r--r-- | libcore/imageloader.h | 81 |
1 files changed, 70 insertions, 11 deletions
diff --git a/libcore/imageloader.h b/libcore/imageloader.h index 2a148be..a06f433 100644 --- a/libcore/imageloader.h +++ b/libcore/imageloader.h @@ -1,23 +1,82 @@ #ifndef __NOPACITY_IMAGELOADER_H #define __NOPACITY_IMAGELOADER_H -#define X_DISPLAY_MISSING - +#include <cairo.h> +#include <librsvg/rsvg.h> +#ifndef LIBRSVG_VERSION // Workaround for librsvg < 2.36.2 + #include <librsvg/rsvg-cairo.h> +#endif +#include <jpeglib.h> +#include <setjmp.h> #include <vdr/osd.h> -#include <vdr/skins.h> -#include <Magick++.h> -#include "imagemagickwrapper.h" +#include <vdr/tools.h> + +// +// Image importers +// +class cImageImporter { +public: + cImageImporter() {}; + virtual ~cImageImporter() {}; + virtual bool LoadImage(const char *path) { return false; }; + virtual void DrawToCairo(cairo_t *cr) {}; + virtual void GetImageSize(int &width, int &height) {}; +}; + +// Image importer for PNG +class cImageImporterPNG : public cImageImporter { +public: + cImageImporterPNG(); + ~cImageImporterPNG(); + bool LoadImage(const char *path); + void DrawToCairo(cairo_t *cr); + void GetImageSize(int &width, int &height); +private: + cairo_surface_t *surface; +}; + +// Image importer for SVG +class cImageImporterSVG : public cImageImporter { +public: + cImageImporterSVG(); + ~cImageImporterSVG(); + bool LoadImage(const char *path); + void DrawToCairo(cairo_t *cr); + void GetImageSize(int &width, int &height); +private: + RsvgHandle *handle; +}; -using namespace Magick; +// Image importer for JPG +#if BITS_IN_JSAMPLE != 8 + #error libjpeg has to be compiled with 8-bit samples! +#endif -class cImageLoader : public cImageMagickWrapper { +class cImageImporterJPG : public cImageImporter { +public: + cImageImporterJPG(); + ~cImageImporterJPG(); + bool LoadImage(const char *path); + void DrawToCairo(cairo_t *cr); + void GetImageSize(int &width, int &height); +private: + j_decompress_ptr cinfo; + FILE *infile; +}; + +// +// Image loader class +// +class cImageLoader { +private: + cImageImporter *importer; public: cImageLoader(); - ~cImageLoader(); - cImage GetImage(); - bool LoadImage(const char *path, int width, int height); + virtual ~cImageLoader(); + cImage *CreateImage(int width, int height, bool preserveAspect = true); + bool LoadImage(std::string Path, std::string FileName, std::string Extension); + bool LoadImage(const char *fullpath); void DeterminateChannelLogoSize(int &width, int &height); -private: }; #endif //__NOPACITY_IMAGELOADER_H |