-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtiff2bitmap.h
73 lines (60 loc) · 1.25 KB
/
tiff2bitmap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef __INCLUDE_TIFF2BITMAP_H__
#define __INCLUDE_TIFF2BITMAP_H__
#include <tiffio.h>
#include "logger.h"
class Tiff2bitmapException
{
public:
Tiff2bitmapException() {
m_errno = 0;
m_txt = NULL;
};
Tiff2bitmapException(int error) {
m_errno = error;
m_txt = NULL;
};
Tiff2bitmapException(const char* txt) {
m_errno = 0;
m_txt = txt;
};
virtual ~Tiff2bitmapException() {};
const char* get_text();
private:
int m_errno;
const char* m_txt;
};
class Tiff2bitmap
{
public:
Tiff2bitmap();
~Tiff2bitmap();
void open(const char* file_name);
void close();
uint32 get_width() {
return get_field32(TIFFTAG_IMAGEWIDTH);
};
uint32 get_height() {
return get_field32(TIFFTAG_IMAGELENGTH);
};
int read_directory() {
return TIFFReadDirectory(m_tiff);
};
uint32* read_RGBA_image();
void free_image();
uint32 get_field32(ttag_t tag, uint32 def=(uint32)-1);
uint16 get_field16(ttag_t tag, uint16 def=(uint16)-1);
void set_logger(Logger& logger) {
delete m_msg;
m_msg = &logger;
};
protected:
void make_tempname();
private:
Logger* m_msg;
TIFF* m_tiff;
int m_fd;
uint32* m_img;
off_t m_imglen;
char m_template[256];
};
#endif //__INCLUDE_TIFF2BITMAP_H__