Package-level declarations

Types

Link copied to clipboard

Available object-fit methods (borrowed from CSS)

Functions

Link copied to clipboard
fun Rectangle.fit(dest: Rectangle, horizontalPosition: Double = 0.0, verticalPosition: Double = 0.0, fitMethod: FitMethod = FitMethod.Cover): Matrix44

Helper function that calls fitRectangle and returns a Matrix44 instead of a Pair<Rectangle, Rectangle>. The returned matrix can be used to draw scaled Shape or ShapeContour objects.

Link copied to clipboard
fun fitRectangle(src: Rectangle, dest: Rectangle, horizontalPosition: Double = 0.0, verticalPosition: Double = 0.0, fitMethod: FitMethod = FitMethod.Cover): Pair<Rectangle, Rectangle>

Transforms src and dest into a Pair in which one of the two rectangles is modified to conform with the fitMethod. It uses horizontalPosition and verticalPosition to control positioning / cropping.

Link copied to clipboard
fun Drawer.imageFit(img: ColorBuffer, bounds: Rectangle = img.bounds, horizontalPosition: Double = 0.0, verticalPosition: Double = 0.0, fitMethod: FitMethod = FitMethod.Cover): Pair<Rectangle, Rectangle>

Draws img into the bounding box defined by bounds using the specified fitMethod and aligned or cropped using horizontalPosition and verticalPosition.

fun Drawer.imageFit(img: ColorBuffer, x: Double = 0.0, y: Double = 0.0, width: Double = img.width.toDouble(), height: Double = img.height.toDouble(), horizontalPosition: Double = 0.0, verticalPosition: Double = 0.0, fitMethod: FitMethod = FitMethod.Cover): Pair<Rectangle, Rectangle>

Draws img into the bounding box defined by x, y, width and height using the specified fitMethod and aligned or cropped using horizontalPosition and verticalPosition.

Link copied to clipboard
fun Drawer.imageFitSub(img: ColorBuffer, source: Rectangle = img.bounds, target: Rectangle = this.bounds, horizontalPosition: Double = 0.0, verticalPosition: Double = 0.0, fitMethod: FitMethod = FitMethod.Cover): Pair<Rectangle, Rectangle>

Draws a subsection of the given image into a target rectangle within the current Drawer bounds, using the specified fit method and alignment.