All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
JpegLoader.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "IJpegLoader.h"
6 #include "Types.h"
7 #include "JpegImage.h"
8 #include "JpegType.h"
9 
10 namespace Eegeo
11 {
12  namespace Helpers
13  {
14  namespace Jpeg
15  {
16  class JpegLoader : protected Eegeo::NonCopyable, public IJpegLoader
17  {
18  public:
19 
20  JpegLoader(bool manuallyCreateRGB565MipMaps = false);
21 
22  void DecompressJpeg(Byte *jpeg, size_t len, JpegImage &image, bool invertVertically=false);
23 
24  bool TryDecompressJpeg(Byte *jpeg, size_t len, JpegImage &image, bool invertVertically=false);
25 
26  bool LoadJpgFromBuffer(
28  const Byte* resourceBuffer,
29  size_t resourceBufferSizeBytes,
30  bool mipmap,
31  bool invertVertically);
32 
33  private:
34 
35 
36  bool m_manuallyCreateRGB565MipMaps;
37  };
38 
39  void BoxDownsampleRGB888InPlace(int& inout_width, int& inout_height, Byte* pixels);
40  void ConvertRGBA888ToRGBA565(u16* outputPixels, const Byte* inputPixels, int width, int height);
41  u16* CreateRGB565ArrayFromRawRGBPixels(int width, int height, const Byte* pixels);
42  }
43  }
44 }