This source file includes following definitions.
- main
#include <Magick++.h>
#include <string>
#include <iostream>
using namespace std;
using namespace Magick;
int main( int , char ** argv)
{
InitializeMagick(*argv);
try {
string srcdir("");
if(getenv("SRCDIR") != 0)
srcdir = getenv("SRCDIR");
Image image( "300x300", "white" );
std::list<Magick::Drawable> drawList;
drawList.push_back(DrawablePushGraphicContext());
drawList.push_back(DrawableViewbox(0,0,image.columns(),image.rows()));
drawList.push_back(DrawableStrokeColor("#ccf"));
for ( int i=0; i < 300; i += 10 )
{
drawList.push_back(DrawableLine(i,0, i,300));
drawList.push_back(DrawableLine(0,i, 300,i));
}
drawList.push_back(DrawableFillColor("blue"));
drawList.push_back(DrawableStrokeColor("red"));
drawList.push_back(DrawableRoundRectangle(15,15, 70,70, 10,10));
drawList.push_back(DrawableFillColor("blue"));
drawList.push_back(DrawableStrokeColor("maroon"));
drawList.push_back(DrawableStrokeWidth(4));
drawList.push_back(DrawableRoundRectangle(15,15, 70,70, 10,10));
{
drawList.push_back(DrawableStrokeColor("black"));
drawList.push_back(DrawableStrokeWidth(4));
drawList.push_back(DrawableFillColor(Color()));
std::list<Magick::Coordinate> points;
points.push_back(Coordinate(20,20));
points.push_back(Coordinate(100,50));
points.push_back(Coordinate(50,100));
points.push_back(Coordinate(160,160));
drawList.push_back(DrawableBezier(points));
}
{
const double dash_array[] = {4.0, 3.0, 0.0};
drawList.push_back(DrawableDashArray(dash_array));
drawList.push_back(DrawableStrokeColor("red"));
drawList.push_back(DrawableStrokeWidth(1));
drawList.push_back(DrawableLine(10,200, 54,182));
drawList.push_back(DrawableDashArray((double *) 0));
}
drawList.push_back(DrawableStrokeColor("black"));
drawList.push_back(DrawableFillColor("yellow"));
drawList.push_back(DrawableStrokeWidth(4));
drawList.push_back(DrawableCircle(160,70, 200,70));
drawList.push_back(DrawableStrokeColor("black"));
drawList.push_back(DrawableFillColor("blue"));
drawList.push_back(DrawableStrokeWidth(4));
{
std::list<VPath> path;
path.push_back(PathMovetoAbs(Coordinate(160,70)));
path.push_back(PathLinetoVerticalRel(-40));
path.push_back(PathArcRel(PathArcArgs(40,40, 0, 0, 0, -40,40)));
path.push_back(PathClosePath());
drawList.push_back(DrawablePath(path));
}
{
drawList.push_back(DrawableStrokeColor("red"));
drawList.push_back(DrawableFillColor("LimeGreen"));
drawList.push_back(DrawableStrokeWidth(3));
std::list<Magick::Coordinate> points;
points.push_back(Coordinate(160,120));
points.push_back(Coordinate(130,190));
points.push_back(Coordinate(210,145));
points.push_back(Coordinate(110,145));
points.push_back(Coordinate(190,190));
points.push_back(Coordinate(160,120));
drawList.push_back(DrawablePolygon(points));
}
drawList.push_back(DrawableStrokeWidth(5));
drawList.push_back(DrawableFillColor(Color()));
drawList.push_back(DrawableStrokeColor("yellow"));
drawList.push_back(DrawableLine(200,260, 200,200));
drawList.push_back(DrawableLine(200,200, 260,200));
drawList.push_back(DrawableStrokeColor("red"));
drawList.push_back(DrawableLine(260,200, 260,260));
drawList.push_back(DrawableStrokeColor("green"));
drawList.push_back(DrawableLine(200,260, 260,260));
drawList.push_back(DrawableFillColor("green"));
drawList.push_back(DrawableStrokeColor(Color()));
drawList.push_back(DrawablePointSize(24));
drawList.push_back(DrawableTranslation(30,140));
drawList.push_back(DrawableRotation(45.0));
drawList.push_back(DrawableText(0,0,"This is a test!"));
drawList.push_back(DrawablePopGraphicContext());
image.draw(drawList);
cout << "Writing image \"piddle_out.miff\" ..." << endl;
image.depth( 8 );
image.compressType( RLECompression );
image.write( "piddle_out.miff" );
cout << "Writing MVG metafile \"piddle_out.mvg\" ..." << endl;
image.write( "piddle_out.mvg" );
}
catch( exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
return 0;
}