Magick++ 6.9.13
Loading...
Searching...
No Matches
Options.h
1// This may look like C code, but it is really -*- C++ -*-
2//
3// Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003
4// Copyright Dirk Lemstra 2014-2015
5//
6// Definition of Options
7//
8// Options which may be applied to an image. These options are the
9// equivalent of options supplied to ImageMagick utilities.
10//
11// This is an internal implementation class and is not part of the
12// Magick++ API
13//
14
15#if !defined(Magick_Options_header)
16#define Magick_Options_header
17
18#include "Magick++/Include.h"
19#include <string>
20#include "Magick++/Color.h"
21#include "Magick++/Geometry.h"
22#include "Magick++/Drawable.h"
23
24namespace Magick
25{
26 class Image;
27
28 class Options
29 {
30 public:
31
32 // Default constructor
33 Options(void);
34
35 // Copy constructor
36 Options(const Options& options_);
37
38 // Destructor
39 ~Options();
40
41 // Remove pixel aliasing
42 void antiAlias(bool flag_);
43 bool antiAlias(void) const;
44
45 // Join images into a single multi-image file
46 void adjoin(bool flag_);
47 bool adjoin(void) const;
48
49 // Image background color
50 void backgroundColor(const Color &color_);
51 Color backgroundColor(void) const;
52
53 // Name of texture image to tile onto the image background
54 void backgroundTexture(const std::string &backgroundTexture_);
55 std::string backgroundTexture(void) const;
56
57 // Image border color
58 void borderColor(const Color &color_);
59 Color borderColor(void) const;
60
61 // Text bounding-box base color (default none)
62 void boxColor(const Color &boxColor_);
63 Color boxColor(void) const;
64
65 // Colors within this distance are considered equal
66 void colorFuzz(double fuzz_);
67 double colorFuzz(void) const;
68
69 // Image colorspace scheme
70 void colorspaceType(ColorspaceType colorspace_);
71 ColorspaceType colorspaceType(void) const;
72
73 // Compression type ( NoCompression, BZipCompression,
74 // FaxCompression, JPEGCompression, LZWCompression,
75 // RLECompression, or ZipCompression )
76 void compressType(CompressionType compressType_);
77 CompressionType compressType(void) const;
78
79 // Enable printing of debug messages from ImageMagick
80 void debug(bool flag_);
81 bool debug(void) const;
82
83 // Vertical and horizontal resolution in pixels of the image
84 void density(const Geometry &geomery_);
85 Geometry density(void) const;
86
87 // Image depth (8 or 16)
88 void depth(size_t depth_);
89 size_t depth(void) const;
90
91 // Endianness (little like Intel or big like SPARC) for image
92 // formats which support endian-specific options.
93 void endian(EndianType endian_);
94 EndianType endian(void) const;
95
96 // Image filename to read or write
97 void file(FILE *file_);
98 FILE *file(void) const;
99
100 // Image filename to read or write
101 void fileName(const std::string &fileName_);
102 std::string fileName(void) const;
103
104 // Color to use when filling drawn objects
105 void fillColor(const Color &fillColor_);
106 Color fillColor(void) const;
107
108 // Fill pattern
109 void fillPattern(const MagickCore::Image *fillPattern_);
110 const MagickCore::Image *fillPattern(void) const;
111
112 // Rule to use when filling drawn objects
113 void fillRule(const FillRule &fillRule_);
114 FillRule fillRule(void) const;
115
116 // Font name
117 void font(const std::string &font_);
118 std::string font(void) const;
119
120 // Font name
121 void fontFamily(const std::string &family_);
122 std::string fontFamily(void) const;
123
124 // Font point size
125 void fontPointsize(double pointSize_);
126 double fontPointsize(void) const;
127
128 // Font style
129 void fontStyle(const StyleType style_);
130 StyleType fontStyle(void) const;
131
132 // Font weight
133 void fontWeight(const size_t weight_);
134 size_t fontWeight(void) const;
135
136 std::string format(void) const;
137
138 // Image interlace scheme
139 void interlaceType(InterlaceType interlace_);
140 InterlaceType interlaceType(void) const;
141
142 // Image format to write or read
143 void magick(const std::string &magick_);
144 std::string magick(void) const;
145
146 // Transparent color
147 void matteColor(const Color &matteColor_);
148 Color matteColor(void) const;
149
150 // Write as a monochrome image
151 void monochrome(bool monochromeFlag_);
152 bool monochrome(void) const;
153
154 // Preferred size and location of an image canvas.
155 void page(const Geometry &pageSize_);
156 Geometry page(void) const;
157
158 // Desired image quality factor
159 void quality(size_t quality_);
160 size_t quality(void) const;
161
162 // Maximum number of colors to quantize to
163 void quantizeColors(size_t colors_);
164 size_t quantizeColors(void) const;
165
166 // Colorspace to quantize in.
167 void quantizeColorSpace(ColorspaceType colorSpace_);
168 ColorspaceType quantizeColorSpace(void) const;
169
170 // Dither image during quantization.
171 void quantizeDither(bool ditherFlag_);
172 bool quantizeDither(void) const;
173
174 // Dither method
175 void quantizeDitherMethod(DitherMethod ditherMethod_);
176 DitherMethod quantizeDitherMethod(void) const;
177
178 // Quantization tree-depth
179 void quantizeTreeDepth(size_t treeDepth_);
180 size_t quantizeTreeDepth(void) const;
181
182 // Suppress all warning messages. Error messages are still reported.
183 void quiet(const bool quiet_);
184 bool quiet(void) const;
185
186 // Units of resolution to interpret density
187 void resolutionUnits(ResolutionType resolutionUnits_);
188 ResolutionType resolutionUnits(void) const;
189
190 // Image sampling factor
191 void samplingFactor(const std::string &samplingFactor_);
192 std::string samplingFactor(void) const;
193
194 // Image size (required for raw formats)
195 void size(const Geometry &geometry_);
196 Geometry size(void) const;
197
198 // enabled/disable stroke anti-aliasing
199 void strokeAntiAlias(bool flag_);
200 bool strokeAntiAlias(void) const ;
201
202 // Color to use when drawing object outlines
203 void strokeColor(const Color &strokeColor_);
204 Color strokeColor(void) const;
205
206 // Control the pattern of dashes and gaps used to stroke
207 // paths. The strokeDashArray represents a list of numbers that
208 // specify the lengths of alternating dashes and gaps in user
209 // units. If an odd number of values is provided, then the list of
210 // values is repeated to yield an even number of values.
211 void strokeDashArray(const double *strokeDashArray_);
212 const double *strokeDashArray(void) const;
213
214 // While drawing using strokeDashArray, specify distance into the dash
215 // pattern to start the dash (default 0).
216 void strokeDashOffset(double strokeDashOffset_);
217 double strokeDashOffset(void) const;
218
219 // Specify the shape to be used at the end of open subpaths when
220 // they are stroked. Values of LineCap are UndefinedCap, ButtCap,
221 // RoundCap, and SquareCap.
222 void strokeLineCap(LineCap lineCap_);
223 LineCap strokeLineCap(void) const;
224
225 // Specify the shape to be used at the corners of paths (or other
226 // vector shapes) when they are stroked. Values of LineJoin are
227 // UndefinedJoin, MiterJoin, RoundJoin, and BevelJoin.
228 void strokeLineJoin(LineJoin lineJoin_);
229 LineJoin strokeLineJoin(void) const;
230
231 // Specify miter limit. When two line segments meet at a sharp
232 // angle and miter joins have been specified for 'lineJoin', it is
233 // possible for the miter to extend far beyond the thickness of
234 // the line stroking the path. The miterLimit' imposes a limit on
235 // the ratio of the miter length to the 'stroke_width'. The default
236 // value of this parameter is 4.
237 void strokeMiterLimit(size_t miterLimit_);
238 size_t strokeMiterLimit(void) const;
239
240 // Pattern image to use for stroked outlines
241 void strokePattern(const MagickCore::Image *strokePattern_);
242 const MagickCore::Image *strokePattern(void) const;
243
244 // Stroke width for drawing vector objects (default one)
245 void strokeWidth(double strokeWidth_);
246 double strokeWidth(void) const;
247
248 void subImage(size_t subImage_);
249 size_t subImage(void) const;
250
251 // Sub-frame number to return
252 void subRange(size_t subRange_);
253 size_t subRange(void) const;
254
255 // Render text right-to-left or left-to-right.
256 void textDirection(DirectionType direction_);
257 DirectionType textDirection() const;
258
259 // Annotation text encoding (e.g. "UTF-16")
260 void textEncoding(const std::string &encoding_);
261 std::string textEncoding(void) const;
262
263 // Text gravity.
264 void textGravity(GravityType gravity_);
265 GravityType textGravity() const;
266
267 // Text inter-line spacing
268 void textInterlineSpacing(double spacing_);
269 double textInterlineSpacing(void) const;
270
271 // Text inter-word spacing
272 void textInterwordSpacing(double spacing_);
273 double textInterwordSpacing(void) const;
274
275 // Text inter-character kerning
276 void textKerning(double kerning_);
277 double textKerning(void) const;
278
279 // Text undercolor box
280 void textUnderColor(const Color &underColor_);
281 Color textUnderColor(void) const;
282
283 void tileName(const std::string &tileName_);
284 std::string tileName(void) const;
285
286 // Origin of coordinate system to use when annotating with text or drawing
287 void transformOrigin(double tx_,double ty_);
288
289 // Reset transformation parameters to default
290 void transformReset(void);
291
292 // Rotation to use when annotating with text or drawing
293 void transformRotation(double angle_);
294
295 // Scale to use when annotating with text or drawing
296 void transformScale(double sx_,double sy_);
297
298 // Skew to use in X axis when annotating with text or drawing
299 void transformSkewX(double skewx_);
300
301 // Skew to use in Y axis when annotating with text or drawing
302 void transformSkewY(double skewy_);
303
304 // Image representation type
305 void type(const ImageType type_);
306 ImageType type(void) const;
307
308 // Return verbose information about an image, or an operation
309 void verbose(bool verboseFlag_);
310 bool verbose(void) const;
311
312 void view(const std::string &view_);
313 std::string view(void) const;
314
315 // Virtual pixel method.
316 void virtualPixelMethod(VirtualPixelMethod virtual_pixel_method_);
317 VirtualPixelMethod virtualPixelMethod(void) const;
318
319 // X11 display name
320 void x11Display(const std::string &display_);
321 std::string x11Display(void) const;
322
323 //
324 // Internal implementation methods. Please do not use.
325 //
326
327 MagickCore::DrawInfo *drawInfo(void);
328 MagickCore::ImageInfo *imageInfo(void);
329 MagickCore::QuantizeInfo *quantizeInfo(void);
330
331 // Construct using raw structures
332 Options(const MagickCore::ImageInfo *imageInfo_,
333 const MagickCore::QuantizeInfo *quantizeInfo_,
334 const MagickCore::DrawInfo *drawInfo_);
335
336 private:
337
338 // Assignment not supported
339 Options& operator=(const Options&);
340
341 void setOption(const char *name,const Color &value_);
342
343 void setOption(const char *name,const double value_);
344
345 MagickCore::ImageInfo *_imageInfo;
346 MagickCore::QuantizeInfo *_quantizeInfo;
347 MagickCore::DrawInfo *_drawInfo;
348 bool _quiet;
349 };
350} // namespace Magick
351
352#endif // Magick_Options_header