ShearTransform() public method

Applies the specified shearing operation to the transformation matrix of this object by prepending it to the object's transformation matrix.
public ShearTransform ( double shearX, double shearY ) : void
shearX double
shearY double
return void
Example #1
0
    /// <summary>
    /// Draws an image transformed.
    /// </summary>
    void DrawImageSheared(XGraphics gfx, int number)
    {
      BeginBox(gfx, number, "DrawImage (sheared)");

      XImage image = XImage.FromFile(jpegSamplePath);

      const double dx = 250, dy = 140;

      //XMatrix matrix = gfx.Transform;
      //matrix.TranslatePrepend(dx / 2, dy / 2);
      //matrix.ScalePrepend(-0.7, 0.7);
      //matrix.ShearPrepend(-0.4, -0.3);
      //matrix.TranslatePrepend(-dx / 2, -dy / 2);
      //gfx.Transform = matrix;

      gfx.TranslateTransform(dx / 2, dy / 2);
      gfx.ScaleTransform(-0.7, 0.7);
      gfx.ShearTransform(-0.4, -0.3);
      gfx.TranslateTransform(-dx / 2, -dy / 2);

      double width = image.PixelWidth * 72 / image.HorizontalResolution;
      double height = image.PixelHeight * 72 / image.HorizontalResolution;

      gfx.DrawImage(image, (dx - width) / 2, 0, width, height);

      EndBox(gfx);
    }