Skip to content

Eases Skija (Skia for Java) interoperability with Processing

Notifications You must be signed in to change notification settings

micycle1/processing-skia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

processing-skia

Skia is an open source 2D graphics library which provides common APIs that work across a variety of hardware and software platforms.

Skija provides high-quality Java bindings for Skia.

processing-skia does the backend work of setting Skija's render target to Processing, so you can easily use any Skija bindings to draw into a Processing sketch.

Requirements

  • Java 11+ (Processing 4)
  • A Processing sketch using either the P2D or P3D renderer.

Download

Download a .jar of processing-skia from releases.

Example

Code

import micycle.processingSkia.SkiaCanvas;
import org.jetbrains.skija.*;

Canvas skiaCanvas;

@Override
public void settings() {
    size(800, 800, P2D);
}

@Override
public void setup() {
    skiaCanvas = SkiaCanvas.getSkiaCanvas(this);
}

@Override
public void draw() {
    background(255);
	
    Paint fill = new Paint().setShader(Shader.makeLinearGradient(400, 300, 400, 500, new int[] {0xFFFFA500, 0xFF4CA387}));
	
    skiaCanvas.drawCircle(400, 400, 200, fill);
}

Result

Example

More examples

A number of example Processing sketches are provided in examples.

Dash Stroke Text on Path

Further Work

Further work would wrap the Skija library itself, creating Processing-like bindings around Skija's API (a PGraphicsSkia) leading to the possibility of a dedicated Skia-based renderer in Processing.