Openholo
v2.1
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
5
#include <atlbase.h>
6
7
8
#ifdef OPH_EXPORT
9
#define OPH_DLL __declspec(dllexport)
10
#else
11
#define OPH_DLL __declspec(dllimport)
12
#endif
13
namespace
oph
14
{
15
enum
FLIP
16
{
17
NONE
,
18
VERTICAL
,
19
HORIZONTAL
,
20
BOTH
21
};
22
23
enum
TYPE
24
{
25
BMP
,
26
JPG
,
27
PNG
,
28
TIFF
,
29
GIF
30
};
31
32
class
OPH_DLL
ImgControl
33
{
34
private
:
35
ImgControl
();
36
~
ImgControl
();
37
static
ImgControl
*instance;
38
static
void
Destroy() {
39
delete
instance;
40
}
41
public
:
42
static
ImgControl
*
getInstance
() {
43
if
(instance ==
nullptr
) {
44
instance =
new
ImgControl
();
45
atexit(Destroy);
46
}
47
return
instance;
48
}
49
50
bool
Save(
const
char
*path, BYTE *pBuf, UINT len,
int
quality = 100);
51
int
CalcBitmapSize
(
int
w,
int
h,
int
ch) {
return
(((w * ch) + 3) & ~3) * h; }
52
bool
GetSize(
const
char
* path,
unsigned
int
*size);
53
void
Resize(
unsigned
char
* src,
unsigned
char
* dst,
int
w,
int
h,
int
neww,
int
newh,
int
ch);
54
bool
Rotate(
double
rotate,
unsigned
char
*src,
unsigned
char
*dst,
int
w,
int
h,
int
neww,
int
newh,
int
ch);
55
bool
Flip(
FLIP
mode,
unsigned
char
*src,
unsigned
char
*dst,
int
w,
int
h,
int
ch);
56
bool
Crop(
unsigned
char
*src,
unsigned
char
*dst,
int
w,
int
h,
int
ch,
int
x,
int
y,
int
neww,
int
newh);
57
58
59
private
:
60
int
GetEncoderClsid(
const
WCHAR *format, CLSID *pClsid);
61
char
* GetExtension(
const
char
*path);
62
};
63
}
64
#endif
oph::NONE
Definition:
ImgControl.h:17
oph::ImgControl::CalcBitmapSize
int CalcBitmapSize(int w, int h, int ch)
Definition:
ImgControl.h:51
oph::TYPE
TYPE
Definition:
ImgControl.h:23
oph::VERTICAL
Definition:
ImgControl.h:18
oph::ImgControl
Definition:
ImgControl.h:32
oph::HORIZONTAL
Definition:
ImgControl.h:19
OPH_DLL
#define OPH_DLL
Definition:
ImgControl.h:11
oph::TIFF
Definition:
ImgControl.h:28
oph::PNG
Definition:
ImgControl.h:27
oph::GIF
Definition:
ImgControl.h:29
oph::JPG
Definition:
ImgControl.h:26
oph::BOTH
Definition:
ImgControl.h:20
oph::BMP
Definition:
ImgControl.h:25
oph::FLIP
FLIP
Definition:
ImgControl.h:15
oph::ImgControl::getInstance
static ImgControl * getInstance()
Definition:
ImgControl.h:42
oph
Definition:
Bitmap.h:49
Openholo
Openholo
src
ImgControl.h
Generated by
1.8.14