Table of Contents

Method Transform

Namespace
OpenCAD2D
Assembly
OpenCAD2D.Rendering.dll

Transform(CadDocument, CadRenderOptions)

Gives the matrix from the drawing to the pixels of the picture Draw(CadDocument, CadRenderOptions) makes for the same options: the very view the renderer draws by, nine numbers of a 3 by 3 row by row, [a, c, e, b, d, f, 0, 0, 1], so that a point (x, y) of the space is at the pixel position (a x + c y + e, b x + d y + f). Pixel (column, row) is the square from (column, row) to (column + 1, row + 1), row 0 at the top and y of the drawing upward, so the pixel a point falls in is the floor of both numbers and the centre of a pixel is at column + 0.5. For a drawing 400 by 300 whose extents are drawn at 1 600 by 1 200 pixels with the margin ZOOM Extents leaves (a scale of 3.6), the point (0, 0) is at (80, 1 140) and (400, 300) at (1 520, 60). On a layout it maps the paper in millimetres; the model entities a viewport shows have the viewport's own matrix on top, which is not given here. The inverse is the matrix inverted.

public static double[] Transform(CadDocument document, CadRenderOptions options)

Parameters

document CadDocument

The drawing.

options CadRenderOptions

The space, the part, the size and the ground; null for the defaults.

Returns

double[]

The nine numbers.

Exceptions

ArgumentNullException

Thrown when the document is null.

ArgumentException

Thrown for the options Draw(CadDocument, CadRenderOptions) refuses.