• Stars
    star
    2,605
  • Rank 16,847 (Top 0.4 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 4 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Java bindings for Skia

Skija: Java bindings for Skia

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.

For a supported version of Skija checkout HumbleUI/Skija

Motivation: Why Skija?

Because Java doesnโ€™t have a powerful and modern 2D graphics โ€” still!

There are many occasions when you might need graphics:

  • custom UI widget libraries and whole toolkits,
  • graphs, diagrams,
  • visualizations,
  • games.

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:

  • extensive color spaces support,
  • modern typography with open type features, variable typefaces, correct multi-script text handling, emojis,
  • highly-optimized GPU rendering,
  • modern GPU backends, including Vulkan and Metal (already in Skia, coming to Skija soon),
  • built-in caching and compositing facilities.

Skija brings all this power to the tips of your fingers, as simple as adding a jar to classpath.

Why hand-crafted bindings?

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:

  • full automatic memory management, no pointer abstractions leaking,
  • natural use of Java classes, interfaces, inheritance, singletons,
  • consistent naming following Java conventions, including getters/setters for properties,
  • typed enums instead of integer constants,
  • native Java platform abstractions instead of wrapped Skia/C++ ones (strings, arrays, streams, files, byte buffers, AutoCloseable),
  • hiding implementation details, e.g. transparent string encoding conversion, byte/code point indices conversion,
  • fluent builder-style APIs where possible,
  • lightweight data classes where possible (Point, Rect, FontMetrics, etc are not mirrored by native instances).

The ultimate goal for Skija is to feel as a Java library and not having to think about native part at all.

Built with Skija

Compose for Desktop, declarative UI toolkit for Kotlin:

Skija Graphics2D, an implementation of Java2D API:

Robert Felker demos:

Harold videos:

Skija demo app:

Current status

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:

  • Windows
  • Linux
  • macOS

Backends:

  • Bitmap
  • OpenGL
  • Direct3D
  • Metal
  • Vulkan

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

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 version
macOS M1 skija-macos-arm64 version
Linux skija-linux version
Windows skija-windows version

Documentation

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.

Resources

Building Skija from scratch

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/

Running examples

Examples require local build of Skija (see Building Skija).

See examples/.

Contributing

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:

  • Everything that is in Skia and makes sense in Java world.
  • Convenience methods (e.g. a method that uses a default value for a parameter).
  • Documentation on Skija methods is very welcome!

These donโ€™t:

  • Things that donโ€™t directly map to anything in Java (pointers, etc).
  • New classes, new methods that donโ€™t exist in Skia.
  • Code that combines Skia APIs together for special use-cases.

Useful things built on top of Skia/Skija are always welcome โ€” as libraries.

More Repositories

1

kotlin

The Kotlin Programming Language.
Kotlin
45,725
star
2

intellij-community

IntelliJ IDEA Community Edition & IntelliJ Platform
16,452
star
3

compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
Kotlin
14,677
star
4

JetBrainsMono

JetBrains Mono โ€“ the free and open-source typeface for developers
Shell
10,126
star
5

ideavim

IdeaVim โ€“ A Vim engine for JetBrains IDEs
Kotlin
7,980
star
6

Exposed

Kotlin SQL Framework
Kotlin
7,869
star
7

kotlin-native

Kotlin/Native infrastructure
Kotlin
7,048
star
8

ring-ui

A collection of JetBrains Web UI components
TypeScript
3,555
star
9

kotlinconf-app

KotlinConf Schedule Application
Kotlin
2,830
star
10

intellij-platform-plugin-template

Template repository for creating plugins for IntelliJ Platform
Kotlin
2,791
star
11

create-react-kotlin-app

Create React apps using Kotlin with no build configuration
JavaScript
2,477
star
12

projector-docker

Run JetBrains IDEs remotely with Docker
Shell
2,209
star
13

intellij-plugins

Open-source plugins included in the distribution of IntelliJ IDEA Ultimate and other IDEs based on the IntelliJ Platform
Java
2,002
star
14

svg-sprite-loader

Webpack loader for creating SVG sprites.
JavaScript
1,998
star
15

skiko

Kotlin MPP bindings to Skia
C++
1,685
star
16

compose-multiplatform-ios-android-template

Compose Multiplatform iOS+Android Application project template
Kotlin
1,563
star
17

MPS

JetBrains Meta programming System
JetBrains MPS
1,500
star
18

lets-plot

Multiplatform plotting library based on the Grammar of Graphics
Kotlin
1,446
star
19

kotlin-web-site

The Kotlin programming language website
JavaScript
1,413
star
20

intellij-platform-gradle-plugin

Gradle plugin for building plugins for IntelliJ-based IDEs
Kotlin
1,377
star
21

phpstorm-stubs

PHP runtime & extensions header files for PhpStorm
PHP
1,297
star
22

kotlin-wrappers

Kotlin wrappers for popular JavaScript libraries
Kotlin
1,294
star
23

idea-gitignore

.ignore support plugin for IntelliJ IDEA
Kotlin
1,287
star
24

projector-server

Server-side library for running Swing applications remotely
Kotlin
1,230
star
25

resharper-unity

Unity support for both ReSharper and Rider
C#
1,199
star
26

intellij-sdk-docs

IntelliJ SDK Platform Documentation
Markdown
1,181
star
27

xodus

Transactional schema-less embedded database used by JetBrains YouTrack and JetBrains Hub.
Java
1,155
star
28

intellij-scala

Scala plugin for IntelliJ IDEA
Scala
1,137
star
29

kotless

Kotlin Serverless Framework
Kotlin
1,124
star
30

JetBrainsRuntime

Runtime environment based on OpenJDK for running IntelliJ Platform-based products on Windows, macOS, and Linux
Java
1,118
star
31

intellij-sdk-code-samples

Mirror of the IntelliJ SDK Docs Code Samples
Java
980
star
32

js-graphql-intellij-plugin

GraphQL language support for WebStorm, IntelliJ IDEA and other IDEs based on the IntelliJ Platform.
Java
879
star
33

android

Android Plugin for IntelliJ IDEA. This repository is a subset of https://git.jetbrains.org/?p=idea/android.git cut according to GitHub file size limitations.
Kotlin
863
star
34

projector-client

Common and client-related code for running Swing applications remotely
Kotlin
813
star
35

projector-installer

Install, configure and run JetBrains IDEs with Projector Server on Linux or in WSL
Python
810
star
36

Grammar-Kit

Grammar files support & parser/PSI generation for IntelliJ IDEA
Java
688
star
37

Arend

The Arend Proof Assistant
Java
676
star
38

amper

Amper - a build and project configuration tool with a focus on the user experience and the IDE support
Kotlin
621
star
39

markdown

Markdown parser written in kotlin
Kotlin
617
star
40

jediterm

Pure Java Terminal Emulator. Works with SSH and PTY.
Java
611
star
41

compose-multiplatform-template

Compose Multiplatform Application project template
Kotlin
603
star
42

jewel

An implementation of the IntelliJ look and feels in Compose for Desktop
Kotlin
580
star
43

Nitra

Public Nitra repository
Nemerle
549
star
44

lincheck

Framework for testing concurrent data structures
Kotlin
520
star
45

intellij-micropython

Plugin for MicroPython devices in PyCharm and IntelliJ
Python
482
star
46

kotlin-playground

Self-contained component to embed in websites for running Kotlin code
JavaScript
422
star
47

colorSchemeTool

Python
396
star
48

compose-multiplatform-desktop-template

Compose Multiplatform Desktop Application project template
Kotlin
393
star
49

lets-plot-kotlin

Grammar of Graphics for Kotlin
Kotlin
389
star
50

Qodana

๐Ÿ“ Source repository of Qodana Help
388
star
51

rd

Reactive Distributed communication framework for .NET, Kotlin, C++. Inspired by Rider IDE.
C#
373
star
52

java-annotations

Annotations for JVM-based languages.
Java
362
star
53

phpstorm-attributes

PhpStorm specific attributes
PHP
357
star
54

Unity3dRider

Unity JetBrains Rider integration
348
star
55

godot-support

C#
339
star
56

pty4j

Pty for Java
Java
338
star
57

resharper-fsharp

F# support in JetBrains Rider
F#
320
star
58

phpstorm-workshop

Code for the PhpStorm workshop
PHP
287
star
59

awesome-pycharm

A curated list of resources for learning and using PyCharm, a Python IDE from JetBrains
271
star
60

web-types

JSON standard for documenting web component libraries for IDEs, documentation generators and other tools
TypeScript
270
star
61

meta-runner-power-pack

A set of Meta-runners for TeamCity
PowerShell
256
star
62

inspection-plugin

Gradle plugin to launch IDEA inspections
Kotlin
255
star
63

youtrack-mobile

A iOS and Android client for YouTrack
TypeScript
255
star
64

gradle-changelog-plugin

Plugin for parsing and managing the Changelog in a "keep a changelog" style.
Kotlin
252
star
65

ideolog

Interactive viewer for '.log' files.
Kotlin
250
star
66

qodana-action

โš™๏ธ Scan your Go, Java, Kotlin, PHP, Python, JavaScript, TypeScript, .NET projects at GitHub with Qodana. This repository contains Qodana for Azure, GitHub, CircleCI and Gradle
JavaScript
234
star
67

gradle-idea-ext-plugin

Plugin to store IJ settings in gradle script
Groovy
227
star
68

php-timeline

Notable events of PHP history
222
star
69

resharper-rider-samples

Simple interactive exercises to help learn ReSharper and Rider
C#
221
star
70

la-clojure

Clojure plugin for IntelliJ IDEA
Java
220
star
71

kotlin-compiler-server

Server for executing kotlin code
Kotlin
216
star
72

jdk8u_jdk

Java
210
star
73

jcef

A simple framework for embedding Chromium-based browsers into Java-based applications.
Java
206
star
74

pest-intellij

The official Pest Plugin for PhpStorm / IntelliJ IDEA
Kotlin
195
star
75

youtrack-workflows

YouTrack Custom Workflow Repository
JavaScript
194
star
76

psiviewer

PSI Viewer for IntelliJ IDEA plugin development
Java
175
star
77

svg-mixer

Node.js toolset for generating & transforming SVG images and sprites in modern way
JavaScript
173
star
78

compose-for-web-demos

Historical repository of early Compose for Web effort.
171
star
79

phpstorm-docker-images

Pre-configured Docker images used by PhpStorm team
Dockerfile
170
star
80

rider-efcore

Entity Framework Core UI plugin for JetBrains Rider
Kotlin
169
star
81

jetbrains_guide

JetBrains Guides where Developer Advocacy and the community share ideas.
CSS
168
star
82

kotlin-web-demo

Online mini-IDE for Kotlin
Kotlin
168
star
83

intellij-plugin-verifier

Compatibility verification tool for IntelliJ Platform plugins
Kotlin
165
star
84

intellij-samples

Code that demonstrates various IntelliJ IDEA features
Java
163
star
85

jdk8u_hotspot

C++
159
star
86

resharper-rider-plugin

https://www.jetbrains.com/help/resharper/sdk/
PowerShell
158
star
87

qodana-cli

๐Ÿ”ง JetBrains Qodanaโ€™s official command line tool
Go
154
star
88

teamcity-messages

Python Unit Test Reporting to TeamCity
Python
139
star
89

ruby-type-inference

Dynamic definitions and types provider for ruby static analysis
Kotlin
136
star
90

educational-plugin

Educational plugin to learn and teach programming languages such as Kotlin, Java, Python, JavaScript, and others right inside of JetBrains IntelliJ Platform based IDEs.
Kotlin
134
star
91

resharper-angularjs

ReSharper plugin for AngularJS support
JavaScript
134
star
92

clion-remote

134
star
93

golandtipsandtricks

This is an ever evolving repository for GoLand Tips&Tricks
Go
132
star
94

python-skeletons

The python-skeltons repo is deprecated: use PEP 484 and Typeshed instead
Python
132
star
95

clion-wsl

Shell
130
star
96

phpstorm-phpstan-plugin

PHPStan plugin for PhpStorm
Java
130
star
97

teamcity-docker-samples

TeamCity docker compose samples
Shell
128
star
98

phpstorm-psalm-plugin

Psalm plugin for PhpStorm
Java
126
star
99

jdk8u

Shell
123
star
100

YouTrackSharp

.NET Standard 2.0 Library to access YouTrack API.
C#
123
star