⚠️ This repository is no longer actively maintained. ⚠️
Active Skija project is located at HumbleUI/Skija
Skia is an open source 2D graphics library which provides common APIs that work across a variety of hardware and software platforms.
Skija is a high-quality Java bindings for Skia.
Because Java doesn’t have a powerful and modern 2D graphics — still!
There are many occasions when you might need graphics:
Existing offerings are: Graphics2D from AWT, GraphicsContext from JavaFX. They are good, but underwhelming.
Enter Skia. Skia has a proven track record of industrial-scale project relying on it for all things graphics: Google Chrome, Android, Flutter, Firefox Canvas, Xamarin, LibreOffice. Skia outperforms all existing Java2D toolkits in almost every benchmark, and also provides:
Skija brings all this power to the tips of your fingers, as simple as adding a jar to classpath.
Automatically generated bindings for Skia exist, but don’t seem to have high adoption:
Skija project has a goal of providing great Java-native API that is natural to use. In particular:
The ultimate goal for Skija is to feel as a Java library and not having to think about native part at all.
Compose for Desktop, declarative UI toolkit for Kotlin:
Skija Graphics2D, an implementation of Java2D API:
Robert Felker demos:
Harold videos:
Public alpha. Things might change without notice.
Please note that Skia is known to change its API quite often (monthly). Skija will do its best to protect from these changes, but sometimes it might be impossible (e.g. method was removed). Normally it’s auxiliary stuff though, don’t worry too much.
Platforms:
Backends:
APIs:
Bitmap ▓▓▓▓▓▓▓▓▓▓ Paint ▓▓▓▓▓▓▓▓▓▓
Canvas ▓▓▓▓▓▓▓▓░░ Path ▓▓▓▓▓▓▓▓▓▓
Codec ▓▓▓▓░░░░░░ PathEffects ▓▓▓▓▓▓▓▓▓▓
Color ▓░░░░░░░░░ PathMeasure ▓▓▓▓▓▓▓▓▓▓
ColorFilter ▓▓▓▓▓▓▓▓▓▓ PaintFilterCanvas ▓▓▓▓▓▓▓▓▓▓
ColorInfo ▓▓▓▓▓▓▓▓▓▓ Picture ▓▓▓▓▓▓▓▓▓░
ColorSpace ▓▓▓▓░░░░░░ PictureRecorder ▓▓▓▓▓▓▓▓▓▓
Data ▓▓▓▓▓▓▓▓▓░ PixelRef ▓▓▓▓▓▓▓▓▓▓
Drawable ▓▓▓▓▓▓▓▓░░ Pixmap ▓▓▓▓▓▓▓▓▓▓
Flattenable ░░░░░░░░░░ Region ▓▓▓▓▓▓▓▓▓▓
Font ▓▓▓▓▓▓▓▓▓▓ RuntimeEffect ▓▓▓▓▓░░░░░
FontData ░░░░░░░░░░ ScalerContext ░░░░░░░░░░
FontManager ▓▓▓▓▓▓▓▓▓░ Shader ▓▓▓▓▓▓▓▓▓▓
FontStyle ▓▓▓▓▓▓▓▓▓▓ ShadowUtils ▓▓▓▓▓▓▓▓▓▓
FontStyleSet ▓▓▓▓▓▓▓▓▓▓ Stream ░░░░░░░░░░
Image ▓▓░░░░░░░░ String ▓░░░░░░░░░
ImageFilters ▓▓▓▓▓▓▓▓▓▓ Surface ▓░░░░░░░░░
ImageInfo ▓▓▓▓▓▓▓▓▓▓ TextBlob ▓▓▓▓▓▓▓▓▓▓
MaskFilter ▓▓▓▓▓▓▓▓▓▓ TextBlobBuilder ▓▓▓▓▓▓▓▓▓▓
Matrix33 ▓▓▓░░░░░░░ Typeface ▓▓▓▓▓▓▓▓░░
Matrix44 ▓▓▓░░░░░░░ WStream ▓▓░░░░░░░░
Shaper: Paragraph:
BiDiRunIterator ▓▓▓▓▓▓▓▓▓▓ FontCollection ▓▓▓▓▓▓▓▓▓▓
FontMgrRunIterator ▓▓▓▓▓▓▓▓▓▓ LineMetrics ▓▓▓▓▓▓▓▓▓░
FontRunIterator ▓▓▓▓▓▓▓▓▓▓ Paragraph ▓▓▓▓▓▓▓▓▓▓
HbIcuScriptRunIter ▓▓▓▓▓▓▓▓▓▓ ParagraphCache ▓▓▓▓▓▓▓▓▓▓
IcuBidiRunIterator ▓▓▓▓▓▓▓▓▓▓ ParagraphStyle ▓▓▓▓▓▓▓▓▓▓
LanguageRunIterator ▓▓▓▓▓▓▓▓▓▓ ParagraphBuilder ▓▓▓▓▓▓▓▓▓▓
RunHandler ▓▓▓▓▓▓▓▓▓▓ TextStyle ▓▓▓▓▓▓▓▓▓▓
RunInfo ▓▓▓▓▓▓▓▓▓▓ TypefaceFontProvider ▓▓▓▓▓▓▓▓▓▓
ScriptRunIterator ▓▓▓▓▓▓▓▓▓▓
Shaper ▓▓▓▓▓▓▓▓▓▓
TextBlobBldRunHndlr ▓▓▓▓▓▓▓▓▓▓
SVG:
SVGDOM ▓▓▓▓▓▓▓▓░░
SVGCanvas ▓▓▓▓▓▓▓▓▓▓
SVGSVG ▓▓▓▓▓▓▓▓░░
Using Skija is as simple as adding a jar file.
Maven:
<repositories>
<repository>
<id>space-maven</id>
<url>https://packages.jetbrains.team/maven/p/skija/maven</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jetbrains.skija</groupId>
<artifactId>skija-${platform}</artifactId>
<version>${version}</version>
</dependency>
</dependencies>
Gradle:
repositories {
maven {
url "https://packages.jetbrains.team/maven/p/skija/maven"
}
}
dependencies {
api "org.jetbrains.skija:${artifact}:${version}"
}
Replace ${artifact}
and ${version}
with:
Platform | ${artifact} |
${version} |
---|---|---|
macOS Intel | skija-macos-x64 |
|
macOS M1 | skija-macos-arm64 |
|
Linux | skija-linux |
|
Windows | skija-windows |
Get started by reading Getting Started.
API docs are under development — consult source code and JavaDoc comments.
I found SkiaSharp documentation to be excellent resource on what can be done in Skia. They have nice examples and visual explanations, too.
If Skija is missing a documentation for a particular method or class, check the same class in Skia Documentation instead. It might be that we didn’t move it over to Java yet. PRs are welcome!
Finally, LWJGL demo app has examples of most of the APIs that are currently implemented.
Prerequisites: Git, CMake, Ninja, JDK 9+, $JAVA_HOME, Python 3.
Checkout:
git clone https://github.com/JetBrains/skija.git
cd skija
./script/build.py
To codesign:
security find-identity
export APPLE_CODESIGN_IDENTITY="<...>"
./script/build.py
For building Skia itself, see https://github.com/JetBrains/skia-build/
Examples require local build of Skija (see Building Skija).
See examples/.
Contributions are welcome!
Make sure to read Code Conventions.
Remember: the goal of Skija is to map Skia API as close as possible.
These things have a place in Skija:
These don’t:
Useful things built on top of Skia/Skija are always welcome — as libraries.