PageRenderTime 19ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/xbmc/guilib/JpegIO.h

http://github.com/xbmc/xbmc
C++ Header | 64 lines | 35 code | 9 blank | 20 comment | 0 complexity | 68c8cb25fb95cf48a28ead1b56c10946 MD5 | raw file
 1/*
 2 *      Copyright (C) 2005-2013 Team XBMC
 3 *      http://xbmc.org
 4 *
 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)
 8 *  any later version.
 9 *
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.
14 *
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/>.
18 *
19 */
20
21#ifndef GUILIB_JPEGIO_H
22#define GUILIB_JPEGIO_H
23
24#ifdef TARGET_WINDOWS
25#define XMD_H
26#pragma comment(lib, "turbojpeg-static.lib")
27#endif
28
29#include <jpeglib.h>
30#include "utils/StdString.h"
31#include "iimage.h"
32
33class CJpegIO : public IImage
34{
35
36public:
37  CJpegIO();
38  ~CJpegIO();
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  static bool           CreateThumbnailFromSurface(unsigned char* buffer, unsigned int width, unsigned int height, unsigned int format, unsigned int pitch, const CStdString& destFile);
44  void           Close();
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();
51
52protected:
53  static  void   jpeg_error_exit(j_common_ptr cinfo);
54
55  static unsigned int   GetExifOrientation(unsigned char* exif_data, unsigned int exif_data_size);
56
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;
62};
63
64#endif