forked from pocoproject/poco
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImage.h
More file actions
121 lines (90 loc) · 2.18 KB
/
Image.h
File metadata and controls
121 lines (90 loc) · 2.18 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//
// Image.h
//
// $Id: //poco/Main/PDF/include/Poco/PDF/Image.h#4 $
//
// Library: PDF
// Package: PDFCore
// Module: Image
//
// Definition of the Image class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef PDF_Image_INCLUDED
#define PDF_Image_INCLUDED
#include "Poco/PDF/PDF.h"
#include "Poco/PDF/Resource.h"
namespace Poco {
namespace PDF {
class PDF_API Image: public Resource<HPDF_Image>
/// Image class represents image resource.
{
public:
Image(HPDF_Doc* pPDF, const HPDF_Image& resource, const std::string& name = "");
/// Creates the image.
~Image();
/// Destroys the image.
Point size() const;
/// Returns the size of the image.
float width() const;
/// Returns the width of the image.
float height() const;
/// Returns the height of the image.
Poco::UInt32 bitsPerColor() const;
/// Returns the number of bits per color.
std::string colorSpace() const;
/// Returns the name of the image's color space.
void colorMask(Poco::UInt32 redMin,
Poco::UInt32 redMax,
Poco::UInt32 greenMin,
Poco::UInt32 greenMax,
Poco::UInt32 blueMin,
Poco::UInt32 blueMax);
/// Sets the transparent color of the image by the RGB range values.
/// The color within the range is displayed as a transparent color.
/// The Image must be of the RGB color space.
};
//
// inlines
//
inline Point Image::size() const
{
return HPDF_Image_GetSize(handle());
}
inline float Image::width() const
{
return static_cast<float>(HPDF_Image_GetWidth(handle()));
}
inline float Image::height() const
{
return static_cast<float>(HPDF_Image_GetHeight(handle()));
}
inline Poco::UInt32 Image::bitsPerColor() const
{
return HPDF_Image_GetBitsPerComponent(handle());
}
inline std::string Image::colorSpace() const
{
return HPDF_Image_GetColorSpace(handle());
}
inline void Image::colorMask(Poco::UInt32 redMin,
Poco::UInt32 redMax,
Poco::UInt32 greenMin,
Poco::UInt32 greenMax,
Poco::UInt32 blueMin,
Poco::UInt32 blueMax)
{
HPDF_Image_SetColorMask(handle(),
redMin,
redMax,
greenMin,
greenMax,
blueMin,
blueMax);
}
} } // namespace Poco::PDF
#endif // PDF_Image_INCLUDED