A Graphics2D implementation targeting Skija as a backend.

Overview

SkijaGraphics2D

Version 1.0.2, 4 August 2021

Overview

SkijaGraphics2D is an implementation of Java2D's Graphics2D API that targets Skia via the Skija bindings. The project is exploratory at the moment, but potential uses for this are to:

  • provide a path for Java applications to access the Skia rendering pipeline (potential speed and quality gains plus access to target formats such as SVG and PDF)
  • include libraries such as JFreeChart and Orson Charts in Jetpack Compose Desktop applications

Note that these are potential uses, so far I haven't tried those things out...if you have then let us know what worked and what didn't work.

Testing

SkijaGraphics2D is being tested using Graphics2D Tester and produces the output shown below. There are several areas that still need work:

  • fonts
    • mapping of Java logical fonts to physical fonts
    • metrics
  • the create() method is not yet managing the user clip correctly, causing problems in the Swing UI / SteelSeries test
  • mapping of RadialGradientPaint focus point

Aside from those points, the results are already very promising.

SkijaGraphics2D test output

Include

To include SkijaGraphics2D in your own project, add the following Maven dependency:

    <dependency>
        <groupId>org.jfree</groupId>
        <artifactId>org.jfree.skijagraphics2d</artifactId>
        <version>1.0.2</version>
    </dependency>

Build

You can build SkijaGraphics2D from sources using Maven:

mvn clean install

License

SkijaGraphics2D is licensed under a BSD-style license:

Copyright (c) 2021, Object Refinery Limited.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation 
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors 
may be used to endorse or promote products derived from this software without 
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

History

4-Aug-2021 : Version 1.0.2
  • fix setClip() to restore original clip before applying new user clip
  • set PathFillMode when filling paths
  • add MIN_LINE_WIDTH to apply for BasicStroke(0f)
  • fix exception when Rectangle2D has negative width or height
27-Jul-2021 : Version 1.0.1
  • added specialisation in fill(Shape) for Rectangle2D instances
  • added caching of Typeface instances
  • fix paint setting for font rendering
  • added support for AlphaComposite
  • apply clipping (still work-in-progress)
  • fix for cyclic gradient paint
  • updated Skija to version 0.92.18
  • added logging via SLF4J and Log4J2
21-Jul-2021 : Version 1.0.0
  • initial public release.
You might also like...

Java - Backend for Human Resource Management System

HRMS (Human Resource Management System) Main Directory PostgreSQL (Heroku)Live API Java(1.8) - Spring Boot based. Dependencies: Spring Boot DevTools S

Dec 26, 2022

Repository with Backend code for InnoTutor project. It is written on Java/Spring.

Repository with Backend code for InnoTutor project. It is written on Java/Spring.

Backend ᅠ ᅠ Developers: Daniil Livitn, Roman Soldatov Contents Requirements API Database Google credentials Hosting and CI How to install locally Code

Sep 17, 2022

In this course, we will learn how to build a complete full-stack web application using Spring boot as backend and React (React Hooks) as frontend

In this course, we will learn how to build a complete full-stack web application using Spring boot as backend and React (React Hooks) as frontend. We will use MySQL database to store and retrieve the data.

Dec 22, 2022

Spring Boot microservices app with Spring Cloud, Robust and resilient backend managing e-Commerce app

Spring Boot microservices app with Spring Cloud, Robust and resilient backend managing e-Commerce app

e-Commerce-boot μServices Important Note: This project's new milestone is to move The whole system to work on Kubernetes, so stay tuned. Introduction

Dec 23, 2022

This repository is for Todo application. This contains the Backend part of the application.

Todo Application 개요(Abstract) 개인용 할일 목록 리스트 앱플리케이션 구축 (Personal Todo List Application) 목적 1. React.js기초, AWS서버 활용, 스프링 부트 공부 목적으로 프로젝트 시작했습니다.

Jan 8, 2022

Manages server status and gives log of status information. front end - angular js, backend- sbring boot, DB-MySQL

ServerManagerApplication / | | / | | ( ___ _ __ __ __ ___ _ __ | \ / | __ _ _ __ __ _ __ _ ___ _ __ __ \ / _ \ | '| \ \ / / / _ \ | '| | |/| | / | | '

Jan 6, 2022

Frontend : React , Backend : Spring boot

React(Front) + Spring Boot(Back) 작업 하기 앞서, React와 Spring Boot는 각각 다른 서버에서 돌아가기 때문에, 연동시 Front에 문제가 생기면 Back까지 문제가 생길 수 있다. 하지만, Spring Boot에서 React와 같

Jan 9, 2022

Vueblog-Backend

Vueblog-Backend

版权声明 本项目为学习交流项目,参考自MarkerHub的vueblog[https://github.com/MarkerHub/vueblog] 项目:vueblog 公众号:MarkerHub 介绍 一个基于SpringBoot + Vue开发的前后端分离博客项目,带有超级详细开发文档和讲解视

Feb 14, 2022

Desafio Alura Challenge para backend. Criando uma API REST de controle de orçamento utilizando JAVA.

Desafio Alura Challenge para backend. Criando uma API REST de controle de orçamento utilizando JAVA.

Jun 16, 2022
Comments
  • Add constructor which wraps an existing Skija Canvas

    Add constructor which wraps an existing Skija Canvas

    It would be nice to add a constructor which wraps an existing Skija Canvas without first explicitly creating a Surface. With such a constructor this code could be used in conjunction with Jetbrains Compose. Compose can provide you with a NativeCanvas object which is just a type alias for org.jetbrains.skija.Canvas and if you could wrap that you could use all your AWT rendering stuff in the context of Jetbrains Compose. This also needs some changes or disabling of the create method.

    opened by mipastgt 8
  • Consider switching to Skiko

    Consider switching to Skiko

    The original dependency on Skija was recently updated to a fork of Skija. I would suggest looking into switching to Skiko instead - which is Jetbrains' replacement for Skija, and is being used as the graphics foundation of Compose for Desktop.

    Upsides:

    • if the goal is to enable usage of chart libraries in Compose for Desktop, then Skiko is the right dependency to have
    • continued, ongoing investment from Jetbrains into the library
    • can remove a bunch of null assertions and tests as nulllability is built into Kotlin

    Downsides

    • requires switching to Kotlin instead of Java, as Skiko is Kotlin bindings to Skia
    • bigger dependency footprint, as Skiko contains more than just Skia bindings

    I have https://github.com/kirill-grouchnikov/skijagraphics2d/commit/aa8eab27524393b4f75a0c8ae3246b0e79296bc5 as proof of concept. What it has:

    • switching to use Kotlin. Note that the translation is automatic, and there's a lot of cleanup to be done to make the code look Kotlin native
    • switching to use Skiko 0.6.6. Note that the latest is 0.7.2, but I didn't want to look too deeply into the specific dependencies that are needed. Right now I'm just hardcoding skiko-jvm and skiko-jvm-runtime-macos-x64 in there
    • some tests still fail. I started "fixing" the tests, but it's just tedious, as most of those still failing are around nullability checks and are not relevant in the world of Kotlin

    Note that this is a proof of concept for your consideration. If you decide to go down that road, I can help with questions, but I'm not going to own the full switch to Skiko.

    opened by kirill-grouchnikov 2
  • Exception in thread

    Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Can't load C:\Users\...\skija.dll

    Great project! I have tried to convert some java2D graphics directly via skija with SkijaGraphics2D, but the external dll cannot be loaded even if extracted OK in the temp directory. I have compiled SkijaGraphics2D with ant by manually resolving dependencies, slf4j-api, slf4j-simple, types and skija from humbleui and skija at the maven version 0.98.1 and the latest 0.100. Same results for both.

    COMPILE SkijaGraphics2D (windows skija version): This line of code in netbeans shows an error:

    SkijaGraphics2D.java

                // needs clojure library dependency ????????????
                this.canvas.drawRect(Rect.makeXYWH((float) r.getX(), (float) r.getY(), (float) r.getWidth(), (float) r.getHeight()), this.skijaPaint);
    

    then after a bit of search I have seen that it needs clojure library also. So after resolving closure depedancy compiles OK.

    Then after loading all libs in order to use them, in the sense of what I see I the test -->

               // Test SkijaGraphics2D...
                this.g2 = new SkijaGraphics2D(10, 20);
    

    RUNTIME: I get this error even before parsing any code to the next level, stops at loading the external dll, the skija.dll and icudtl.dat file is there,

    
    Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Can't load C:\Users\...\AppData\Local\Temp\skija_0.98.1\skija.dll
    	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:1793)
    	at java.base/java.lang.System.load(System.java:672)
    	at io.github.humbleui.skija.impl.Library.load(Library.java:73)
    	at io.github.humbleui.skija.impl.Library.staticLoad(Library.java:47)
    	at io.github.humbleui.skija.Surface.<clinit>(Surface.java:10)
    	at org.jfree.skija.SkijaGraphics2D.<init>(SkijaGraphics2D.java:214)
    
    opened by istinnstudio 1
  • Invalid maven build

    Invalid maven build

    Adding dependency by Gradle:

    implementation("org.jfree:org.jfree.skijagraphics2d:1.0.3")
    

    Dependency output:

    +--- org.jfree:org.jfree.skijagraphics2d:1.0.3
    |    +--- org.jetbrains.skija:skija-${skija.platform}:0.92.22 FAILED
    |    +--- org.slf4j:slf4j-api:1.7.32
    |    \--- org.apache.logging.log4j:log4j-slf4j-impl:2.14.1
    |         +--- org.slf4j:slf4j-api:1.7.25 -> 1.7.32
    |         \--- org.apache.logging.log4j:log4j-api:2.14.1
    

    Expect:

    org.jetbrains.skija:skija-linux:0.92.22
    

    Error:

    > Error while evaluating property 'filteredArgumentsMap' of task ':compileKotlin'
       > Could not resolve all files for configuration ':compileClasspath'.
          > Could not resolve org.jetbrains.skija:skija-${skija.platform}:0.92.22.
            Required by:
                project : > org.jfree:org.jfree.skijagraphics2d:1.0.3
             > Could not resolve org.jetbrains.skija:skija-${skija.platform}:0.92.22.
                > Could not get resource 'https://maven.pkg.jetbrains.space/public/p/compose/dev/org/jetbrains/skija/skija-$%7Bskija.platform%7D/0.92.22/skija-$%7Bskija.platform%7D-0.92.22.pom'.
                   > Could not GET 'https://maven.pkg.jetbrains.space/public/p/compose/dev/org/jetbrains/skija/skija-$%7Bskija.platform%7D/0.92.22/skija-$%7Bskija.platform%7D-0.92.22.pom'. Received status code 400 from server: Bad Request
             > Could not resolve org.jetbrains.skija:skija-${skija.platform}:0.92.22.
                > Could not get resource 'https://packages.jetbrains.team/maven/p/skija/maven/org/jetbrains/skija/skija-$%7Bskija.platform%7D/0.92.22/skija-$%7Bskija.platform%7D-0.92.22.pom'.
                   > Could not GET 'https://packages.jetbrains.team/maven/p/skija/maven/org/jetbrains/skija/skija-$%7Bskija.platform%7D/0.92.22/skija-$%7Bskija.platform%7D-0.92.22.pom'. Received status code 400 from server: Bad Request
    
    opened by elonzh 3
Owner
David Gilbert
Java client side developer, creator of JFreeChart, Orson Charts (also for Android), JFreeSVG and FXGraphics2D.
David Gilbert
Java implementation of Beacon Chain for Ethereum 2.0, and its Backend API and full Infrastructure.

hailong Implementation of the Ethereum 2.0 Beacon Chain. Based on the (evolving) specification. Build Instructions Install Prerequisites 1) Java 11 Ub

我是高天才! 14 Feb 6, 2022
A backend for Asciidoctor used to produce Spring styled HTML

Asciidoctor Spring Backends Alternative HTML conversion for Asciidoctor with a Spring "look and feel". Maven build integration You can use the Asciido

Spring IO 40 Dec 14, 2022
Backendini Javada Frontendini ise React ile yazacağım insan kaynakları yönetim kısmınının backend kısmıdır

İnsan Kaynakları Yönetim Sistemi insan kaynaklarının, iş süreçlerinin ve verilerin kolay yönetimini sağlamak için bir dizi sistemi ve işlemi birleştir

Emirhan Doğandemir 17 Dec 5, 2022
backend for a sharing app using SpringBoot, Redis, MySQL, and AWS S3.

moments_v2_backend (Work In Progress) backend for a sharing app using SpringBoot, Redis, MySQL, and AWS S3. This is the second version of my project S

Haiming Sun 53 Dec 26, 2022
Human Resource Management System - Backend

Human Resource Management System - Backend File Structure ??️ Layered Architecture Entities - The package in which the assets are kept DataAcces - Pac

Tarık Kaan Koç 30 Jan 1, 2023
Backend For Human Resource Management System

?? Presentation This is a hrms project. At the backend of this project I used Java(Spring Boot) and I used PostgreSQL as database management. At the f

Salih Bora Öztürk 13 Aug 5, 2022
A repository that contains the backend part of the Human Resources Management System.

Human Resources Management System Backend A human resources management system is a form of human resources (HR) software that combines several systems

Bulent Baris Kilic 24 Dec 26, 2022
Yazılım Geliştirici Yetiştirme Kampı (JAVA & REACT) Uygulama Projesi (Backend)

HRMS_JavaProject Yazılım Geliştirici Yetiştirme Kampı (JAVA & REACT) Uygulama Projesi (Backend) 9.Gün Ödevleri: Farklı alanlara başvuru için, aday baş

Barış ERTUĞRUL 18 Jul 26, 2022
Java backend for ASoulCnki

A-SOUL评论区小作文 枝网查重系统 后端 源项目:https://github.com/stream2000/ASoulCnki 网站地址:https://asoulcnki.asia 部署 1 系统要求 Java 8 Java堆内存1500M及其以上 2 运行 2.1 依赖json文件运行 修

null 81 Nov 7, 2022
Backendini Javada Frontendini ise React ile yazacağım insan kaynakları yönetim kısmınının backend kısmıdır

İnsan Kaynakları Yönetim Sistemi insan kaynaklarının, iş süreçlerinin ve verilerin kolay yönetimini sağlamak için bir dizi sistemi ve işlemi birleştir

Emirhan Doğandemir 17 Dec 5, 2022