2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #ifndef GUILIB_JPEGIO_H
22 #define GUILIB_JPEGIO_H
26 #pragma comment(lib, "turbojpeg-static.lib")
30 #include "utils/StdString.h"
33 class CJpegIO : public IImage
39 bool Open(const CStdString& m_texturePath, unsigned int minx=0, unsigned int miny=0, bool read=true);
40 bool Read(unsigned char* buffer, unsigned int bufSize, unsigned int minx, unsigned int miny);
41 bool CreateThumbnail(const CStdString& sourceFile, const CStdString& destFile, int minx, int miny, bool rotateExif);
42 bool CreateThumbnailFromMemory(unsigned char* buffer, unsigned int bufSize, const CStdString& destFile, unsigned int minx, unsigned int miny);
43 bool CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, unsigned int format, unsigned int pitch, const CStdString& destFile);
45 // methods for the imagefactory
46 virtual bool Decode(const unsigned char *pixels, unsigned int pitch, unsigned int format);
47 virtual bool LoadImageFromMemory(unsigned char* buffer, unsigned int bufSize, unsigned int width, unsigned int height);
48 virtual bool CreateThumbnailFromSurface(unsigned char* bufferin, unsigned int width, unsigned int height, unsigned int format, unsigned int pitch, const CStdString& destFile,
49 unsigned char* &bufferout, unsigned int &bufferoutSize);
50 virtual void ReleaseThumbnailBuffer();
53 static void jpeg_error_exit(j_common_ptr cinfo);
55 unsigned int GetExifOrientation(unsigned char* exif_data, unsigned int exif_data_size);
57 unsigned char *m_inputBuff;
58 unsigned int m_inputBuffSize;
59 struct jpeg_decompress_struct m_cinfo;
60 CStdString m_texturePath;
61 unsigned char* m_thumbnailbuffer;