C# Class SIL.FieldWorks.SharpViews.LayoutTransform

A LayoutTransform contains the information that a Box needs to transform points in its own coordinate system (or possibly its container's coordinate system) into points relative to the view as a whole. This class is immutable; if you need a different one, make a new one.
Mostrar archivo Open project: sillsdev/FieldWorks Class Usage Examples

Private Properties

Property Type Description
InitializeOnlyOffsetBy void
MulDiv int
MulDivNotToZero int

Public Methods

Method Description
LayoutTransform ( int dx, int dy, int dpiX, int dpiY ) : System

This constructor makes a transform suitable for a box whose top left is dx below and dy to the right of the top left of the whole view area, and which will be laid out as if for a device resolution of dpiX pixels per inch horizontally and dpiY vertically.

MpToBorderPixelsX ( int mp ) : int

Convert a border width in mp to pixels. Should not answer zero unless mp is zero.

MpToBorderPixelsY ( int mp ) : int

Convert a border height in mp to pixels. Should not answer zero unless mp is zero.

MpToPixelsX ( int mp ) : int

Transform a distance in millipoints (72,000 per inch) into pixels in the X direction.

MpToPixelsY ( int mp ) : int

Transform a distance in millipoints (72,000 per inch) into pixels in the X direction.

OffsetBy ( int dx, int dy ) : LayoutTransform

Answer a layout transform suitable for a child box whose left and top are dx and dy. (Keep InitializeOnlyOffsetBy consistent with this.)

ToRoot ( Point p ) : Point

Converts a Point in box coordinates to whole-view coordinates.

Private Methods

Method Description
InitializeOnlyOffsetBy ( int dx, int dy ) : void

This method is internal only because I definitely don't want it as public as 'protected'. It should ONLY be used by subclass methods constructing copies offset by the specified amount.

MulDiv ( int mp, int dpi, int div ) : int

Multiply the first two arguments and divide by the third. Assume the result will not overflow, but the intermediate product may be larger than an int. Round to the closest integer result. Assumes div is not zero.

MulDivNotToZero ( int mp, int dpi, int div ) : int

Multiply the first two arguments and divide by the third. Assume the result will not overflow, but the intermediate product may be larger than an int. Round to the closest integer result, except that the result must not be zero unless the first argument is zero.

Method Details

LayoutTransform() public method

This constructor makes a transform suitable for a box whose top left is dx below and dy to the right of the top left of the whole view area, and which will be laid out as if for a device resolution of dpiX pixels per inch horizontally and dpiY vertically.
public LayoutTransform ( int dx, int dy, int dpiX, int dpiY ) : System
dx int
dy int
dpiX int
dpiY int
return System

MpToBorderPixelsX() public method

Convert a border width in mp to pixels. Should not answer zero unless mp is zero.
public MpToBorderPixelsX ( int mp ) : int
mp int
return int

MpToBorderPixelsY() public method

Convert a border height in mp to pixels. Should not answer zero unless mp is zero.
public MpToBorderPixelsY ( int mp ) : int
mp int
return int

MpToPixelsX() public method

Transform a distance in millipoints (72,000 per inch) into pixels in the X direction.
public MpToPixelsX ( int mp ) : int
mp int
return int

MpToPixelsY() public method

Transform a distance in millipoints (72,000 per inch) into pixels in the X direction.
public MpToPixelsY ( int mp ) : int
mp int
return int

OffsetBy() public method

Answer a layout transform suitable for a child box whose left and top are dx and dy. (Keep InitializeOnlyOffsetBy consistent with this.)
public OffsetBy ( int dx, int dy ) : LayoutTransform
dx int
dy int
return LayoutTransform

ToRoot() public method

Converts a Point in box coordinates to whole-view coordinates.
public ToRoot ( Point p ) : Point
p Point
return Point