jfree / skijagraphics2d Goto Github PK
View Code? Open in Web Editor NEWA Graphics2D implementation targeting Skija as a backend.
A Graphics2D implementation targeting Skija as a backend.
Remove:
import javax.imageio.ImageIO;
import java.io.File;
import java.io.IOException;
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
LinearGradientPaint does not support matrix transformations in setPaint.
Found the examples we can close this one.
Still I believe the example is better to be in the README instead of third party test project ;)
fillArc method use Arc2D arc(int x, int y, int width, int height, int startAngle, int arcAngle)
create Arc2D
skijagraphics2d/src/main/java/org/jfree/skija/SkijaGraphics2D.java
Lines 1876 to 1882 in d9924a9
In arc
method use Arc2D.OPEN
as default type, but fillArc
expect Arc2D.PIE
type
skijagraphics2d/src/main/java/org/jfree/skija/SkijaGraphics2D.java
Lines 1898 to 1908 in d9924a9
The following code proves my suspicion
public static void main(String[] args) throws IOException {
BufferedImage image = new BufferedImage(500, 500, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = image.createGraphics();
g.setPaint(Color.RED);
g.fillArc(20, 20, 200, 200,200,200);
ImageIO.write(image, "png", new File("test.png"));
}
The link to Orson charts in the readme is https://github.com/jfree/orsoncharts but it should be https://github.com/jfree/orson-charts
Hello, I'm interested in using this project but I don't see any maven repo coordinates or binaries for it. Could you upload it to maven central?
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:
Downsides
I have kirill-grouchnikov@aa8eab2 as proof of concept. What it has:
skiko-jvm
and skiko-jvm-runtime-macos-x64
in thereNote 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.
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)
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.