Skip to content

Commit

Permalink
Renamed package org.jetbrains.skija -> io.github.humbleui.skija
Browse files Browse the repository at this point in the history
  • Loading branch information
tonsky committed Nov 3, 2021
1 parent 30eaaeb commit 8d2e574
Show file tree
Hide file tree
Showing 377 changed files with 1,755 additions and 1,679 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 0.96.0

Changed:

- Skia version m93-87e8842e8c -> m96-2f1f21b8a9
- Renamed package org.jetbrains.skija -> io.github.humbleui.skija
- Renamed maven group org.jetbrains.skija -> io.github.humbleui.skija

# 0.93.4 - Sep 20, 2021

Added:
Expand Down
27 changes: 7 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,9 @@ Using Skija is as simple as adding a jar file.
Maven:

```xml
<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>
<groupId>io.github.humbleui.skija</groupId>
<artifactId>skija-${platform}</artifactId>
<version>${version}</version>
</dependency>
Expand All @@ -169,25 +162,19 @@ Maven:
Gradle:

```gradle
repositories {
maven {
url "https://packages.jetbrains.team/maven/p/skija/maven"
}
}
dependencies {
api "org.jetbrains.skija:${artifact}:${version}"
api "io.github.humbleui.skija:${artifact}:${version}"
}
```

Replace `${artifact}` and `${version}` with:

Platform | `${artifact}` | `${version}`
------------|---------------------|-------------
macOS Intel | `skija-macos-x64` | ![version](https://img.shields.io/badge/dynamic/xml?style=flat-square&label=latest&color=success&url=https%3A%2F%2Fpackages.jetbrains.team%2Fmaven%2Fp%2Fskija%2Fmaven%2Forg%2Fjetbrains%2Fskija%2Fskija-macos-x64%2Fmaven-metadata.xml&query=//release)
macOS M1 | `skija-macos-arm64` | ![version](https://img.shields.io/badge/dynamic/xml?style=flat-square&label=latest&color=success&url=https%3A%2F%2Fpackages.jetbrains.team%2Fmaven%2Fp%2Fskija%2Fmaven%2Forg%2Fjetbrains%2Fskija%2Fskija-macos-arm64%2Fmaven-metadata.xml&query=//release)
Linux | `skija-linux` | ![version](https://img.shields.io/badge/dynamic/xml?style=flat-square&label=latest&color=success&url=https%3A%2F%2Fpackages.jetbrains.team%2Fmaven%2Fp%2Fskija%2Fmaven%2Forg%2Fjetbrains%2Fskija%2Fskija-linux%2Fmaven-metadata.xml&query=//release)
Windows | `skija-windows` | ![version](https://img.shields.io/badge/dynamic/xml?style=flat-square&label=latest&color=success&url=https%3A%2F%2Fpackages.jetbrains.team%2Fmaven%2Fp%2Fskija%2Fmaven%2Forg%2Fjetbrains%2Fskija%2Fskija-windows%2Fmaven-metadata.xml&query=//release)
macOS Intel | `skija-macos-x64` | ![version](https://img.shields.io/maven-central/v/io.github.humbleui.skija/skija-macos-x64)
macOS M1 | `skija-macos-arm64` | ![version](https://img.shields.io/maven-central/v/io.github.humbleui.skija/skija-macos-arm64)
Linux | `skija-linux` | ![version](https://img.shields.io/maven-central/v/io.github.humbleui.skija/skija-linux)
Windows | `skija-windows` | ![version](https://img.shields.io/maven-central/v/io.github.humbleui.skija/skija-windows)

## Documentation

Expand All @@ -214,7 +201,7 @@ Prerequisites: Git, CMake, Ninja, JDK 9+, $JAVA_HOME, Python 3.
Checkout:

```sh
git clone https://github.com/JetBrains/skija.git
git clone https://github.com/HumbleUI/Skija.git
cd skija
./script/build.py
```
Expand Down
2 changes: 1 addition & 1 deletion docs/Conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- Methods that don’t make sense (C++ specific, etc)
- Fix minor inconsistencies in naming
- Methods that would clash with the Java ones (e.g. `SkPath#close` would clash with `Managed#close`, so it became `Path#closePath` in Skija)
- Skia modules -> org.jetbrains.skija.* subpackages
- Skia modules -> io.github.humbleui.skija.* subpackages

# General naming conventions

Expand Down
44 changes: 21 additions & 23 deletions docs/Getting Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,24 @@
Add ONE of these dependencies to your ant/maven/gradle/bazel:

```
org.jetbrains.skija:skija-windows:${version}
org.jetbrains.skija:skija-linux:${version}
org.jetbrains.skija:skija-macos-x64:${version}
org.jetbrains.skija:skija-macos-arm64:${version}
io.github.humbleui.skija:skija-windows:${version}
io.github.humbleui.skija:skija-linux:${version}
io.github.humbleui.skija:skija-macos-x64:${version}
io.github.humbleui.skija:skija-macos-arm64:${version}
```

(Replace `${version}` with ![version](https://img.shields.io/badge/dynamic/xml?style=flat-square&label=latest&color=success&url=https%3A%2F%2Fpackages.jetbrains.team%2Fmaven%2Fp%2Fskija%2Fmaven%2Forg%2Fjetbrains%2Fskija%2Fskija-macos-x64%2Fmaven-metadata.xml&query=//release))

The repository url is https://packages.jetbrains.team/maven/p/skija/maven
(Replace `${version}` with ![version](https://img.shields.io/maven-central/v/io.github.humbleui.skija/skija-shared))

In your main class, import

```java
import org.jetbrains.skija.*;
import io.github.humbleui.skija.*;
import java.io.IOException;
```

## Rendering the first image

Most of the Skija value hides in [Canvas](/shared/src/main/java/org/jetbrains/skija/Canvas.java) class. Canvas let you actually draw.
Most of the Skija value hides in [Canvas](/shared/src/main/java/io/github/humbleui/skija/Canvas.java) class. Canvas let you actually draw.

Simplest way to obtain canvas is to create an in-memory, bitmap-backed one:

Expand All @@ -33,7 +31,7 @@ Surface surface = Surface.makeRasterN32Premul(100, 100);
Canvas canvas = surface.getCanvas();
```

To draw something, you often need a [Paint](/shared/src/main/java/org/jetbrains/skija/Paint.java). It stores fill color, stroke settings and various effects. We’ll use a default Paint with red fill color:
To draw something, you often need a [Paint](/shared/src/main/java/io/github/humbleui/skija/Paint.java). It stores fill color, stroke settings and various effects. We’ll use a default Paint with red fill color:

```java
Paint paint = new Paint();
Expand Down Expand Up @@ -90,7 +88,7 @@ var paint = new Paint().setColor(0xFF1D7AA2).setMode(PaintMode.STROKE).setStroke

## Resource management

Most of Skija classes (those extending [RefCnt](/shared/src/main/java/org/jetbrains/skija/impl/RefCnt.java) or [Managed](/shared/src/main/java/org/jetbrains/skija/impl/Managed.java)) are backed by native pointers to C++ world of Skia. Don’t worry — Skija is smart enough to automatically manage everything for you. When java objects are collected, corresponding C++ structures are guaranteed to be freed as well. Programming in Java still feels like Java — safe by default.
Most of Skija classes (those extending [RefCnt](/shared/src/main/java/io/github/humbleui/skija/impl/RefCnt.java) or [Managed](/shared/src/main/java/io/github/humbleui/skija/impl/Managed.java)) are backed by native pointers to C++ world of Skia. Don’t worry — Skija is smart enough to automatically manage everything for you. When java objects are collected, corresponding C++ structures are guaranteed to be freed as well. Programming in Java still feels like Java — safe by default.

```java
void drawCircle(Canvas c) {
Expand All @@ -113,7 +111,7 @@ void drawCircle(Canvas c) {

## Note on getters

You might notice that all fields in Skija are declared public. For example, [Color4f](/shared/src/main/java/org/jetbrains/skija/Color4f.java):
You might notice that all fields in Skija are declared public. For example, [Color4f](/shared/src/main/java/io/github/humbleui/skija/Color4f.java):

```java
@AllArgsConstructor
Expand Down Expand Up @@ -216,7 +214,7 @@ Embedding into AWT window: see [Skiko](https://github.com/jetbrains/skiko).

For drawing text, there are two important concepts: Typeface and Font.

[Typeface](/shared/src/main/java/org/jetbrains/skija/Typeface.java) corresponds to a font file and is relatively expensive to create. You can create typeface directly:
[Typeface](/shared/src/main/java/io/github/humbleui/skija/Typeface.java) corresponds to a font file and is relatively expensive to create. You can create typeface directly:

```java
Typeface face = Typeface.makeFromFile("Inter.ttf");
Expand All @@ -228,7 +226,7 @@ or ask operating system to locate one for you:
Typeface face = FontMgr.getDefault().matchFamilyStyle("Menlo", FontStyle.NORMAL);
```

The [Font](/shared/src/main/java/org/jetbrains/skija/Font.java) contains specific settings the Typeface should be drawn with. The most important one is size:
The [Font](/shared/src/main/java/io/github/humbleui/skija/Font.java) contains specific settings the Typeface should be drawn with. The most important one is size:

```java
Font font = new Font(face, 13);
Expand All @@ -247,20 +245,20 @@ try (Typeface face = FontMgr.getDefault().matchFamilyStyle("Menlo", FontStyle.NO

For this example, we close all resources immediately after paint. In a real application, you would want to cache both Typeface and Font, as it is expensive to recreate them on every frame.

For advanced font rendering, see [Shaper](/shared/src/main/java/org/jetbrains/skija/shaper/Shaper.java) and [ParagraphBuilder](/shared/src/main/java/org/jetbrains/skija/paragraph/ParagraphBuilder.java).
For advanced font rendering, see [Shaper](/shared/src/main/java/io/github/humbleui/skija/shaper/Shaper.java) and [ParagraphBuilder](/shared/src/main/java/io/github/humbleui/skija/paragraph/ParagraphBuilder.java).

## Discovering Skia API

I recommend studying these classes first:

- [Canvas](/shared/src/main/java/org/jetbrains/skija/Canvas.java)
- [Paint](/shared/src/main/java/org/jetbrains/skija/Paint.java)
- [Path](/shared/src/main/java/org/jetbrains/skija/Path.java)
- [Image](/shared/src/main/java/org/jetbrains/skija/Image.java)
- [Shader](/shared/src/main/java/org/jetbrains/skija/Shader.java)
- [Typeface](/shared/src/main/java/org/jetbrains/skija/Typeface.java)
- [Font](/shared/src/main/java/org/jetbrains/skija/Font.java)
- [ParagraphBuilder](/shared/src/main/java/org/jetbrains/skija/paragraph/ParagraphBuilder.java)
- [Canvas](/shared/src/main/java/io/github/humbleui/skija/Canvas.java)
- [Paint](/shared/src/main/java/io/github/humbleui/skija/Paint.java)
- [Path](/shared/src/main/java/io/github/humbleui/skija/Path.java)
- [Image](/shared/src/main/java/io/github/humbleui/skija/Image.java)
- [Shader](/shared/src/main/java/io/github/humbleui/skija/Shader.java)
- [Typeface](/shared/src/main/java/io/github/humbleui/skija/Typeface.java)
- [Font](/shared/src/main/java/io/github/humbleui/skija/Font.java)
- [ParagraphBuilder](/shared/src/main/java/io/github/humbleui/skija/paragraph/ParagraphBuilder.java)

I found [SkiaSharp documentation](https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/) to be excellent resource on what can be done in Skia. They have nice examples and visual explanations, too.

Expand Down
6 changes: 3 additions & 3 deletions examples/bitmap/script/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
set -o errexit -o nounset -o pipefail
cd "`dirname $0`/.."

shared=~/.m2/repository/org/jetbrains/skija/skija-shared/0.0.0-SNAPSHOT/skija-shared-0.0.0-SNAPSHOT.jar
native=~/.m2/repository/org/jetbrains/skija/skija-native/0.0.0-SNAPSHOT/skija-native-0.0.0-SNAPSHOT.jar
shared=~/.m2/repository/io/github/humbleui/skija/skija-shared/0.0.0-SNAPSHOT/skija-shared-0.0.0-SNAPSHOT.jar
native=~/.m2/repository/io/github/humbleui/skija/skija-native/0.0.0-SNAPSHOT/skija-native-0.0.0-SNAPSHOT.jar

if [[ ! -f $shared ]] ; then
../../shared/script/install.sh
Expand All @@ -15,4 +15,4 @@ fi

mkdir -p target/classes
javac -d target/classes -encoding UTF8 --release 11 -cp $native:$shared src/*.java
java -cp target/classes:$native:$shared org.jetbrains.skija.examples.bitmap.RenderToBitmap
java -cp target/classes:$native:$shared io.github.humbleui.skija.examples.bitmap.RenderToBitmap
4 changes: 2 additions & 2 deletions examples/bitmap/src/RenderToBitmap.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jetbrains.skija.examples.bitmap;
package io.github.humbleui.skija.examples.bitmap;

import org.jetbrains.skija.*;
import io.github.humbleui.skija.*;

public class RenderToBitmap {
public static void main(String [] args) throws Exception {
Expand Down
2 changes: 1 addition & 1 deletion examples/clojure-snake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Simple Snake game.
- Clojure 1.10.1
- `clojure` command-line tool 1.10.1.727 or later

You’ll need to build Skija locally, see [README](https://github.com/JetBrains/skija/blob/master/README.md).
You’ll need to build Skija locally, see [README](https://github.com/HumbleUI/Skija/blob/master/README.md).

## Running

Expand Down
3 changes: 1 addition & 2 deletions examples/clojure-snake/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
org.lwjgl/lwjgl-glfw {:mvn/version "3.2.3"}
org.lwjgl/lwjgl-opengl {:mvn/version "3.2.3"}
}
:paths ["src" "../../platform/build" "../../platform/target/classes" "../../shared/target/classes" ]
:mvn/repos {"space-maven" {:url "https://packages.jetbrains.team/maven/p/skija/maven"}}
:paths ["src" "../../platform/build" "../../platform/target/classes" "../../shared/target/classes"]
:aliases {
:macos {
:extra-deps {
Expand Down
2 changes: 1 addition & 1 deletion examples/clojure-snake/src/snake/game.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(:require
[clojure.stacktrace :as stacktrace])
(:import
[org.jetbrains.skija Canvas Color4f Font FontStyle FontMgr Paint PaintMode PaintStrokeCap Rect Typeface]))
[io.github.humbleui.skija Canvas Color4f Font FontStyle FontMgr Paint PaintMode PaintStrokeCap Rect Typeface]))

(def *broken (atom false))

Expand Down
2 changes: 1 addition & 1 deletion examples/clojure-snake/src/snake/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(:require
[snake.game :as game])
(:import
[org.jetbrains.skija BackendRenderTarget Canvas ColorSpace DirectContext FramebufferFormat Paint Rect Surface SurfaceColorFormat SurfaceOrigin]
[io.github.humbleui.skija BackendRenderTarget Canvas ColorSpace DirectContext FramebufferFormat Paint Rect Surface SurfaceColorFormat SurfaceOrigin]
[org.lwjgl.glfw Callbacks GLFW GLFWErrorCallback GLFWKeyCallbackI]
[org.lwjgl.opengl GL GL11]
[org.lwjgl.system MemoryUtil]))
Expand Down
2 changes: 1 addition & 1 deletion examples/clojure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Demonstration of Skija APIs from Clojure.
- Clojure 1.10.1
- `clojure` command-line tool 1.10.1.727 or later

You’ll need to build Skija locally, see [README](https://github.com/JetBrains/skija/blob/master/README.md).
You’ll need to build Skija locally, see [README](https://github.com/HumbleUI/Skija/blob/master/README.md).

## Running

Expand Down
3 changes: 1 addition & 2 deletions examples/clojure/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
org.lwjgl/lwjgl-opengl {:mvn/version "3.2.3"}
nrepl/nrepl {:mvn/version "0.8.3"}
}
:paths ["src" "../../native/build" "../../shared/target/classes" ]
:mvn/repos {"space-maven" {:url "https://packages.jetbrains.team/maven/p/skija/maven"}}
:paths ["src" "../../platform/build" "../../platform/target/classes" "../../shared/target/classes" ]
:aliases {
:macos {
:extra-deps {
Expand Down
2 changes: 1 addition & 1 deletion examples/clojure/src/lwjgl/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(:require
[nrepl.server :as nrepl])
(:import
[org.jetbrains.skija BackendRenderTarget Canvas ColorSpace DirectContext FramebufferFormat Paint Rect Surface SurfaceColorFormat SurfaceOrigin]
[io.github.humbleui.skija BackendRenderTarget Canvas ColorSpace DirectContext FramebufferFormat Paint Rect Surface SurfaceColorFormat SurfaceOrigin]
[org.lwjgl.glfw Callbacks GLFW GLFWErrorCallback]
[org.lwjgl.opengl GL GL11]
[org.lwjgl.system MemoryUtil]))
Expand Down
4 changes: 2 additions & 2 deletions examples/jwm/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
This demo displays most of the Skia/Skija APIs rendered via [JWM](https://github.com/JetBrains/JWM) and is an excellent learning resource.
This demo displays most of the Skia/Skija APIs rendered via [JWM](https://github.com/HumbleUI/JWM) and is an excellent learning resource.

Run with version from Maven:

```
python3 script/run.py --skija-version 0.91.4 --jwm-version 0.1.2
python3 script/run.py --skija-version 0.96.0 --jwm-version 0.2.6
```

Build Skija locally and run with local version:
Expand Down
11 changes: 5 additions & 6 deletions examples/jwm/script/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--skija-version')
parser.add_argument('--jwm-version', default='0.1.170')
parser.add_argument('--jwm-version', default='0.2.6')
parser.add_argument('--jwm-dir', default=None)
(args, _) = parser.parse_known_args()

Expand All @@ -27,14 +27,13 @@ def main():
]
else:
classpath += [
common.fetch_maven('org.jetbrains.jwm', 'jwm-shared', args.jwm_version, repo='https://packages.jetbrains.team/maven/p/jwm/maven'),
common.fetch_maven('org.jetbrains.jwm', 'jwm-' + common.system + '-' + common.arch, args.jwm_version, repo='https://packages.jetbrains.team/maven/p/jwm/maven'),
common.fetch_maven('io.github.humbleui.jwm', 'jwm', args.jwm_version),
]

if args.skija_version:
classpath += [
common.fetch_maven('org.jetbrains.skija', 'skija-shared', args.skija_version, repo='https://packages.jetbrains.team/maven/p/skija/maven'),
common.fetch_maven('org.jetbrains.skija', 'skija-' + common.classifier, args.skija_version, repo='https://packages.jetbrains.team/maven/p/skija/maven'),
common.fetch_maven('io.github.humbleui.skija', 'skija-shared'),
common.fetch_maven('io.github.humbleui.skija', 'skija-' + common.classifier, args.skija_version),
]
else:
build.main()
Expand All @@ -58,7 +57,7 @@ def main():
'-enablesystemassertions',
'-Xcheck:jni',
'-Dskija.logLevel=DEBUG',
'org.jetbrains.skija.examples.jwm.Main'])
'io.github.humbleui.skija.examples.jwm.Main'])

return 0

Expand Down
Loading

0 comments on commit 8d2e574

Please sign in to comment.