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
COIL ことはじめ
Search
Mizuki Furusawa
September 10, 2019
Programming
2
2.1k
COIL ことはじめ
Mizuki Furusawa
September 10, 2019
Tweet
Share
Other Decks in Programming
See All in Programming
CI_CD「健康診断」のススメ。現場でのボトルネック特定から、健康診断を通じた組織的な改善手法
teamlab
PRO
0
180
GitHub Actions × AWS OIDC連携の仕組みと経緯を理解する
ota1022
0
240
エンジニアとして高みを目指す、 利益を生み出す設計の考え方 / design-for-profit
minodriven
23
12k
ИИ-Агенты в каждый дом – Алексей Порядин, PythoNN
sobolevn
0
150
After go func(): Goroutines Through a Beginner’s Eye
97vaibhav
0
230
Swift Concurrency - 状態監視の罠
objectiveaudio
2
450
Catch Up: Go Style Guide Update
andpad
0
160
10年もののAPIサーバーにおけるCI/CDの改善の奮闘
mbook
0
770
私達はmodernize packageに夢を見るか feat. go/analysis, go/ast / Go Conference 2025
kaorumuta
2
480
いま中途半端なSwift 6対応をするより、Default ActorやApproachable Concurrencyを有効にしてからでいいんじゃない?
yimajo
2
330
Serena MCPのすすめ
wadakatu
4
890
CSC509 Lecture 02
javiergs
PRO
0
400
Featured
See All Featured
Music & Morning Musume
bryan
46
6.8k
Building Adaptive Systems
keathley
43
2.8k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
A designer walks into a library…
pauljervisheath
209
24k
Reflections from 52 weeks, 52 projects
jeffersonlam
352
21k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
890
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
19
1.2k
Optimizing for Happiness
mojombo
379
70k
How to Think Like a Performance Engineer
csswizardry
27
2k
Transcript
$"BQL ɹɹɹ͜ͱ͡Ί 2019.9.10 / Mizuki Furusawa (@mzkii)
$"BQL ɹɹɹ͜ͱ͡Ί ❌ 2019.9.10 / Mizuki Furusawa (@mzkii)
$"BQL ৄղɹɹɹͷ෦࣮ 2019.9.10 / Mizuki Furusawa (@mzkii)
Whoami • Mizuki Furusawa (@mzkii) • 2019/4 ~ CyberAgent, Inc.
• λοϓϧੜ • Android Engineer • Kotlin/Java/C/C++/Python/Cats
Coroutine Image Loader
Coroutine Image Loader “An image loading library for Android backed
by Kotlin Coroutines.” Fast / Lightweight / Easy to use / Modern
αϙʔτ͞Ε͍ͯΔσʔλܗࣜ • String (mapped to a Uri) • HttpUrl •
Uri (android.resource, content, file, http, and https schemes only) • File • @DrawableRes Int • Drawable • Bitmap +α GIF SVG (0.7.0)
ಋೖ • mavenCentral()
͍ํ • “To load an image into an ImageView,
use the load extension function:”
͍ํ • ϥϜμࣜͰΦϓγϣϯΛࢦఆ͢Δ͜ͱ͕Ͱ͖Δɻ
Transformations • Glide Piccaso ͷΑ͏ʹɺ COIL ʹҎԼͷը૾Ճ༻ͷΫϥε͕ඪ४Ͱ༻ҙ͞Ε͍ͯΔɻ • BlurTransformation
• CircleCropTransformation • GrayscaleTransformation • RoundedCornersTransformation
Dynamic image sampling
Coil-transformations • 3rd party ͷϥΠϒϥϦެ։͞Ε͍ͯΔ (relies on GPUImage) • ColorFilterTransformation
• CropTransformation (top, center, bottom) • MaskTransformation • SquareCropTransformation • PixelationFilterTransformation • ContrastFilterTransformation • …and more
Control memory cache and bitmap pool
Control memory cache and bitmap pool
Control memory cache and bitmap pool
Control memory cache and bitmap pool
Control memory cache and bitmap pool
ImageLoader ͱ?
ImageLoader • “Image Loaders are service objects that handle image
requests with load and get. They handle caching, image decoding, request management, bitmap pooling, memory management, and more.”
ImageViews.kt • “Image Loaders are service objects that handle image
requests with load and get. They handle caching, image decoding, request management, bitmap pooling, memory management, and more.”
ImageViews.kt • “Image Loaders are service objects that handle image
requests with load and get. They handle caching, image decoding, request management, bitmap pooling, memory management, and more.”
Application.kt
Application.kt
Application.kt
ImageLoader.kt
ImageLoader.kt
ImageLoader
ImageLoader
ImageLoader = RealImageLoader
RealImageLoader ͲͷΑ͏ʹը૾ΛಡΈࠐΉͷ͔
RealImageLoader • Mapper • Fetcher • Decoder
Mapper • ҙͷσʔλܕ T Λ FetcherͰѻ͏͜ͱͷͰ͖ΔܕʹϚοϐϯά͢Δɻ
Fetcher • ҙͷσʔλܕ T Λ BufferedSource ·ͨ Drawable ʹม͢Δɻ
Fetcher • ҙͷσʔλܕ T Λ BufferedSource ·ͨ Drawable ʹม͢Δɻ
Decoder • BufferedSource Λ Drawableʹม͢Δɻ
RealImageLoader • Mapper • Fetcher • Decoder 3FBM*NBHF-PBEFS )UUQ6SM'FUDIFS )UUQ6SM
#V⒎FSFE4PVSDF 4USJOH.BQQFS 63- 4USJOH 6SJ )UUQ6SJ.BQQFS 6SJ)UUQ6SM #JUNBQ'BDUPSZ %FDPEFS #V⒎FSFE4PVSDF %SBXBCMF
None
None
ImageViews.kt
ImageViews.kt
RealImageLoader.kt
None
RealImageLoader.kt
None
None
None
None
4USJOH.BQQFS 63- 4USJOH 6SJ
None
None
)UUQ6SJ.BQQFS 6SJ)UUQ6SM
None
None
)UUQ6SM'FUDIFS )UUQ6SM #V⒎FSFE4PVSDF
None
None
None
RealImageLoader.kt
RealImageLoader.kt
RealImageLoader.kt )UUQ6SM'FUDIFS )UUQ6SM #V⒎FSFE4PVSDF
)UUQ6SM'FUDIFS )UUQ6SM #V⒎FSFE4PVSDF
None
None
None
#JUNBQ'BDUPSZ %FDPEFS #V⒎FSFE4PVSDF %SBXBCMF
#JUNBQ'BDUPSZ %FDPEFS #V⒎FSFE4PVSDF %SBXBCMF
None
None
None
None
None
None
None
None
·ͱΊ • ػೳతʹ Glide Piccaso ͳͲଞͷը૾ϥΠϒϥϦͱେମҰॹ • COIL
Glide Fresco ͷը૾ϥΠϒϥϦͱൺͯܰྔ • Glide ͷ8ͷ1ͷαΠζ • ଞͷը૾ϥΠϒϥϦͱൺͯΑΓ Kotlin Ά͍ॻ͖ํ͕Ͱ͖Δ • Dynamic image sampling Λదʹ͑ UX Λམͱͣ͞ʹ ϝϞϦͷ༻ྔΛ͑Δ͜ͱ͕Ͱ͖Δ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠