Openholo  v4.0
Open Source Digital Holographic Library
ImgControl.h
Go to the documentation of this file.
1 #pragma once
2 #ifndef __ImgControl_h
3 #define __ImgControl_h
4 #include <stdlib.h>
5 
6 #ifdef _WIN32
7 #ifdef OPH_EXPORT
8 #define OPH_DLL __declspec(dllexport)
9 #else
10 #define OPH_DLL __declspec(dllimport)
11 #endif
12 #else
13 #ifdef OPH_EXPORT
14 #define OPH_DLL __attribute__((visibility("default")))
15 #else
16 #define OPH_DLL
17 #endif
18 #endif
19 
20 namespace oph
21 {
22  enum OPH_DLL FLIP
23  {
25  VERTICAL,
26  HORIZONTAL,
27  BOTH
28  };
29 
30  enum OPH_DLL TYPE
31  {
32  BMP,
33  JPG,
34  PNG,
35  TIFF,
36  GIF
37  };
38 
40  {
41  private:
42  ImgControl();
43  ~ImgControl();
44  static ImgControl *instance;
45  static void Destroy() {
46  delete instance;
47  }
48  public:
49  static ImgControl* getInstance() {
50  if (instance == nullptr) {
51  instance = new ImgControl();
52  atexit(Destroy);
53  }
54  return instance;
55  }
56 
57  //bool Save(const char *path, BYTE *pBuf, UINT len, int quality = 100);
58  //int CalcBitmapSize(int w, int h, int ch) { return (((w * ch) + 3) & ~3) * h; }
59  bool GetSize(const char* path, unsigned int *size);
60  void Resize(unsigned char* src, unsigned char* dst, int w, int h, int neww, int newh, int ch);
61  bool Rotate(double rotate, unsigned char *src, unsigned char *dst, int w, int h, int neww, int newh, int ch);
62  bool Flip(FLIP mode, unsigned char *src, unsigned char *dst, int w, int h, int ch);
63  bool Crop(unsigned char *src, unsigned char *dst, int w, int h, int ch, int x, int y, int neww, int newh);
64 
65 
66  private:
67  //int GetEncoderClsid(const WCHAR *format, CLSID *pClsid);
68  unsigned long long GetBitmapSize(int width, int height, int channel);
69  };
70 }
71 #endif
#define OPH_DLL
Definition: ImgControl.h:16
NONE
Definition: ImgControl.h:24
VERTICAL
Definition: ImgControl.h:24
HORIZONTAL
Definition: ImgControl.h:24
BMP
Definition: ImgControl.h:32
TIFF
Definition: ImgControl.h:32
PNG
Definition: ImgControl.h:32
JPG
Definition: ImgControl.h:32
w
Definition: Openholo.cpp:429
static ImgControl * getInstance()
Definition: ImgControl.h:49
Definition: Bitmap.h:49
h
Definition: Openholo.cpp:430