[orx-image-fit] Add source and target rectangle return values to Drawer.imageFit
This commit is contained in:
@@ -21,8 +21,8 @@ fun fitRectangle(
|
|||||||
val sourceWidth = src.width
|
val sourceWidth = src.width
|
||||||
val sourceHeight = src.height
|
val sourceHeight = src.height
|
||||||
|
|
||||||
var targetX: Double
|
val targetX: Double
|
||||||
var targetY: Double
|
val targetY: Double
|
||||||
var targetWidth: Double
|
var targetWidth: Double
|
||||||
var targetHeight: Double
|
var targetHeight: Double
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ fun Drawer.imageFit(
|
|||||||
horizontalPosition: Double = 0.0,
|
horizontalPosition: Double = 0.0,
|
||||||
verticalPosition: Double = 0.0,
|
verticalPosition: Double = 0.0,
|
||||||
fitMethod: FitMethod = FitMethod.Cover
|
fitMethod: FitMethod = FitMethod.Cover
|
||||||
) {
|
): Pair<Rectangle, Rectangle> {
|
||||||
val (source, target) = fitRectangle(
|
val (source, target) = fitRectangle(
|
||||||
img.bounds,
|
img.bounds,
|
||||||
Rectangle(x, y, width, height),
|
Rectangle(x, y, width, height),
|
||||||
@@ -109,4 +109,5 @@ fun Drawer.imageFit(
|
|||||||
)
|
)
|
||||||
|
|
||||||
image(img, source, target)
|
image(img, source, target)
|
||||||
|
return Pair(source, target)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user