Giter Club home page Giter Club logo

skija's Introduction

obsolete JetBrains project

⚠️ This repository is no longer actively maintained. ⚠️

Active Skija project is located at HumbleUI/Skija

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.

skija's People

Contributors

alexeytsvetkov avatar anzerwall avatar comtel2000 avatar cqjjjzr avatar egororachyov avatar greg-kargin avatar haardikdharma10 avatar igordmn avatar kannangce avatar ludeknovy avatar madhead avatar mzgreen avatar nz-jaybird avatar oakmac avatar olonho avatar pangloss avatar prepor avatar sergeevpavel avatar shafirov avatar solido avatar tonsky avatar utenma avatar vechro 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  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  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

skija's Issues

JetBrainsRuntime and SkijaGraphics2D a possibility?

Great project and great initiative! I love how you approach this from the perspective of stability and memory consistency.

I understand this is a multi-purpose project and JetBrains has interesting plans. I'd like to point out a possibility that gets me excited: A jbr/java2d graphics environment based on skija.

Why:

  • Current java2d graphics environments are platform-specific implementations. It seems quite pragmatic to depend on skija and offload cross-platform support to skia.
  • Current java2d font rendering is inferior to skia on both windows and mac (UI fonts kerning and possibly other issues)
  • Fractional scaling on windows sucks (for intellij products, on 150%, inconsistent left-right border widths), which can be solved with skia.

What would this enable:

  • Proper, consistent, performant rendering cross-platform
  • Rendering extensions/capabilities for svg, smooth animations and other stuff
  • Target metal on mac as an alternative to project lanai
  • Run intellij platform on fuchsia and nest thermostat
  • WinUI-based AWT toolkit using skia (first class D3D12 support is coming soon)

`.drawString` crashes the JVM when passed a Font with a null type face

I created a repro in https://github.com/phronmophobic/membrane-skija-example

code: https://github.com/phronmophobic/membrane-skija-example/blob/main/src/com/phronemophobic/issues.clj#L45

run with: clj -X com.phronemophobic.issues/drawstring-crash-null-typeface
it should behave similar to: clj -X com.phronemophobic.issues/drawstring-works

Further, several of the Skia examples use something like SkFont(nullptr, 18) to use the default system font. This is especially useful for writing cross platform code that might not want to depend on a particular font existing and just draw some text.
See the final example at https://skia.org/user/api/skcanvas_overview.

Embedding an nREPL server in lwjgl example results in crash on connection attempt

I’m attempting to spin up an nREPL server from within my app (which I’m basing off the lwjgl example). The app starts up fine, but it crashes as soon as I try to connect to the server (using Cursive’s nREPL connection type):

# Problematic frame:
# C  [libskija.dylib+0x4502d]  SkCanvas::internalDrawPaint(SkPaint const&)+0xcd

My goal is to enable interactive development for me while running the app on the main thread and to eventually include the REPL as a feature of the app. (This was an attempt to follow @tonsky's advice in #56.)

The only change I’ve made to the example so far is a call to start the REPL server just before the main loop:

(repl-server/start!)
(loop []
  (when (not (GLFW/glfwWindowShouldClose window))
    (draw canvas)
    (.flush context)
    (GLFW/glfwSwapBuffers window)
    (GLFW/glfwPollEvents)
    (recur)))

My start! function is fairly simple. I also tried wrapping everything in a fresh thread to no avail:

(defn start!
  []
  (if (nil? @thread)
    (do
      (reset! thread (Thread. ^Runnable
                              (fn [] (if (nil? @server)
                                       (reset! server (start-server :port 12345))))))
      (.start @thread))))

I’m currently at a loss as to what else to try.

I've attached the crash log. Any suggestions?

hs_err_pid99984.log

Expose Paint Color4f

Hey it's me again,

Since I'm having a good time with Skija you'll see me open some tickets here & here as I stumble upon.
Maybe there are already in the roadmap and I just need to be patient. Thx !

Please expose

SkPaint green1, green2;
green1.setColor4f({0, 1, 0, 1}, nullptr); 

Running skija with Java 8

Hi everyone,

I was wondering if there is any possibility to make skija wordking with java 8 please ? Maybe a trick or something ? I need to swith to java 11, but due to some legacy code, i still need to wait a bit and i would love to try make skija working with my java 8 app.

Thank's a lot.

Fix -Xcheck:jni warnings

Drawable uses JNIEnv* from the wrong thread
Scene: DrawableScene

WARNING: JNI local refs: 1452, exceeds capacity: 1451
WARNING in native method: JNI call made without checking exceptions when required to from CallStaticObjectMethodV
FATAL ERROR in native method: Using JNIEnv in the wrong thread

Running lwjgl.main/-main crashes nREPL

Is it possible to work with Skija from Clojure nRepl?
I tried to run (-main) from your example and it crashes the Repl in Emacs (Cider) on MacOS.
Running by scripts/run.sh works fine though.

lwjgl.main> (-main)

*** Closed on Thu Nov 19 13:19:47 2020 ***

Use of Float

Hi !

Discovering Skija I got type all my entries as float using .0f
Is there a specific reason like perf for not using double ?
I see that Skia in mainly working with SkScalar which is Float, correct ?

This is just a question about convenience to avoid typing/converting everything when using Skija

Thanks

LWJGL examples crash the JVM on Windows

Hi,
I was trying the lwjgl examples and my jvm was crashing when running the application on Windows 10 64bit
The jvm crash log shows this:

...
Host: Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz, 4 cores, 31G, Windows 10 , 64 bit Build 18362 (10.0.18362.1110)
Time: Wed Dec 30 15:36:18 2020 Eastern Standard Time elapsed time: 0.791668 seconds (0d 0h 0m 0s)

--------------- T H R E A D ---------------

Current thread (0x0000019f82f2f800): JavaThread "main" [_thread_in_native, id=7600, stack(0x0000008956200000,0x0000008956300000)]

Stack: [0x0000008956200000,0x0000008956300000], sp=0x00000089562ff180, free space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [skija.dll+0x4629]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.jetbrains.skija.Font._nMakeTypefaceSize(JF)J+0
j org.jetbrains.skija.Font.(Lorg/jetbrains/skija/Typeface;F)V+6
j jskia.scene.TextLineScene.()V+158
j jskia.Window.loop()V+148
j jskia.Window.run(Lorg/jetbrains/skija/IRect;)V+14
j jskia.App.main([Ljava/lang/String;)V+95
v ~StubRoutines::call_stub

siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), writing address 0x0000000000000008

Register to memory mapping:

RIP=0x00007ffb84b44629 skija.dll
RAX=0x0000000000000008 is an unknown value
RBX={method} {0x0000019fb7b3c3b8} '_nMakeTypefaceSize' '(JF)J' in 'org/jetbrains/skija/Font'
...

The package names might be different than the ones from the skija examples folder but the code is exactly the same.
If I comment out these lines in TextLineScene.java (and the code that depends on them):

private Font zapfino18 = new Font(FontMgr.getDefault().matchFamilyStyle("Zapfino", FontStyle.NORMAL), 18);
    private Font emoji36 = new Font(FontMgr.getDefault().matchFamilyStyle("Apple Color Emoji", FontStyle.NORMAL), 36);

then it works and the jvm doesn't crash

Are those fonts Apple specific ?
Should the examples be run only on an Apple machine ?

I also tried to run the lwjgl examples on Linux (Ubuntu/Gnome 64bit) with maven and got the same result.
The jvm crash log shows the same stack trace pointing to TextLineScene.java

This could probably be a new issue but I'll include it here.
Once I comment the Apple fonts to get the application to start I get this NPE

Exception in thread "main" java.lang.NullPointerException: Cannot read field "_left" because "r" is null
at org.jetbrains.skija.Canvas.drawRect(Canvas.java:229)
at org.jetbrains.skija.examples.lwjgl.TextLineScene.drawLine(TextLineScene.java:72)
at org.jetbrains.skija.examples.lwjgl.TextLineScene.draw(TextLineScene.java:123)
at org.jetbrains.skija.examples.lwjgl.Window.draw(Main.java:145)
at org.jetbrains.skija.examples.lwjgl.Window.loop(Main.java:368)
at org.jetbrains.skija.examples.lwjgl.Window.run(Main.java:60)
at org.jetbrains.skija.examples.lwjgl.Main.main(Main.java:31)

If I replace "" with " " on line 123 in TextLineScene.java then it works
I guess it's something with getting the coord and/or lineHeight for an empty string.

Skija on iOS

Hi, I am trying to write a word processor using skija/skiko as an abstraction on Desktops and mobiles, but I wonder how will skija run on iOS as it uses JNI(Kotlin multiplatform must use stdlib). Is there any roadmap for targeting iOS?

Drawing with Jetpack Desktop

Hi !

Trying to move some code to Jetpack Desktop :)

Making a snapshot from Surface.makeRasterN32Premul get me the right color result as I export to file
Using this same snapshot got me grayscale image when displayed with

Canvas(
                    modifier = Modifier.fillMaxSize()
                ) {
                    drawIntoCanvas { canvas ->
                        canvas.nativeCanvas.drawImage(loaded.value, 0f, 0f)
                    }
                }

Seems strange. do I've to reencode bytes ???

Thanks !

SKIJA Multiplatform

Hi, will it be converted to Kotlin to support Kotlin Multiplatform? We are analysing the possibilities to use SKIA in both android and ios. We need multiplatform binding for SKIA. Is there any possibility that SKIJA goes multiplatform binding for SKIA.

Generating cc files

Hi, I want to contribute Skija by writing binding for Skia's PDF module. As I am new to JNI, I want to know cc files are generated using any script or written. Maybe it is a dumb question but I do not know exactly where to start to write the binding.

When install have error

Hi,
I install with maven
It have errors
Capture

I dont know it, Can you fix help me?
Thanks!
Alexi

Binding requests

Hi

Here I put some some non-connected features that I found when coding with Skija.
I'll list more as I explore the API.

  • path.rewind()
  • path.drawPatch()
  • path.drawPoints using Points

Cheers

Can't run LWJGL example on macOS

16-in Macbook, macOS 10.15.7

When I run ./script/install.sh I get:

Using Skia from /Users/miller/Projects/skija/native/Skia-m88-59bafeeaa7-macos-Release-x64
CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

Not surprisingly, given those errors, when I try to run the LWJGL example:

$ cd examples/lwjgl 
README.md	fonts		images		lwjgl.iml	pom.xml		script		src		texts
$ ./script/exec.sh
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.442 s
[INFO] Finished at: 2020-11-18T18:26:28-08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project lwjgl: Could not resolve dependencies for project org.jetbrains.skija.examples:lwjgl:jar:0.1.0: Could not find artifact org.jetbrains.skija:skija-native:jar:0.0.0-SNAPSHOT in space-maven (https://packages.jetbrains.team/maven/p/skija/maven) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Binding request

Hi,

would it be possible to add bindings for DirectContext.resetContext so that we can implement Skija into 3D OpenGL applications?
Building Skija through the Docker image sadly doesn't work properly for me, so I can't add it myself :(

Thank you!

Bindings requests

Hi !

Thanks for Color4f, code is now much more direct.

Instead of opening a ticket each time I'd like to suggest a list of methods & maybe influence you in your implementation priorities...

Thanks !

  • path.rewind()

  • path.drawPatch()

  • path.drawPoints with Points

  • Canvas drawTextOnPath

  • Gradient with SkPoint instead of float (help a lot with sugar syntax / conversions)

  • Canvas.saveLayer with Rect

Also I've never linked Java to C but maybe later I'll be able to connect some API calls.

How to run skja without jogl or lwjgl?

Hello,
i was wondering if it possible to have the examples run in desktop without the aid of lwjgl or jogl. Any other dependency free way to do that?

Drawable

Hi !

My stuffs are getting more complex using Skija and I'd like to refactor to Kotlin objects drawn as SK Drawable.
Do you have an estimation for landing this feature in your roadmap ?

Thanks !

Paragraph.getLineMetrics() hangs when paragraph contains placeholder

val fontCollection = FontCollection().setDefaultFontManager(FontMgr.getDefault())
val style = ParagraphStyle()
val paragraph = ParagraphBuilder(style, fontCollection)
        .pushStyle(TextStyle().setColor(0xFF000000.toInt()))
        .addText("Text")
        .addPlaceholder(PlaceholderStyle(2f, 2f, PlaceholderAlignment.BASELINE, BaselineMode.ALPHABETIC, 0f))
        .popStyle()
        .build()
paragraph.layout(Float.POSITIVE_INFINITY)
paragraph.paint(canvas, 0f, 0f)
paragraph.getLineMetrics()

Reproduced on b703f6e and isn't reproduced before it

Render without Graphic Context

Hi Skija Team,

Thanks for the work on this lib, can't wait to see how it will integrate with yours IDE solutions.

Here are 2 questions that need some help please :

  • Is is possible to render image without any graphic context directly calling cpu | gpu ?

  • How compatible is it with Graal VM ?

Thank you !

Robert

problem running Clojure example on Ubuntu 20.04

Hello! I am trying to run the Clojure example on Ubuntu 20.04 and running into an error:

oakmac@oakmac-desktop:~/skija/examples/clojure$ java -version
openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12-Ubuntu-120.04)
OpenJDK 64-Bit Server VM (build 14.0.2+12-Ubuntu-120.04, mixed mode, sharing)

oakmac@oakmac-desktop:~/skija/examples/clojure$ clj -M -m lwjgl.main
[LWJGL] Failed to load a library. Possible solutions:
	a) Add the directory that contains the shared library to -Djava.library.path or -Dorg.lwjgl.librarypath.
	b) Add the JAR that contains the shared library to the classpath.
[LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
[LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics.
Execution error (UnsatisfiedLinkError) at org.lwjgl.system.Library/loadSystem (Library.java:162).
Failed to locate library: liblwjgl.so

Full report at:
/tmp/clojure-10182201394873438874.edn

The full clojure error report can be found here.

Some searching leads me to believe this is not specific to skija, but rather something related to including a library path on the CLI or via deps.edn (I am not exactly sure though).

I thought I would make an issue for help and also to document this in case anyone else runs into a similar problem.

Native files not loading

Hi, I have tried a kotlin project with skija with 'org.jetbrains.skija:skija:0.4.39'. when I run the project I get "java.lang.UnsatisfiedLinkError: org.jetbrains.skija.Paint._nGetFinalizer()J" Am i missing something

Gradle dependency

I'm probably missing something obvious, but I've added "org.jetbrains.skija:skija-windows:0.6.18" to my Gradle file as suggested by the Getting Started guide, however Gradle cannot find it. The maven repository seems to only have Skija up to version 0.4.39 and no mention of "skija-windows". Has it been moved to a different repository?

How to use PathEffect MakeSum

Hello,

I'm trying to use makesum with a path.
I saw that _makesum is here but I think it's internal only ?

Love this package !
thx

Add support for camera distance

Considering that Skija is used to power compose on the desktop, there should be some parallel support for existing graphics facilities that are part of the compose API surface. Jetpack compose supports "camera distance" parameters on layer that is useful for handling rotations around the x and y axis (for example, card flip animations). This requires leveraging Sk3DView APIs in skia which would need to be included in the Skija bindings.

https://cs.android.com/androidx/platform/frameworks/support/+/androidx-master-dev:compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/platform/SkijaLayer.kt;l=130?q=SkijaLayer

A link to the implementation of camera distance in the Android framework is shown in this link and can be leveraged within the Skija implementation.

On the JetBrains Vision

Could skija be used by JetBrains IDEs for faster rendering performance?
I wonder if this is a long term goal.
But I bet regarding this goal it would be easier to make jetbrains IDEs use electron.

I seems that jetbrains is porting jetpack compose to the desktop and that skija will be a dependency.
While jetpack compose will probably be nice and could become a decent cross platform GUI library,
the cold hard truth is that 1) nobody has the human resources to match the feature rich and optimization level of chromium/electron (just look at the commit count! This is the biggest open source project ever).
2) being cross platform except for the web is an unacceptable elephant in the room for most and explain with 1) the success of electron/ionic.

Kotlin can transpile to js/ts which is nice but do not enable seamless compatibility with js the same way typescript can.
Js is the biggest GUI/frontend ecosystem to exist.
Now that I explained the limitations of the current vision of jetbrains (building a semi cross platform gui library: jetpack compose) I would like to share an additional vision: the true revolution that await this century:

JetBrains needs to fork chromium and to incorporate into it graalVM. Such a fork could hence allow native Java and Kotlin support and could add DOM/browser methods bindings (either trough js or c++ / webIDL) in a way that webassembly could never do.
Such a project would bring the best of all worlds:

  1. Keep the GUI engine with the most human resources since decades:
    So maximum feature and optimization level which is mandatory for building rich competitive GUIs.
    This should not be understated.
  2. keep the security guarantees of the web (sandboxing, etc)
  3. enable to use the best GUI engine with the kotlin (and java) ecosystem and "native" performance instead of transpiled js.
  4. have true seamless compatibility with the js ecosystem contrary to kotlinjs: through graalVM state of the art polyglostism.

Once we have this, you would have built a breakthrough that would be unprecedented:
That would be the first time where we could be able to simultaneously use the state of the art GUI engine (chromium) with a state of the art programming language (Kotlin) instead of being stuck with javascript which is less expressive, performant, ergonomic and has a higher cognitive overhead. Today kotlinjs cannot seamlessly do that because In order to be seamless you need true js/ts compatibility the same way as Kotlin is compatible with Java. GraalVM (through a little bit of funding for maturation) polyglostism allows just that and would connect the two biggest software ecosystems in the world (so that would be two revolutionary breakthrough at once)
Once those two revolutionary breakthrough are achieved that is:

  1. invest in graalVM JS in order to make it mature (the implementation is already decent)
  2. port graalVM inside chromium
  3. enable for the first time bindings of browser APIs to another language than js (Kotlin) (webassembly cannot do that and this is the exact reason it will not really reach mainstream)
    Those bindings could be automated through webIDL, or through Kotlin native interop with C (as they exist to my knowledge both in C++ and in JS), or through wrappers (eventually with KotlinJS) but the most simple would be to just leverage once again graalVM compatibility between Js and Kotlin.
  4. integrate this chromium fork into elektron
    Once this is achieved you have built the successor of electron and therefore the first truly great cross platform GUI engine since the dawn of programming. That would make JetBrains shine in all developper circles as the hero we didn't know we wanted but the one we all needed to deliver us from JS mediocrity monopoly that inflict pain on deceloppers, on performance and on software poverty (not being able to reuse the brilliant Java ecosystem).
    Once such a widespread success of "EleKtron" is achieved I bet that Chromium and other browsers developers would consider that after showing them the empirical evidence, that this GraalVM port would be actually an order of magnitude better webassembly (but does not obscolete webassembly for C/C++ at least not certainly) but would be the webBytecofe that truly used languages (high level ones) needs.

This Vision that I describe is arguably one of the biggest breakthrough awaiting the 21st century in programming. As explained above it would simultaneously solve extremely big problems and GraalVM has paved the way towards a solution to them. Unification of software platforms/ecosystems instead of reinventing the wheel is the big rational trends that factually save billions of human resources $ and allows qualitative synergies.
Microsoft among others is adopting the premises of this Vision:
E.g by migrating edge from a duplicated reimplementation of the web interfaces to improving a shared, universal implementation (chromium)
JetBrains is also one of the key enterprises to share the premises of the Vision: by understanding and striving for maximal compatibility between Kotlin and the JVM ecosystem.
The Vision that I have described is actually the consequence of pushing the boundaries of the JetBrains Vision!

I hope that you, engineers reading this, will talk about it internally at JetBrains and investigate if you will pursue your Vision.

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.