Openholo  v4.2
Open Source Digital Holographic Library
ImgEncoder.h
Go to the documentation of this file.
1 #pragma once
2 #ifndef __ImgEncoder_h
3 #define __ImgEncoder_h
4 #include <atlbase.h>
5 
6 enum FLIP
7 {
11 };
12 
13 enum TYPE
14 {
15  BMP,
16  JPG,
17  PNG,
20 };
21 
22 #ifdef OPH_EXPORT
23 #define OPH_DLL __declspec(dllexport)
24 #else
25 #define OPH_DLL __declspec(dllimport)
26 #endif
27 namespace oph
28 {
30  {
31  private:
32  ImgEncoder();
33  ~ImgEncoder();
34  static ImgEncoder *instance;
35  static void Destroy() {
36  delete instance;
37  }
38  public:
39  static ImgEncoder* getInstance() {
40  if (instance == nullptr) {
41  instance = new ImgEncoder();
42  atexit(Destroy);
43  }
44  return instance;
45  }
46 
47  bool Save(const char *path, BYTE *pBuf, UINT len, int quality = 100);
48  int CalcBitmapSize(int w, int h, int ch) { return (((w * ch) + 3) & ~3) * h; }
49  bool GetSize(const char* path, unsigned int *size);
50  void Resize(unsigned char* src, unsigned char* dst, int w, int h, int neww, int newh, int ch);
51  bool Rotate(double rotate, unsigned char *src, unsigned char *dst, int w, int h, int neww, int newh, int ch);
52  bool Flip(FLIP mode, unsigned char *src, unsigned char *dst, int w, int h, int ch);
53  bool Crop(unsigned char *src, unsigned char *dst, int w, int h, int ch, int x, int y, int neww, int newh);
54 
55 
56  private:
57  int GetEncoderClsid(const WCHAR *format, CLSID *pClsid);
58  char* GetExtension(const char *path);
59  };
60 }
61 #endif
Definition: ImgEncoder.h:16
w
Definition: Openholo.cpp:429
TYPE
Definition: ImgEncoder.h:13
Definition: ImgEncoder.h:15
h
Definition: Openholo.cpp:430
static ImgEncoder * getInstance()
Definition: ImgEncoder.h:39
int CalcBitmapSize(int w, int h, int ch)
Definition: ImgEncoder.h:48
FLIP
Definition: ImgEncoder.h:6
Definition: ImgEncoder.h:17
Definition: Bitmap.h:49
Definition: ImgEncoder.h:19
#define OPH_DLL
Definition: ImgEncoder.h:25