TAgg2D.WorldToScreen(scalar): double
Description
Transforms the length in world (user) units into the length in surface (screen) units.
This method can be used to find out how many subpixels takes some length in final rendering. When developer compares input length with output length, the result is the zoom ratio (from definition to screen).
Parameters
scalar: double
Length in units of world (user) system [in subpixels].
Returns
Returned is the length in units of screen (surface) system [in subpixels].
Example
var l: double; begin if VG.Attach(Image1.Picture.Bitmap) then begin VG.ClearAll(255, 255, 255); // Coordinates system shift (on X + 2, on Y + 2) VG.Translate(2, 2); // "l" is still the same (10), because coordinate system // zoom ratio is not affected by previous translation l := VG.WorldToScreen(10); // Coordinates system scale up by 2x VG.Scale(2, 2); // Now "l" is double (20), because previous up-scale // changed the coordinate system zoom ratio by 2x l := VG.WorldToScreen(10); end; end;
Remarks
It might seem confusing that both world (user) and screen (surface) coordinates are referred here as [in subpixels].
Developer has to realize that everything defined in drawing routine is [in subpixels] and when there are no transformations explicitely defined, output on screen is being rendered in 1:1 transformations (everything gets drawn in the same [subpixels]).
After defining some additional transformations (like up/down scaling, rotation, skew, ...) the location and dimension of objects will be different from original definition, but the values are still being computed [in subpixels].
Coordinates transformations changes positions and dimensions / lengths, but units still remains the same [subpixels].


