C# Class SIL.FieldWorks.SharpViews.PaintTransform

A PaintTransform is used when actually painting boxes, or performing similar opertions like hit testing that depend on actual drawing coordinates. The first four constructor arguments are the same as for the base class, and should be the same as the most recent layout operation performed on the box to which the transform is passed. See LayoutTransform for doc. The next four arguments give the resolution at which drawing is actually done, and, in paint pixels, another offset. Typically this offset represents the amount by which the view is scrolled. Conceptually they are the distance that the top left of the view is above and left of the top left of the area in which it is drawn. This means that, after a position relative to the top left of the view is computed as the place to draw something, to convert to paint coordinates we multiply by the ratio of dpiXPaint/dpiXLayout, then subtract dxScroll...and similarly for Y.
Inheritance: LayoutTransform
Show file Open project: sillsdev/FieldWorks Class Usage Examples

Private Properties

Property Type Description
ConvertToPaint Point
ConvertToPaint Rect
FromSourceAndDest PaintTransform
ToPaint Rect

Public Methods

Method Description
PaintTransform ( int dxLayout, int dyLayout, int dpiXLayout, int dpiYLayout, int dxScroll, int dyScroll, int dpiXPaint, int dpiYPaint ) : System
PaintTransformOffsetBy ( int dx, int dy ) : PaintTransform

Answer a layout transform (actually a PaintTransform) suitable for a child box whose left and top are dx and dy.

ToLayout ( Point paintPoint ) : Point

Convert a point in paint coordinates to one relative to the box that uses this transformation.

ToLayoutX ( int x ) : int

Convert an X coordinate from paint to layout coords.

ToPaint ( Point layout ) : Point

Convert a complete point to Painting coordinates (not yet tested)

ToPaint ( Rectangle rLayout ) : Rectangle

Convert a rectangle relative to the box for which this transform is configured to one in paint coordinates. Todo: tests and implementation of differing DPI and non-zero ScrollOffset.

ToPaintX ( int xs ) : int

Convert a position relative to the box for which this is the transform to one in paint coordinates. Todo: tests and implementation of differing DPI and non-zero ScrollOffset.

ToPaintY ( int ys ) : int

Convert a position relative to the box for which this is the transform to one in paint coordinates. Todo: tests and implementation of differing DPI and non-zero ScrollOffset.

Private Methods

Method Description
ConvertToPaint ( Point source, Rect srcRect, Rect dstRect ) : Point

Currently not used: given a point in destination coordinates and two rectangles such as are returned by SourceRect and DestRect, generate the point (ToPaintX(source.X), ToPaintY(source.Y)) that would be returned by a transformation represented by that transformation. (not yet used or tested)

ConvertToPaint ( Rect source, Rect srcRect, Rect dstRect ) : Rect

Currently only used in testing: given a point in destination coordinates and two rectangles such as are returned by SourceRect and DestRect, generate the point (ToPaintX(source.X), ToPaintY(source.Y)) that would be returned by a transformation represented by that transformation. (not yet used or tested)

FromSourceAndDest ( Rect srcRect, Rect dstRect ) : PaintTransform

Return the PaintTransform that would produce the indicated Source and Dest Rects.

ToPaint ( Rect rLayout ) : Rect

Convert a rect relative to the box for which this transform is configured to one in paint coordinates. Todo: tests and implementation of differing DPI and non-zero ScrollOffset. Currently only used in making test data.

Method Details

PaintTransform() public method

public PaintTransform ( int dxLayout, int dyLayout, int dpiXLayout, int dpiYLayout, int dxScroll, int dyScroll, int dpiXPaint, int dpiYPaint ) : System
dxLayout int
dyLayout int
dpiXLayout int
dpiYLayout int
dxScroll int
dyScroll int
dpiXPaint int
dpiYPaint int
return System

PaintTransformOffsetBy() public method

Answer a layout transform (actually a PaintTransform) suitable for a child box whose left and top are dx and dy.
public PaintTransformOffsetBy ( int dx, int dy ) : PaintTransform
dx int
dy int
return PaintTransform

ToLayout() public method

Convert a point in paint coordinates to one relative to the box that uses this transformation.
public ToLayout ( Point paintPoint ) : Point
paintPoint Point
return Point

ToLayoutX() public method

Convert an X coordinate from paint to layout coords.
public ToLayoutX ( int x ) : int
x int
return int

ToPaint() public method

Convert a complete point to Painting coordinates (not yet tested)
public ToPaint ( Point layout ) : Point
layout Point
return Point

ToPaint() public method

Convert a rectangle relative to the box for which this transform is configured to one in paint coordinates. Todo: tests and implementation of differing DPI and non-zero ScrollOffset.
public ToPaint ( Rectangle rLayout ) : Rectangle
rLayout System.Drawing.Rectangle
return System.Drawing.Rectangle

ToPaintX() public method

Convert a position relative to the box for which this is the transform to one in paint coordinates. Todo: tests and implementation of differing DPI and non-zero ScrollOffset.
public ToPaintX ( int xs ) : int
xs int
return int

ToPaintY() public method

Convert a position relative to the box for which this is the transform to one in paint coordinates. Todo: tests and implementation of differing DPI and non-zero ScrollOffset.
public ToPaintY ( int ys ) : int
ys int
return int