[Home]ToDo/0.5.0/Rect

Unit conversion methods

Here's some ideas for the conversion methods. One possible (at least I belive it is possible... ;) ) solution would involve creating the following methods:

Rect Rect::Scale( const Point &cFromScale, const Point &cToScale ) - Scale Rect's dimensions and return a scaled Rect object. The scale is specified as Point value, or is chosen from one of the predefined scales:
DM_PIXEL
DM_POINT
DM_CM
DM_INCH
(etc.)

const Point& View::GetDPI() - Returns DPI value for the display a View object belongs to. (be it a monitor, a printer, a file or whatever you might want to scale something to.)

Point Point::operator*( const Point & ) - Multiplies x values and y values of two Points. (X = X1 * X2, Y = Y1 * Y2)

Examples

1 Rect cRect1( 10, 10, 10 10 ), cRect2; 2 3 cRect2 = cRect1.Scale( DM_PIXEL * pcView->GetDPI(), DM_CM );

Discussion

Editing is temporarily disabled!

Syllable | ToDo | Changes | Preferences | Search
This page is read-only | View other revisions
Last edited September 6, 2003 18:37 (diff)
Not logged in | Login | New User