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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
module dmagick.c.magickType;
import dmagick.c.magickVersion;
extern (C)
{
version(X86)
{
alias real MagickFloatT;
alias real MagickDoubleT;
}
else version(X86_64)
{
alias float MagickFloatT;
alias double MagickDoubleT;
}
version(Quantum8)
{
/**
* Quantum is an alias for the smallest integer that can hold
* a pixel channel.
*/
version(MagickCore_HDRI)
alias float Quantum;
else
alias ubyte Quantum;
alias ptrdiff_t SignedQuantum;
static if ( MagickLibVersion == 0x680 )
alias float MagickRealType;
else static if ( MagickLibVersion >= 0x681 )
alias MagickFloatT MagickRealType;
else
alias double MagickRealType;
/**
* The largest value that fits in a Quantum, This is the same
* as Quantum.max except when the Quantum dept is 64 bits.
*/
enum QuantumRange = ubyte.max;
enum MAGICKCORE_QUANTUM_DEPTH = 8;
enum MaxColormapSize = 256;
static if ( MagickLibVersion < 0x678 )
{
enum MagickEpsilon = 1.0e-6;
enum MagickHuge = 1.0e6;
}
}
else version(Quantum32)
{
/**
* Quantum is an alias for the smallest integer that can hold
* a pixel channel.
*/
version(MagickCore_HDRI)
alias float Quantum;
else
alias uint Quantum;
alias double SignedQuantum;
static if ( MagickLibVersion >= 0x681 )
alias MagickDoubleT MagickRealType;
else
alias double MagickRealType;
/**
* The largest value that fits in a Quantum, This is the same
* as Quantum.max except when the Quantum dept is 64 bits.
*/
enum QuantumRange = uint.max;
enum MAGICKCORE_QUANTUM_DEPTH = 32;
enum MaxColormapSize = 65536;
static if ( MagickLibVersion < 0x678 )
{
enum MagickEpsilon = 1.0e-10;
enum MagickHuge = 1.0e12;
}
}
else version(Quantum64)
{
/**
* Quantum is an alias for the smallest integer that can hold
* a pixel channel.
*/
alias double Quantum;
alias double SignedQuantum;
//real seems to be the same size as long double for
//dmc and dmd on windows and for dmd and gcc on linux.
alias real MagickRealType;
/**
* The largest value that fits in a Quantum, This is the same
* as Quantum.max except when the Quantum dept is 64 bits.
*/
enum QuantumRange = 18446744073709551615.0;
enum MAGICKCORE_QUANTUM_DEPTH = 64;
enum MaxColormapSize = 65536;
static if ( MagickLibVersion < 0x678 )
{
enum MagickEpsilon = 1.0e-10;
enum MagickHuge = 1.0e12;
}
}
else
{
/**
* Quantum is an alias for the smallest integer that can hold
* a pixel channel.
*/
version(MagickCore_HDRI)
alias float Quantum;
else
alias ushort Quantum;
alias ptrdiff_t SignedQuantum;
static if ( MagickLibVersion == 0x680 )
alias float MagickRealType;
else static if ( MagickLibVersion >= 0x681 )
alias MagickFloatT MagickRealType;
else
alias double MagickRealType;
/**
* The largest value that fits in a Quantum, This is the same
* as Quantum.max except when the Quantum dept is 64 bits.
*/
enum QuantumRange = ushort.max;
enum MAGICKCORE_QUANTUM_DEPTH = 16;
enum MaxColormapSize = 65536;
static if ( MagickLibVersion < 0x678 )
{
enum MagickEpsilon = 1.0e-10;
enum MagickHuge = 1.0e12;
}
}
static if ( MagickLibVersion == 0x678 )
{
enum MagickRealType MagickEpsilon = 2.220446e-16;
enum MagickRealType MagickHuge = 1.0/MagickEpsilon;
}
else static if ( MagickLibVersion == 0x679 )
{
enum MagickRealType MagickEpsilon = 1.0e-16;
enum MagickRealType MagickHuge = 1.0/MagickEpsilon;
}
else static if ( MagickLibVersion == 0x680 )
{
enum MagickRealType MagickEpsilon = 1.0e-16;
enum MagickRealType MagickHuge = 3.4e+38;
}
else static if ( MagickLibVersion >= 0x681 )
{
enum MagickRealType MagickEpsilon = 1.0e-15;
enum MagickRealType MagickHuge = 3.4e+38;
}
alias uint MagickStatusType;
alias long MagickOffsetType;
alias ulong MagickSizeType;
alias int MagickBooleanType;
alias MagickSizeType QuantumAny;
alias MaxColormapSize MaxMap;
enum MaxTextExtent = 4096;
/// The Quantum depth ImageMagick / DMagick is compiled with.
alias MAGICKCORE_QUANTUM_DEPTH MagickQuantumDepth;
enum QuantumScale = (1.0/ cast(double)QuantumRange);
alias QuantumRange TransparentOpacity; /// Fully transparent Quantum.
enum OpaqueOpacity = 0; /// Fully opaque Quantum.
version(D_Ddoc)
{
/**
* Specify an image channel. A channel is a color component of a
* pixel. In the RGB colorspace the channels are red, green, and
* blue. There may also be an alpha (transparency/opacity) channel.
* In the CMYK colorspace the channels area cyan, magenta, yellow,
* and black. In the HSL colorspace the channels are hue, saturation,
* and lightness. In the Gray colorspace the only channel is gray.
*/
enum ChannelType
{
UndefinedChannel,
RedChannel = 0x0001, ///
GrayChannel = 0x0001, ///
CyanChannel = 0x0001, ///
GreenChannel = 0x0002, ///
MagentaChannel = 0x0002, ///
BlueChannel = 0x0004, ///
YellowChannel = 0x0004, ///
AlphaChannel = 0x0008, /// Same as OpacityChannel
OpacityChannel = 0x0008, ///
MatteChannel = 0x0008, /// deprecated
BlackChannel = 0x0020, ///
IndexChannel = 0x0020, ///
CompositeChannels = 0x002F, ///
AllChannels = 0x7ffffff, ///
TrueAlphaChannel = 0x0040, /// extract actual alpha channel from opacity
RGBChannels = 0x0080, /// set alpha from grayscale mask in RGB
GrayChannels = 0x0080, ///
SyncChannels = 0x0100, /// channels should be modified equally
/**
* Same as AllChannels, excluding OpacityChannel
*/
DefaultChannels = ((AllChannels | SyncChannels) &~ OpacityChannel)
}
}
else
{
mixin(
{
string channels = "enum ChannelType
{
UndefinedChannel,
RedChannel = 0x0001,
GrayChannel = 0x0001,
CyanChannel = 0x0001,
GreenChannel = 0x0002,
MagentaChannel = 0x0002,
BlueChannel = 0x0004,
YellowChannel = 0x0004,
AlphaChannel = 0x0008,
OpacityChannel = 0x0008,
MatteChannel = 0x0008, // deprecated
BlackChannel = 0x0020,
IndexChannel = 0x0020,
CompositeChannels = 0x002F,";
static if ( MagickLibVersion < 0x670 )
{
channels ~= "AllChannels = 0x002F,";
}
else static if ( MagickLibVersion == 0x670 )
{
channels ~= "AllChannels = ~0UL,";
}
else static if ( MagickLibVersion == 0x671 )
{
channels ~= "AllChannels = ~0L,";
}
else
{
channels ~= "AllChannels = 0x7FFFFFF,";
}
channels ~= "
TrueAlphaChannel = 0x0040, // extract actual alpha channel from opacity
RGBChannels = 0x0080, // set alpha from grayscale mask in RGB
GrayChannels = 0x0080,
SyncChannels = 0x0100, // channels should be modified equally
DefaultChannels = ( (AllChannels | SyncChannels) &~ OpacityChannel)
}";
return channels;
}());
}
/**
* Specify the image storage class.
*/
enum ClassType
{
UndefinedClass, /// No storage class has been specified.
DirectClass, /// Image is composed of pixels which represent literal color values.
PseudoClass /// Image is composed of pixels which specify an index in a color palette.
}
struct BlobInfo {}
}
|