Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Skia and Skija, Skiko [ja]
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Daichi Furiya (Wasabeef)
December 21, 2020
Programming
2.1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Skia and Skija, Skiko [ja]
Daichi Furiya (Wasabeef)
December 21, 2020
More Decks by Daichi Furiya (Wasabeef)
See All by Daichi Furiya (Wasabeef)
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
6
2.8k
About Flutter Architecture
wasabeef
1
320
2023 Flutter/Dart Summary
wasabeef
0
130
I/O Extended 2023 - Dart と Flutter の新機能
wasabeef
0
230
I/O Extended 2023 - Flutter 活用事例
wasabeef
10
3.1k
What it Takes to be a Flutter Developer
wasabeef
0
250
FlutterKaigi 2022 Keynote
wasabeef
1
720
Flutter Hooks を使ったアプリ開発 / App Development with the Flutter Hooks
wasabeef
2
1.5k
Flutter 2021 の振り返りと今後のアプリ開発に向けて / Looking back on Flutter 2021 and for future app development.
wasabeef
4
2.2k
Other Decks in Programming
See All in Programming
Lessons from Spec-Driven Development
simas
PRO
0
200
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
280
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
180
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
5.1k
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
330
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
540
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.6k
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
140
Inside Stream API
skrb
1
720
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
130
CSC307 Lecture 17
javiergs
PRO
0
320
New "Type" system on PicoRuby
pocke
1
930
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
180
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Making the Leap to Tech Lead
cromwellryan
135
9.9k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Utilizing Notion as your number one productivity tool
mfonobong
4
320
Into the Great Unknown - MozCon
thekraken
41
2.6k
Designing for humans not robots
tammielis
254
26k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
330
Transcript
Skia and Skija, Skiko Daichi Furiya #ca_flutter_kmm
About me Daichi Furiya (降矢 大地) Google Developers Expert CyberAgent,
Inc. @wasabeef_jp wasabeef
None
None
Skia? • グラフィックライブラリ(エンジン) • Chrome, Android, Flutter, Firefox, .NET, Compose
for Desktop などで採用されている • Android 9 以降、デフォルトのレンダラーは Skia に なっている(8 と 9 で UI が変わった)
Supported platforms •Windows 7, 8, 8.1, 10 •macOS 10.10.5 or
later •iOS 8 or later •Android 4.1 (JellyBean) or later •Ubuntu 14.04+, Debian 8+, openSUSE 13.3+, or Fedora Linux 24+
Case: Skia + Flutter
Showcase Shapes ベジェ曲線 平行移動と回転 テキストレンダリング シェーダー パス
SkCanvas + SkPaint sample void draw(SkCanvas* canvas) { SkPaint p;
p.setColor(SK_ColorRED); p.setAntiAlias(true); p.setStyle(SkPaint:::kStroke_Style); p.setStrokeWidth(150); canvas->-drawLine(75, 75, 175, 175, p); } Android 寄りだけど、よくある Canvas API
SkCanvas - Backends •Raster - CPU-only. •GPU - Skia's GPU-accelerated
backend. •SkPDF - PDF document creation. •SkPicture - Skia's display list format. •NullCanvas - Useful for testing only. •SkXPS - Experimental XPS backend. •SkSVG - Experimental SVG backend. SkCanvas には複数のバックエンドが用意されている
GPU GPU には Skia のビルド時に Webkit/Canvas、 OpenGL、OpenGL ES、Vulkan、Metal などのモード を選択することができる。
Skia のメリット •コード量の削減(例:LibreOffice は 12k → 4k) •一貫性のある API •クロスプラットフォームの対応
•複数のバックエンドサポート Webkit/Canvas、OpenGL (ES)、Vulkan、Metal
Flutter Web でのデメリット •Webkit/Canvas でテキストを描画しているので、文 字列の選択などができない
Compose for Desktop
Compose for Desktop
Desktop アプリを作るということどういうことか 前提:クロスプラットフォーム パフォーマンスが高くない WASM は高速だが、JS + DOM はJVM よりもはるかに低速
• JVM はパフォーマンスは高い が、AWT、Swing、JavaFX はメ モリ割り当てしすぎないように気 をつけないといけない。 • OpenGL は難しい
Compose for Desktop fun main() { overrideSchedulers(main = Dispatchers.Main:::asScheduler) val
lifecycle = LifecycleRegistry() lifecycle.resume() Window("Todo") { Surface(modifier = Modifier.fillMaxSize()) { MaterialTheme { DesktopTheme { Text(“Hello World!!!”) } } } } } ほぼ Jetpack Compose になっている
None
Skija • JetBrains 開発 • Skia for Java (Java bindings
to Skia) • Graphics2D、GraphicsContext は古い • 最新の Typography 対応 • Vulkan* や Metal 対応
Skija が目指すところ • 自動でメモリ管理、リークなし • Java のコードスタイルに準拠 • Integer constants
よりも enum • Fluent API • Skija から ネイティブ Skia を感じさせない設計
Skija - build.gradle repositories { maven { url 'https:///packages.jetbrains.team/maven/p/skija/maven' }
} dependencies { /// macOS, windows, linux api “org.jetbrains.skija:skija-${platform}:0.1.+” } ↑ 各 OS 毎に Artifacts が分かれているのでビルド時に切り替えて使う
Skiko
Skiko? • JetBrains 開発 • Skia for Kotlin (Kotlin MP
bindings to Skia)
Skiko - build.gradle repositories { maven { url 'https:///packages.jetbrains.team/maven/p/ui/dev' }
} dependencies { /// macOS, windows, linux implementation “org.jetbrains.skiko:skiko-jvm-runtime-${platform}:0.1.+” } ↑ 各 OS 毎に Artifacts が分かれているのでビルド時に切り替えて使う
Skiko - App.kt fun main(args: Array<String>) { SkiaWindow().apply { layer.renderer
= Renderer { renderer, w, h ->- val canvas = renderer.canvas!!! val paint1 = Paint().setColor(0xffff0000.toInt()) /// ARGB canvas.drawRRect(RRect.makeLTRB(10f, 10f, w - 10f, h - 10f, 5f), paint1) val paint2 = Paint().setColor(0xff00ff00.toInt()) /// ARGB canvas.drawRRect(RRect.makeLTRB(30f, 30f, w - 30f, h - 30f, 10f), paint2) } setVisible(true) setSize(800, 600) } } SkiaWindow が UI のコンテナ になるので、その上で描画する
Skiko - SkiaLayer open class SkiaWindow : JFrame() { val
layer = SkiaLayer() init { contentPane.add(layer) addComponentListener(object : ComponentAdapter() { override fun componentResized(e: ComponentEvent) { layer.reinit() } }) } fun display() = layer.display() } javax.swing.JFrame を実装して SkiaLayer を渡しているだけ
Skiko - SkiaLayer open class SkiaLayer() : HardwareLayer() { open
val api: GraphicsApi = GraphicsApi.OPENGL /// ..... override fun draw() { if (!inited) { if (skijaState.context === null) { skijaState.context = when (api) { GraphicsApi.OPENGL ->- makeGLContext() GraphicsApi.METAL ->- makeMetalContext() else ->- TODO("Unsupported yet") } } renderer??.onInit() inited = true renderer??.onReshape(width, height) } initSkija() /// ..... } /// ..... } HardwareLayer はただの awt.Canvas で api: GraphicApi でコンテキストを変えている。 Skija が Vulkan の対応はまだ追いついていない 実際に draw している先は Skija Canvas。 ここから Skija の世界へ。
CanvasKit
CanvasKit • Skia for WebAssembly • WebGL のサポート
CanvasKit + Skottie • Lottie Animation Support
SkiaSharp
SkiaSharp .NET Standard 1.3 .NET Core Tizen Xamarin.Android Xamarin.iOS Xamarin.tvOS
Xamarin.watchOS Xamarin.Mac Windows Classic Desktop(Windows.Forms / WPF) Windows UWP (Desktop / Mobile / Xbox / HoloLens) Web Assembly (WASM) • Microsoft 開発
None
Kotlin MP App Skiko Skija Flutter App Flutter engine •
Android • iOS • Windows • macOS • Linux Skia • Android • Windows • macOS • Linux Skia • iOS?
twitter.com/wasabeef_jp wasabeef.jp github.com/wasabeef Thanks