[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / pictures / DllImageLib.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://www.xbmc.org
6  *
7  *  This Program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  This Program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with XBMC; see the file COPYING.  If not, see
19  *  <http://www.gnu.org/licenses/>.
20  *
21  */
22
23 #include "DynamicDll.h"
24
25  #ifdef LoadImage
26   #undef LoadImage
27  #endif
28
29 #ifdef _LINUX
30 typedef struct tagRGBQUAD {
31    BYTE rgbBlue;
32    BYTE rgbGreen;
33    BYTE rgbRed;
34    BYTE rgbReserved;
35 } RGBQUAD;
36 #endif
37
38 #define EXIF_MAX_COMMENT 1000
39
40 typedef struct tag_ExifInfo {
41   char  Version      [5];
42   char  CameraMake   [32];
43   char  CameraModel  [40];
44   char  DateTime     [20];
45   int   Height, Width;
46   int   Orientation;
47   int   IsColor;
48   int   Process;
49   int   FlashUsed;
50   float FocalLength;
51   float ExposureTime;
52   float ApertureFNumber;
53   float Distance;
54   float CCDWidth;
55   float ExposureBias;
56   int   Whitebalance;
57   int   MeteringMode;
58   int   ExposureProgram;
59   int   ISOequivalent;
60   int   CompressionLevel;
61   float FocalplaneXRes;
62   float FocalplaneYRes;
63   float FocalplaneUnits;
64   float Xresolution;
65   float Yresolution;
66   float ResolutionUnit;
67   float Brightness;
68   char  Comments[EXIF_MAX_COMMENT];
69
70   unsigned char * ThumbnailPointer;  /* Pointer at the thumbnail */
71   unsigned ThumbnailSize;     /* Size of thumbnail. */
72
73   bool  IsExif;
74 } EXIFINFO;
75
76 struct ImageInfo
77 {
78   unsigned int width;
79   unsigned int height;
80   unsigned int originalwidth;
81   unsigned int originalheight;
82   EXIFINFO exifInfo;
83   BYTE* texture;
84   void* context;
85   BYTE* alpha;
86 };
87
88 class DllImageLibInterface
89 {
90 public:
91     virtual ~DllImageLibInterface() {}
92     virtual bool ReleaseImage(ImageInfo *)=0;
93     virtual bool LoadImage(const char *, unsigned int, unsigned int, ImageInfo *)=0;
94     virtual bool LoadImageFromMemory(const uint8_t*, unsigned int, const char *, unsigned int, unsigned int, ImageInfo *)=0;
95     virtual bool CreateThumbnailFromSurface(BYTE *, unsigned int, unsigned int, unsigned int, const char *)=0;
96     virtual bool CreateThumbnailFromSurface2(BYTE *, unsigned int, unsigned int, unsigned int, const char *, BYTE * &, unsigned int&)=0;
97     virtual void FreeMemory(void*)=0;
98 };
99
100 class DllImageLib : public DllDynamic, DllImageLibInterface
101 {
102   DECLARE_DLL_WRAPPER(DllImageLib, DLL_PATH_IMAGELIB)
103   DEFINE_METHOD1(bool, ReleaseImage, (ImageInfo *p1))
104   DEFINE_METHOD4(bool, LoadImage, (const char * p1, unsigned int p2, unsigned int p3, ImageInfo * p4))
105   DEFINE_METHOD6(bool, LoadImageFromMemory, (const uint8_t * p1, unsigned int p2, const char *p3, unsigned int p4, unsigned int p5, ImageInfo * p6))
106   DEFINE_METHOD5(bool, CreateThumbnailFromSurface, (BYTE * p1, unsigned int p2, unsigned int p3, unsigned int p4, const char * p5))
107   DEFINE_METHOD7(bool, CreateThumbnailFromSurface2, (BYTE * p1, unsigned int p2, unsigned int p3, unsigned int p4, const char * p5, BYTE * &p6, unsigned int &p7))
108   DEFINE_METHOD1(void, FreeMemory, (void *p1))
109   BEGIN_METHOD_RESOLVE()
110     RESOLVE_METHOD(ReleaseImage)
111     RESOLVE_METHOD(LoadImage)
112     RESOLVE_METHOD(LoadImageFromMemory)
113     RESOLVE_METHOD(CreateThumbnailFromSurface)
114     RESOLVE_METHOD(CreateThumbnailFromSurface2)
115     RESOLVE_METHOD(FreeMemory)
116   END_METHOD_RESOLVE()
117 };