[![obsolete JetBrains project](https://jb.gg/badges/obsolete.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
⚠️ **This repository is no longer actively maintained.** ⚠️
Active Skija project is located at [HumbleUI/Skija](https://github.com/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.
![](extras/logo.png)
## 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:
- [github.com/bytedeco/javacpp-presets/tree/master/skia](https://github.com/bytedeco/javacpp-presets/tree/master/skia)
- [github.com/eungju/skia-javacpp](https://github.com/eungju/skia-javacpp)
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](https://www.jetbrains.com/lp/compose/), declarative UI toolkit for Kotlin:
![](extras/compose-apps.png)
[Skija Graphics2D](https://github.com/jfree/skijagraphics2d/), an implementation of Java2D API:
![](extras/skijagraphics2d.png)
[Robert Felker](https://twitter.com/BlueAquilae/status/1322696020329902082) demos:
|![](extras/Elso-W-XYAEKmFg.jpg)|![](extras/Ev-CCy_XMAEM51f.jpg)|
|---|---|
|![](extras/Elso-WsWoAExiUF.jpg)|![](extras/Elso-WfWMAED8dc.jpg)|
[Harold](https://www.instagram.com/_hrrld/) videos:
![](extras/110151060-3a840480-7d9d-11eb-9996-a8dc1ed1ab6a.jpg)
[Skija demo app](examples/lwjgl):
|![](extras/geometry.png)|![](extras/text.png)|
|---|---|
|![](extras/bitmap.png)|![](extras/pythagoras.png)|
|![](extras/filters.jpg)|![](extras/shaders.png)|
## 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:
- [x] Windows
- [x] Linux
- [x] macOS
Backends:
- [x] Bitmap
- [x] OpenGL
- [x] Direct3D
- [x] 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:
```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>
<artifactId>skija-${platform}</artifactId>
<version>${version}</version>
</dependency>
</dependencies>
```
Gradle:
```gradle
reposito
没有合适的资源?快使用搜索试试~ 我知道了~
Java bindings for Skia.zip
共531个文件
java:270个
cc:74个
png:34个
需积分: 1 0 下载量 111 浏览量
2024-02-28
21:23:21
上传
评论
收藏 8.42MB ZIP 举报
温馨提示
Java bindings for Skia.zip
资源推荐
资源详情
资源评论
收起资源包目录
Java bindings for Skia.zip (531个子文件)
bmp.bmp 156KB
interop.cc 38KB
Path.cc 24KB
Canvas.cc 18KB
Font.cc 17KB
Shaper.cc 16KB
ImageFilter.cc 15KB
TextStyle.cc 14KB
Surface.cc 14KB
Bitmap.cc 13KB
TextBlob.cc 13KB
Paint.cc 11KB
Typeface.cc 11KB
Paragraph.cc 10KB
Shader.cc 10KB
Region.cc 9KB
interop.cc 9KB
Pixmap.cc 9KB
ParagraphStyle.cc 7KB
TextLine.cc 7KB
Image.cc 7KB
StrutStyle.cc 5KB
ColorFilter.cc 5KB
FontCollection.cc 5KB
BreakIterator.cc 5KB
Animation.cc 5KB
SVGSVG.cc 5KB
PathMeasure.cc 4KB
Picture.cc 4KB
Codec.cc 4KB
FontRunIterator.cc 4KB
TextBlobBuilder.cc 4KB
FontMgr.cc 3KB
PathEffect.cc 3KB
AnimationBuilder.cc 3KB
ParagraphBuilder.cc 3KB
Data.cc 3KB
DirectContext.cc 3KB
Drawable.cc 3KB
ColorSpace.cc 3KB
RuntimeEffect.cc 3KB
PictureRecorder.cc 3KB
PathSegmentIterator.cc 3KB
interop.cc 2KB
ParagraphCache.cc 2KB
ManagedString.cc 2KB
BackendRenderTarget.cc 2KB
MaskFilter.cc 2KB
FontStyleSet.cc 2KB
SVGDOM.cc 2KB
PixelRef.cc 2KB
InvalidationController.cc 2KB
interop.cc 2KB
interop.cc 2KB
PaintFilterCanvas.cc 2KB
FontMgrRunIterator.cc 2KB
OutputWStream.cc 2KB
ManagedRunIterator.cc 1KB
ShadowUtils.cc 1KB
Logger.cc 1KB
TextBlobBuilderRunHandler.cc 1KB
Library.cc 1KB
U16String.cc 997B
TypefaceFontProvider.cc 974B
IcuBidiRunIterator.cc 807B
HbIcuScriptRunIterator.cc 796B
RefCnt.cc 685B
BufferUtil.cc 604B
DataURIResourceProviderProxy.cc 557B
SVGCanvas.cc 527B
CachingResourceProvider.cc 516B
Managed.cc 431B
FileResourceProvider.cc 419B
SVGNode.cc 325B
ColorType.cc 249B
game.clj 9KB
main.clj 3KB
main.clj 2KB
FindSkia.cmake 6KB
lombok.config 85B
lombok.config 58B
Dockerfile 1KB
Dockerfile 98B
.dockerignore 59B
deps.edn 1KB
deps.edn 1KB
animated.gif 230KB
gif.gif 14KB
.gitignore 113B
interop.hh 10KB
TextLineRunHandler.hh 5KB
interop.hh 3KB
FontRunIterator.hh 3KB
TextLine.hh 1KB
interop.hh 901B
interop.hh 687B
interop.hh 544B
dotpeek.ico 264KB
favicon.ico 5KB
Path.java 82KB
共 531 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
日刷百题
- 粉丝: 5307
- 资源: 951
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功