Click or drag to resize

BasePluginCameraCalcCenteredPicturePositionInCanvas Method

Given are two rectangles, representing a (bigger) canvas and a (smaller) picture; the last one has to be put centered into the canvas and needs to be scaled to fit into the canvas, but without changing its aspect ratio.

Namespace: RAYLASE.Marker.CamerasPlugin
Assembly: RAYLASE.Marker.CamerasPlugin (in RAYLASE.Marker.CamerasPlugin.dll) Version: 2.19.0
Syntax
C#
public static (dvec2 pos, dvec2 size) CalcCenteredPicturePositionInCanvas(
	double pictureWidth,
	double pictureHeight,
	double canvasWidth,
	double canvasHeight
)

Parameters

pictureWidth  Double
The width of the rectangle.
pictureHeight  Double
The height of the rectangle.
canvasWidth  Double
The width of the canvas.
canvasHeight  Double
The height of the canvas.

Return Value

ValueTupledvec2, dvec2
A duple containing the pixel position where the picture is to be put into the canvas and the size of the rectangle to be put into the canvas.
See Also