All Projects → JetBrains → Skija

JetBrains / Skija

Licence: apache-2.0
Java bindings for Skia

Programming Languages

java
68154 projects - #9 most used programming language
C++
36643 projects - #6 most used programming language
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Skija

deno-canvas
Canvas API for Deno, ported from canvaskit-wasm (Skia).
Stars: ✭ 124 (-94.59%)
Mutual labels:  skia, 2d
Wechart
Create all the [ch]arts by cax or three.js - Cax 和 three.js 创造一切图[表]
Stars: ✭ 152 (-93.37%)
Mutual labels:  graphics, 2d
Mathc
Pure C math library for 2D and 3D programming
Stars: ✭ 504 (-78.01%)
Mutual labels:  graphics, 2d
Pixieditor
PixiEditor is a lightweight pixel art editor made with .NET 5
Stars: ✭ 210 (-90.84%)
Mutual labels:  graphics, 2d
Microcharts
This project is just simple drawing on top of the awesome SkiaSharp library. The purpose is not to have an heavily customizable charting library. If you want so, simply fork the code, since all of this is fairly simple. Their is no interaction, nor animation at the moment.
Stars: ✭ 1,653 (-27.88%)
Mutual labels:  graphics, skia
Graphics32
Graphics32 is a graphics library for Delphi and Lazarus. Optimized for 32-bit pixel formats, it provides fast operations with pixels and graphic primitives. In most cases Graphics32 considerably outperforms the standard TBitmap/TCanvas methods.
Stars: ✭ 238 (-89.62%)
Mutual labels:  graphics, 2d
Sketch
A Common Lisp framework for the creation of electronic art, visual design, game prototyping, game making, computer graphics, exploration of human-computer interaction, and more.
Stars: ✭ 1,026 (-55.24%)
Mutual labels:  graphics, 2d
Draw2d
2D rendering for different output (raster, pdf, svg)
Stars: ✭ 799 (-65.14%)
Mutual labels:  graphics, 2d
Citro2d
Library for drawing 2D graphics using the Nintendo 3DS's PICA200 GPU
Stars: ✭ 88 (-96.16%)
Mutual labels:  graphics, 2d
Spatialmath Python
Create, manipulate and convert representations of position and orientation in 2D or 3D using Python
Stars: ✭ 78 (-96.6%)
Mutual labels:  graphics, 2d
Picasso
Picasso is a high quality 2D vector graphic rendering library. It support path , matrix , gradient , pattern , image and truetype font.
Stars: ✭ 205 (-91.06%)
Mutual labels:  graphics, 2d
Gcanvas
A lightweight cross-platform graphics rendering engine. (超轻量的跨平台图形引擎) https://alibaba.github.io/GCanvas
Stars: ✭ 1,705 (-25.61%)
Mutual labels:  graphics, 2d
Skiasharp
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
Stars: ✭ 2,493 (+8.77%)
Mutual labels:  graphics, skia
Gg
Go Graphics - 2D rendering in Go with a simple API.
Stars: ✭ 3,162 (+37.96%)
Mutual labels:  graphics, 2d
Rgx
Modern mid-level 2D graphics library
Stars: ✭ 172 (-92.5%)
Mutual labels:  graphics, 2d
Sophus
C++ implementation of Lie Groups using Eigen.
Stars: ✭ 1,048 (-54.28%)
Mutual labels:  graphics, 2d
Svg.skia
An SVG rendering library.
Stars: ✭ 122 (-94.68%)
Mutual labels:  graphics, 2d
Plutovg
Tiny 2D vector graphics library in C
Stars: ✭ 141 (-93.85%)
Mutual labels:  graphics, 2d
Retrace.gl
Create, ray trace & export programatically defined Signed Distance Function CSG geometries with an API suited for generative art - in your browser! 🎉
Stars: ✭ 149 (-93.5%)
Mutual labels:  graphics
Membrane
A platform agnostic clojure(script) library for creating user interfaces
Stars: ✭ 154 (-93.28%)
Mutual labels:  graphics

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.

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].