DrawSkewY oddity in 6.5.4-0
Posted: 2009-07-02T14:08:53-07:00
The following program tries to replicate the SVG "Skew" example here http://www.w3.org/TR/SVG11/coords.html# ... rixDefined, but the X axis in the skewY coordinate system is wrong. Here's the target image:
Here's the output from my test:
Here's the program I used to create the image. Please let me know if you need any more information.
Here's the output from my test:
Here's the program I used to create the image. Please let me know if you need any more information.
Code: Select all
// gcc `MagickWand-config --cflags --cppflags` -o skew skew.c `MagickWand-config --ldflags --libs`
#include <stdio.h>
#include <stdlib.h>
#include <wand/MagickWand.h>
int main(int argc, char **argv)
{
MagickWand *wand;
DrawingWand *drawing;
PixelWand *none, *white, *black, *red, *blue;
MagickWandGenesis();
none = NewPixelWand();
PixelSetColor(none, "none");
red = NewPixelWand();
PixelSetColor(red, "red");
black = NewPixelWand();
PixelSetColor(black, "black");
white = NewPixelWand();
PixelSetColor(white, "white");
blue = NewPixelWand();
PixelSetColor(blue, "blue");
drawing = NewDrawingWand();
// Draw the axes of the original coordinate system.
PushDrawingWand(drawing);
DrawSetFillColor(drawing, none);
DrawSetStrokeColor(drawing, black);
DrawSetStrokeWidth(drawing, 3.0);
DrawLine(drawing, 0.0, 1.5, 400.0, 1.5);
DrawLine(drawing, 1.5, 0.0, 1.5, 120.0);
PopDrawingWand(drawing);
// Establish a new coordinate system whose origin is at (30,30) in the
// initial coord. system and which is skewed in X by 30 degrees.
PushDrawingWand(drawing);
DrawTranslate(drawing, 30.0, 30.0);
DrawSkewX(drawing, 30.0);
PushDrawingWand(drawing);
DrawSetFillColor(drawing, none);
DrawSetStrokeColor(drawing, red);
DrawSetStrokeWidth(drawing, 3.0);
DrawLine(drawing, 0.0, 0.0, 50.0, 0.0);
DrawLine(drawing, 0.0, 0.0, 0.0, 50.0);
PopDrawingWand(drawing);
PushDrawingWand(drawing);
DrawSetFontFamily(drawing, "Verdana");
DrawSetFontSize(drawing, 20.0);
DrawSetFontWeight(drawing, 400ul);
DrawSetFontStyle(drawing, NormalStyle);
DrawSetFillColor(drawing, blue);
DrawSetStrokeColor(drawing, none);
DrawAnnotation(drawing, 0.0, 0.0, "ABC (skewX)");
PopDrawingWand(drawing);
PopDrawingWand(drawing);
// Establish a new coordinate system whose origin is at (200, 30) in the
// initial coord. system and which is skewed in Y by 30 degrees.
PushDrawingWand(drawing);
DrawTranslate(drawing, 200.0, 30.0);
DrawSkewY(drawing, 30.0);
PushDrawingWand(drawing);
DrawSetFillColor(drawing, none);
DrawSetStrokeColor(drawing, red);
DrawSetStrokeWidth(drawing, 3.0);
DrawLine(drawing, 0.0, 0.0, 50.0, 0.0);
DrawLine(drawing, 0.0, 0.0, 0.0, 50.0);
PopDrawingWand(drawing);
PushDrawingWand(drawing);
DrawSetFontFamily(drawing, "Verdana");
DrawSetFontSize(drawing, 20.0);
DrawSetFontWeight(drawing, 400ul);
DrawSetFontStyle(drawing, NormalStyle);
DrawSetFillColor(drawing, blue);
DrawSetStrokeColor(drawing, none);
DrawAnnotation(drawing, 0.0, 0.0, "ABC (skewY)");
PopDrawingWand(drawing);
PopDrawingWand(drawing);
wand = NewMagickWand();
MagickNewImage(wand, 400, 120, white);
MagickDrawImage(wand, drawing);
MagickWriteImage(wand, "Skew.gif");
DestroyDrawingWand(drawing);
DestroyMagickWand(wand);
DestroyPixelWand(none);
DestroyPixelWand(blue);
DestroyPixelWand(white);
DestroyPixelWand(black);
DestroyPixelWand(red);
MagickWandTerminus();
}