22 #if MAGICKCORE_FREETYPE_DELEGATE 23 #define MakeLabel(image, text) image.label( (text) ) 25 #define MakeLabel(image, text) 28 int main(
int ,
char ** argv)
34 const char *
const p = getenv(
"MAGICK_FONT");
35 const string MAGICK_FONT(p ? p :
"");
40 if(getenv(
"SRCDIR") != 0)
41 srcdir = getenv(
"SRCDIR");
49 cout <<
"Read images ..." << endl;
51 Image model( srcdir +
"model.miff" );
56 Image smile( srcdir +
"smile.miff" );
63 cout <<
"Creating thumbnails..." << endl;
68 null.
read(
"NULL:black" );
69 list<Image> images( 7, null );
71 Image example = model;
79 cout <<
" add noise ..." << endl;
82 images.push_back( example );
84 cout <<
" add noise (blue) ..." << endl;
85 MakeLabel(example,
"Add Noise\n(Blue Channel)");
87 images.push_back( example );
89 #if MAGICKCORE_FREETYPE_DELEGATE 90 cout <<
" annotate ..." << endl;
95 example.
font(MAGICK_FONT);
98 example.
annotate(
"Magick++",
"+0+20", NorthGravity );
99 images.push_back( example );
102 cout <<
" blur ..." << endl;
105 example.
blur( 0, 1.5 );
106 images.push_back( example );
108 cout <<
" blur red channel ..." << endl;
110 MakeLabel(example,
"Blur Channel\n(Red Channel)");
112 images.push_back( example );
114 cout <<
" border ..." << endl;
119 images.push_back( example );
121 cout <<
" channel ..." << endl;
123 MakeLabel(example,
"Channel\n(Red Channel)");
125 images.push_back( example );
127 cout <<
" charcoal ..." << endl;
131 images.push_back( example );
133 cout <<
" composite ..." << endl;
136 example.
composite( smile,
"+35+65", OverCompositeOp);
137 images.push_back( example );
139 cout <<
" contrast ..." << endl;
143 images.push_back( example );
145 cout <<
" convolve ..." << endl;
150 const double kernel[] = { 1, 1, 1, 1, 4, 1, 1, 1, 1 };
153 images.push_back( example );
155 cout <<
" crop ..." << endl;
158 example.
crop(
"80x80+25+50" );
159 images.push_back( example );
161 cout <<
" despeckle ..." << endl;
165 images.push_back( example );
167 cout <<
" draw ..." << endl;
174 images.push_back( example );
176 cout <<
" edge ..." << endl;
180 images.push_back( example );
182 cout <<
" emboss ..." << endl;
186 images.push_back( example );
188 cout <<
" equalize ..." << endl;
192 images.push_back( example );
194 cout <<
" explode ..." << endl;
199 images.push_back( example );
201 cout <<
" flip ..." << endl;
205 images.push_back( example );
207 cout <<
" flop ..." << endl;
211 images.push_back( example );
213 cout <<
" frame ..." << endl;
217 images.push_back( example );
219 cout <<
" gamma ..." << endl;
222 example.
gamma( 1.6 );
223 images.push_back( example );
225 cout <<
" gaussian blur ..." << endl;
229 images.push_back( example );
231 cout <<
" gaussian blur channel ..." << endl;
233 MakeLabel(example,
"Gaussian Blur\n(Green Channel)");
235 images.push_back( example );
237 cout <<
" gradient ..." << endl;
239 gradient.
size(
"130x194" );
240 gradient.
read(
"gradient:#20a0ff-#ffff00" );
242 images.push_back( gradient );
244 cout <<
" grayscale ..." << endl;
249 images.push_back( example );
251 cout <<
" implode ..." << endl;
255 images.push_back( example );
257 cout <<
" level ..." << endl;
260 example.
level( 0.20*QuantumRange, 0.90*QuantumRange, 1.20 );
261 images.push_back( example );
263 cout <<
" level red channel ..." << endl;
265 MakeLabel(example,
"Level Channel\n(Red Channel)");
266 example.
levelChannel( RedChannel, 0.20*QuantumRange, 0.90*QuantumRange, 1.20 );
267 images.push_back( example );
269 cout <<
" median filter ..." << endl;
273 images.push_back( example );
275 cout <<
" modulate ..." << endl;
279 images.push_back( example );
281 cout <<
" monochrome ..." << endl;
288 images.push_back( example );
290 cout <<
" motion blur ..." << endl;
294 images.push_back( example );
296 cout <<
" negate ..." << endl;
300 images.push_back( example );
302 cout <<
" normalize ..." << endl;
306 images.push_back( example );
308 cout <<
" oil paint ..." << endl;
312 images.push_back( example );
314 cout <<
" ordered dither 2x2 ..." << endl;
316 MakeLabel(example,
"Ordered Dither\n(2x2)");
318 images.push_back( example );
320 cout <<
" ordered dither 3x3..." << endl;
322 MakeLabel(example,
"Ordered Dither\n(3x3)");
324 images.push_back( example );
326 cout <<
" ordered dither 4x4..." << endl;
328 MakeLabel(example,
"Ordered Dither\n(4x4)");
330 images.push_back( example );
332 cout <<
" ordered dither red 4x4..." << endl;
334 MakeLabel(example,
"Ordered Dither\n(Red 4x4)");
336 images.push_back( example );
338 cout <<
" plasma ..." << endl;
340 plasma.
size(
"130x194" );
341 plasma.
read(
"plasma:fractal" );
343 images.push_back( plasma );
345 cout <<
" quantize ..." << endl;
349 images.push_back( example );
351 cout <<
" quantum operator ..." << endl;
353 MakeLabel(example,
"Quantum Operator\nRed * 0.4");
354 example.
evaluate( RedChannel,MultiplyEvaluateOperator,0.40 );
355 images.push_back( example );
357 cout <<
" raise ..." << endl;
361 images.push_back( example );
363 cout <<
" reduce noise ..." << endl;
367 images.push_back( example );
369 cout <<
" resize ..." << endl;
372 example.
zoom(
"50%" );
373 images.push_back( example );
375 cout <<
" roll ..." << endl;
378 example.
roll(
"+20+10" );
379 images.push_back( example );
381 cout <<
" rotate ..." << endl;
386 images.push_back( example );
388 cout <<
" scale ..." << endl;
391 example.
scale(
"60%" );
392 images.push_back( example );
394 cout <<
" segment ..." << endl;
398 images.push_back( example );
400 cout <<
" shade ..." << endl;
403 example.
shade( 30, 30,
false );
404 images.push_back( example );
406 cout <<
" sharpen ..." << endl;
410 images.push_back( example );
412 cout <<
" shave ..." << endl;
416 images.push_back( example );
418 cout <<
" shear ..." << endl;
421 example.
shear( 45, 45 );
423 images.push_back( example );
425 cout <<
" spread ..." << endl;
429 images.push_back( example );
431 cout <<
" solarize ..." << endl;
435 images.push_back( example );
437 cout <<
" swirl ..." << endl;
442 images.push_back( example );
444 cout <<
" threshold ..." << endl;
448 images.push_back( example );
450 cout <<
" threshold random ..." << endl;
454 (0.85*QuantumRange) );
455 images.push_back( example );
457 cout <<
" unsharp mask ..." << endl;
462 images.push_back( example );
464 cout <<
" wave ..." << endl;
467 example.
alpha(
true );
469 example.
wave( 25, 150 );
470 images.push_back( example );
475 cout <<
"Montage images..." << endl;
480 montageOpts.
geometry(
"130x194+10+5>" );
481 montageOpts.gravity( CenterGravity );
482 montageOpts.borderColor(
"green" );
483 montageOpts.borderWidth( 1 );
484 montageOpts.tile(
"7x4" );
485 montageOpts.backgroundColor(
"#ffffff" );
486 montageOpts.pointSize( 18 );
487 montageOpts.font(MAGICK_FONT);
488 montageOpts.fillColor(
"#600" );
489 montageOpts.strokeColor(
Color() );
490 montageOpts.fileName(
"Magick++ Demo" );
491 montageImages( &montage, images.begin(), images.end(), montageOpts );
494 Image& montage_image = montage.front();
497 cout <<
"Adding logo image ..." << endl;
498 Image logo(
"logo:" );
503 montage_image.
composite( logo, placement, OverCompositeOp );
506 for_each( montage.begin(), montage.end(),
depthImage(8) );
507 for_each( montage.begin(), montage.end(),
alphaImage(
false ) );
510 cout <<
"Writing image \"demo_out.miff\" ..." << endl;
511 writeImages(montage.begin(),montage.end(),
"demo_out_%d.miff");
518 catch( exception &error_ )
520 cout <<
"Caught exception: " << error_.what() << endl;
void gaussianBlur(const double radius_, const double sigma_)
void swirl(const double degrees_)
class MagickPPExport Color
void modulate(const double brightness_, const double saturation_, const double hue_)
void annotate(const std::string &text_, const Geometry &location_)
void charcoal(const double radius_=0.0, const double sigma_=1.0)
void blur(const double radius_=0.0, const double sigma_=1.0)
void contrast(const bool sharpen_)
void medianFilter(const double radius_=0.0)
void composite(const Image &compositeImage_, const Geometry &offset_, const CompositeOperator compose_=InCompositeOp)
void unsharpmask(const double radius_, const double sigma_, const double amount_, const double threshold_)
void negate(const bool grayscale_=false)
#define MakeLabel(image, text)
void raise(const Geometry &geometry_=raiseGeometryDefault, const bool raisedFlag_=false)
void crop(const Geometry &geometry_)
void density(const Point &density_)
void shade(const double azimuth_=30, const double elevation_=30, const bool colorShading_=false)
void zoom(const Geometry &geometry_)
void strokeWidth(const double strokeWidth_)
void blurChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
void strokeColor(const Color &strokeColor_)
void oilPaint(const double radius_=0.0, const double sigma=1.0)
void spread(const double amount_=3.0)
void randomThresholdChannel(const ChannelType channel_, const double low_, const double high_)
void motionBlur(const double radius_, const double sigma_, const double angle_)
void emboss(const double radius_=0.0, const double sigma_=1.0)
void segment(const double clusterThreshold_=1.0, const double smoothingThreshold_=1.5)
void sharpen(const double radius_=0.0, const double sigma_=1.0)
void montageImages(Container *montageImages_, InputIterator first_, InputIterator last_, const Montage &options_)
void solarize(const double factor_=50.0)
void geometry(const Geometry &geometry_)
void quantize(const bool measureError_=false)
void read(const Blob &blob_)
void frame(const Geometry &geometry_=frameGeometryDefault)
void shave(const Geometry &geometry_)
void borderColor(const Color &color_)
void font(const std::string &font_)
void fontPointsize(const double pointSize_)
class MagickPPExport Geometry
void writeImages(InputIterator first_, InputIterator last_, const std::string &imageSpec_, bool adjoin_=true)
void edge(const double radius_=0.0)
void fillColor(const Color &fillColor_)
void scale(const Geometry &geometry_)
void size(const Geometry &geometry_)
void draw(const Drawable &drawable_)
void randomThreshold(const double low_, const double high_)
void evaluate(const ChannelType channel_, const MagickEvaluateOperator operator_, double rvalue_)
void implode(const double factor_)
void addNoiseChannel(const ChannelType channel_, const NoiseType noiseType_, const double attenuate_=1.0)
void wave(const double amplitude_=25.0, const double wavelength_=150.0)
void threshold(const double threshold_)
void convolve(const size_t order_, const double *kernel_)
void roll(const Geometry &roll_)
void gaussianBlurChannel(const ChannelType channel_, const double radius_, const double sigma_)
void transparent(const Color &color_, const bool inverse_=false)
void alpha(const bool alphaFlag_)
void border(const Geometry &geometry_=borderGeometryDefault)
void addNoise(const NoiseType noiseType_, const double attenuate_=1.0)
size_t columns(void) const
void quantizeColors(const size_t colors_)
void levelChannel(const ChannelType channel_, const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
void channel(const ChannelType channel_)
MagickPPExport void InitializeMagick(const char *path_)
int main(int, char **argv)
void backgroundColor(const Color &color_)
void quantizeDither(const bool ditherFlag_)
void level(const double blackPoint_, const double whitePoint_, const double gamma_=1.0)
void quantizeColorSpace(const ColorspaceType colorSpace_)
void shear(const double xShearAngle_, const double yShearAngle_)
void rotate(const double degrees_)