public override NMatrix Calibrate(NPaintVisitor visitor, double imgWidth, double imgHeight, NRectangle targetRect) { // Initialize the image transform NMatrix matrix = NMatrix.Identity; // Scale the image so that it fits 2 times in width and 3 times in height matrix.Scale( NCustomTextureMappingExample.RectWidth / (2.0 * imgWidth), NCustomTextureMappingExample.RectHeight / (3.0 * imgHeight)); // Rotate the image to the specified angle matrix.Rotate(m_TextureMapping.TextureAngle * NAngle.Degree2Rad); // Translate the image to the specfied pin point matrix.Translate(m_TextureMapping.PinPoint.X, m_TextureMapping.PinPoint.Y); return(matrix); }