Unverified Commit a4a1af99 authored by Nikolay Igotti's avatar Nikolay Igotti Committed by GitHub

Update README.md

parent bb735606
...@@ -4,83 +4,7 @@ ...@@ -4,83 +4,7 @@
Skiko (short for Skia for Kotlin) is the graphical library exposing significant part Skiko (short for Skia for Kotlin) is the graphical library exposing significant part
of [Skia library](https://skia.org) APIs to Kotlin, along with the gluing code for rendering context. of [Skia library](https://skia.org) APIs to Kotlin, along with the gluing code for rendering context.
At the moment, Linux(x86_64), Windows(x86_64) and macOS(x86_64) builds for Kotlin/JVM are available. At the moment, Linux(x86_64), Windows(x86_64) and macOS(x86_64 and arm64) builds for Kotlin/JVM are available.
Using the library from Kotlin is as simple as:
```kotlin
fun main(args: Array<String>) {
SkiaWindow().apply {
layer.renderer = Renderer { renderer, w, h ->
val canvas = renderer.canvas!!
val paint1 = Paint().setColor(0xffff0000.toInt()) // ARGB
canvas.drawRRect(RRect.makeLTRB(10f, 10f, w - 10f, h - 10f, 5f), paint1)
val paint2 = Paint().setColor(0xff00ff00.toInt()) // ARGB
canvas.drawRRect(RRect.makeLTRB(30f, 30f, w - 30f, h - 30f, 10f), paint2)
}
setVisible(true)
setSize(800, 600)
}
}
class Renderer(val displayScene: (Renderer, Int, Int) -> Unit): SkiaRenderer {
val paint = Paint().apply {
setColor(0xff9BC730L.toInt())
setMode(PaintMode.FILL)
setStrokeWidth(1f)
}
var canvas: Canvas? = null
override fun onInit() {
}
override fun onDispose() {
}
override fun onReshape(width: Int, height: Int) {
}
override fun onRender(canvas: Canvas, width: Int, height: Int) {
this.canvas = canvas
displayScene(this, width, height)
}
}
```
With the following `build.gradle`:
```groovy
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
id 'application'
}
repositories {
mavenLocal()
maven {
url 'https://maven.pkg.jetbrains.space/public/p/compose/dev'
}
}
def os = System.getProperty("os.name")
def target = ""
if (os == "Mac OS X") {
target = "macos"
} else if (os.startsWith("Win")) {
target = "windows"
} else if (os.startsWith("Linux")) {
target = "linux"
} else {
throw Error("Unsupported OS: $target")
}
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation "org.jetbrains.skiko:skiko-jvm-runtime-$target-x64:0.2.0"
}
application {
mainClassName = 'AppKt'
}
```
## Building JVM bindings ## Building JVM bindings
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment