This commit introduces `Rectangle.irregularGrid`, enabling the creation of grids with irregular spacing based on weights. New helper methods and properties for 2D rectangle lists, such as subgrid selection, bounds calculation, and random access, are also added. Additionally, two new demos showcase regular and irregular grid features.
31 lines
931 B
Kotlin
31 lines
931 B
Kotlin
package text
|
|
|
|
import org.openrndr.application
|
|
import org.openrndr.color.ColorRGBa
|
|
import org.openrndr.draw.font.loadFace
|
|
import org.openrndr.extra.shapes.bounds.bounds
|
|
import org.openrndr.extra.shapes.text.shapesFromText
|
|
import org.openrndr.internal.Driver
|
|
|
|
fun main() = application {
|
|
System.setProperty("org.openrndr.draw.wait_for_finish", "true")
|
|
configure {
|
|
width = 720
|
|
height = 720
|
|
}
|
|
program {
|
|
|
|
val face =
|
|
loadFace("https://github.com/IBM/plex/raw/master/packages/plex-mono/fonts/complete/otf/IBMPlexMono-Bold.otf")
|
|
val shapes = shapesFromText(face, "SUCH\nVECTOR\nSUCH\nTEXT", 150.0)
|
|
|
|
val bounds = shapes.bounds
|
|
extend {
|
|
drawer.clear(ColorRGBa.PINK)
|
|
drawer.translate(-bounds.corner)
|
|
drawer.translate((width - bounds.width) / 2.0, (height - bounds.height) / 2.0)
|
|
drawer.shapes(shapes)
|
|
}
|
|
}
|
|
}
|