public Shear ( float shearX, float shearY ) : void | ||
shearX | float | |
shearY | float | |
return | void |
// Initialize the matrix to be sheared Matrix myMatrix = new Matrix(1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F); // Perform shear transformation myMatrix.Shear(0.5F, 0.0F); // Use the matrix to draw an ellipse Ellipse ellipse = new Ellipse(0, 0, 100, 50); GraphicsPath path = new GraphicsPath(); path.AddEllipse(ellipse); path.Transform(myMatrix); // Draw the transformed ellipse onto the screen Pen pen = new Pen(Color.Black, 2); Graphics gr = this.CreateGraphics(); gr.DrawPath(pen, path);In this example, the matrix is sheared by 0.5F in the X direction and no shear is applied in the Y direction. An ellipse is then drawn by creating a GraphicsPath and adding an Ellipse object to it. The GraphicsPath's Transform method is called with the sheared matrix as the argument and the transformed ellipse is drawn onto the screen using a Pen object. This method is part of the System.Drawing.Drawing2D namespace and is found in the System.Drawing.dll library.