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
2k
COIL ことはじめ
Mizuki Furusawa
September 10, 2019
Tweet
Share
Other Decks in Programming
See All in Programming
ワイがおすすめする新潟の食 / 20250530phpconf-niigata-eve
kasacchiful
0
300
[初登壇@jAZUG]アプリ開発者が気になるGoogleCloud/Azure+wasm/wasi
asaringo
0
130
エラーって何種類あるの?
kajitack
5
140
Go1.25からのGOMAXPROCS
kuro_kurorrr
0
230
Enterprise Web App. Development (2): Version Control Tool Training Ver. 5.1
knakagawa
1
110
Javaのルールをねじ曲げろ!禁断の操作とその代償から学ぶメタプログラミング入門 / A Guide to Metaprogramming: Lessons from Forbidden Techniques and Their Price
nrslib
3
1.9k
Passkeys for Java Developers
ynojima
3
850
Cloudflare Realtime と Workers でつくるサーバーレス WebRTC
nekoya3
0
400
Using AI Tools Around Software Development
inouehi
0
1.2k
Cursor Meetup Tokyo ゲノミクスとCursor: 進化と制約のあいだ
koido
2
990
AWS CDKの推しポイント 〜CloudFormationと比較してみた〜
akihisaikeda
3
230
実践ArchUnit ~実例による検証パターンの紹介~
ogiwarat
2
250
Featured
See All Featured
The Language of Interfaces
destraynor
158
25k
Visualization
eitanlees
146
16k
For a Future-Friendly Web
brad_frost
179
9.8k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Bash Introduction
62gerente
614
210k
Making the Leap to Tech Lead
cromwellryan
134
9.3k
Navigating Team Friction
lara
186
15k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.8k
Writing Fast Ruby
sferik
628
61k
Side Projects
sachag
454
42k
GitHub's CSS Performance
jonrohan
1031
460k
It's Worth the Effort
3n
184
28k
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 Λམͱͣ͞ʹ ϝϞϦͷ༻ྔΛ͑Δ͜ͱ͕Ͱ͖Δ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠