Giter Club home page Giter Club logo

skijagraphics2d's People

Contributors

bourgesl avatar jfree avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

skijagraphics2d's Issues

Remove unused imports

Remove:

import javax.imageio.ImageIO;
import java.io.File;
import java.io.IOException;

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

SkijaGraphics2D not used

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 Arc2D arc type may wrong

fillArc method use Arc2D arc(int x, int y, int width, int height, int startAngle, int arcAngle) create Arc2D

public void fillArc(int x, int y, int width, int height, int startAngle,
int arcAngle) {
if (LOG_ENABLED) {
LOGGER.debug("fillArc({}, {}, {}, {}, {}, {})", x, y, width, height, startAngle, arcAngle);
}
fill(arc(x, y, width, height, startAngle, arcAngle));
}

In arc method use Arc2D.OPEN as default type, but fillArc expect Arc2D.PIE type

private Arc2D arc(int x, int y, int width, int height, int startAngle,
int arcAngle) {
if (this.arc == null) {
this.arc = new Arc2D.Double(x, y, width, height, startAngle,
arcAngle, Arc2D.OPEN);
} else {
this.arc.setArc(x, y, width, height, startAngle, arcAngle,
Arc2D.OPEN);
}
return this.arc;
}

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"));
    }

test

Maven coords?

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?

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 kirill-grouchnikov@aa8eab2 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.

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)

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.