Image im( Geometry(width, height), Color(QuantumRange, QuantumRange, QuantumRange, 0)); im.strokeColor("red"); im.strokeWidth(2); im.draw ( DrawableLine(10,10,width-10,height-10)); im.strokeColor("blue"); im.strokeWidth(1); for (int i=1;i<c3-1;i++) { int ix1=(int)(pM[i+1].x67-min67x); int iy1=(int) height-(pM[i+1].y67-min67y); int ix2=(int)(pM[i+2].x67-min67x); int iy2=(int)height-(pM[i+2].y67-min67y); im.draw ( DrawableLine(ix1,iy1,ix2,iy2)); }
im.write("1b.JPG"); }
DrawableFont font = DrawableFont("Helvetica Narrow",
NormalStyle,
400,
SemiCondensedStretch
);
text_draw_list.push_back(font);
text_draw_list.push_back(DrawableText(101, 50, "text to write on the canvas"));
text_draw_list.push_back(DrawableStrokeColor(Color("black")));
text_draw_list.push_back(DrawableFillColor(Color(0, 0, 0, MaxRGB)));
my_image.draw(text_draw_list);
Image my_image( Geometry(320,220), Color("white")); // set the text rendering font (the color is determined by the "current" image setting) my_image.font("-*-bitstream charter-medium-r-normal-*-*-*-*-*-*-*-iso8859-1");
my_image.annotate("NorthWest gravity annotation", NorthWestGravity); my_image.annotate("SouthEast gravity annotation", SouthEastGravity); my_image.annotate("Center gravity annotation", CenterGravity);
// Example: Image my_image( Geometry(320,220), Color("white")); list<Drawable> text_draw_list; // set the text font: the font is specified via a string representing // a fully qualified X font name (wildcards '*' are allowed) text_draw_list.push_back( DrawableFont("-misc-fixed-medium-o-semicondensed—13-*-*-*-c-60-iso8859-1")); // set the text to be drawn at specified position: x=101, y=50 this case text_draw_list.push_back( DrawableText(101, 50, "text to write on the canvas")); // set the text color (the fill color must be set to transparent) text_draw_list.push_back( DrawableStrokeColor(Color("black"))); text_draw_list.push_back( DrawableFillColor(Color(0, 0, 0, QuantumRange))); // draw the "text to write on the canvas" string on the canvas with the above settings my_image.draw( text_draw_list); // Note: the red marking point in below image is located at position (100,50)
Image monimage("test.jpg"); // Draw a text with annotate monimage.font("@Arial"); monimage.boxColor("red"); monimage.backgroundColor("white"); monimage.fontPointsize( 72); monimage.strokeColor("black"); monimage.fillColor( "gold" ); monimage.annotate( "Text Sample with annotate", NorthGravity ); // Draw a text with draw monimage.draw(DrawableFont("@Arial")); monimage.draw(DrawableStrokeColor("black")); monimage.draw(DrawableFillColor(Color(0, 0, 0, MaxRGB))); monimage.draw(DrawableTextUnderColor("white")); monimage.draw(DrawableText(150,150,"Text Sample with draw")); // Draw a rectangle monimage.draw( Magick::DrawableRectangle(200,200, 270,170) ); monimage.write("resultat.jpg");
|