autoscaling-image-gadget
Scaling images in a gadget

Prev:scaling-image-gadget


Vocabulary
images.viewer.scaling

Class description
Allows auto-sizing an image to the scale of a root gadget (like a scroller or world).

fillIf f, the image will retain original dimenions.

If a number from 0 to 1 (can also multiply with numbers above 1 to exceed the visible dimensions of the viewport), the image will contain itself to that fraction of the occupied viewport (for example, giving the fill slot a 1 will ensure the image is as large as possible within the viewport without changing its aspect ratio or exceeding the viewport size along either dimension).

If a pair, like { 0.5 f }, the image will stretch to fill half the width of the viewport while the empty y scale will be inferred according to aspect ratio.

Similarly, { f 0.75 } will fill three-quarters of the height of the viewport while the width is inferred by aspect ratio.

A pair with both axes specified will ignore aspect ratio, for example, { 1 1 } can be given to fill the occupied viewport by stretching the image outside of aspect ratio bounds.

{ f f } will infer both axes such that the viewport is always covered by the image (exceeding visible bounds where necessary), maintaining aspect ratio.



Definition


Methods