commonMain.org.jetbrains.letsPlot.skia.shape.Rectangle.kt Maven / Gradle / Ivy
/*
* Copyright (c) 2023 JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/
package org.jetbrains.letsPlot.skia.shape
import org.jetbrains.skia.Canvas
import org.jetbrains.skia.Rect
internal class Rectangle : Figure() {
var x: Float by visualProp(0.0f)
var y: Float by visualProp(0.0f)
var width: Float by visualProp(0.0f)
var height: Float by visualProp(0.0f)
private val rect: Rect by computedProp(Rectangle::x, Rectangle::y, Rectangle::width, Rectangle::height) {
Rect.makeXYWH(x, y, width, height)
}
override fun render(canvas: Canvas) {
fillPaint?.let { canvas.drawRect(rect, it) }
strokePaint?.let { canvas.drawRect(rect, it) }
}
override val localBounds: Rect
get() = Rect.makeXYWH(x, y, width, height)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy