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
{
8
VERTICAL
,
9
HORIZONTAL
,
10
BOTH
11
};
12
13
enum
TYPE
14
{
15
BMP
,
16
JPG
,
17
PNG
,
18
TIFF
,
19
GIF
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
{
29
class
OPH_DLL
ImgEncoder
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
JPG
Definition:
ImgEncoder.h:16
w
w
Definition:
Openholo.cpp:429
TYPE
TYPE
Definition:
ImgEncoder.h:13
BMP
Definition:
ImgEncoder.h:15
h
h
Definition:
Openholo.cpp:430
oph::ImgEncoder::getInstance
static ImgEncoder * getInstance()
Definition:
ImgEncoder.h:39
BOTH
Definition:
ImgEncoder.h:10
oph::ImgEncoder::CalcBitmapSize
int CalcBitmapSize(int w, int h, int ch)
Definition:
ImgEncoder.h:48
HORIZONTAL
Definition:
ImgEncoder.h:9
FLIP
FLIP
Definition:
ImgEncoder.h:6
TIFF
Definition:
ImgEncoder.h:18
oph::ImgEncoder
Definition:
ImgEncoder.h:29
PNG
Definition:
ImgEncoder.h:17
VERTICAL
Definition:
ImgEncoder.h:8
oph
Definition:
Bitmap.h:49
GIF
Definition:
ImgEncoder.h:19
OPH_DLL
#define OPH_DLL
Definition:
ImgEncoder.h:25
D:
Sources
Openholo
Openholo
build
include
ImgEncoder.h
Generated by
1.8.14