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
unraveling custom drawing
Search
Matheus Cassiano Candido
August 07, 2018
Programming
0
86
unraveling custom drawing
Matheus Cassiano Candido
August 07, 2018
Tweet
Share
More Decks by Matheus Cassiano Candido
See All by Matheus Cassiano Candido
Kotlin Static Analysis - Kotlin Everywhere 2019
mcassiano
0
120
JUnit rules and test parameterization
mcassiano
0
130
The Basis of Android Threading: Loopers and Handlers
mcassiano
1
130
Hackeando sua próxima entrevista: dicas para conseguir seu próximo estágio ou emprego
mcassiano
1
95
text spans: what, why and how?
mcassiano
0
670
Navigation patterns on Android and something new
mcassiano
3
400
Como conseguir o estágio (ou emprego) dos sonhos
mcassiano
0
50
Databinding e padrão MVVM
mcassiano
1
27
Desenvolvimento móvel: práticas de sucesso
mcassiano
0
31
Other Decks in Programming
See All in Programming
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
200
[AI Engineering Summit Tokyo 2025] LLMは計画業務のゲームチェンジャーか? 最適化業務における活⽤の可能性と限界
terryu16
1
110
re:Invent 2025 のイケてるサービスを紹介する
maroon1st
0
160
AtCoder Conference 2025
shindannin
0
830
ThorVG Viewer In VS Code
nors
0
460
これならできる!個人開発のすゝめ
tinykitten
PRO
0
140
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
140
Cap'n Webについて
yusukebe
0
160
マスタデータ問題、マイクロサービスでどう解くか
kts
0
160
Rubyで鍛える仕組み化プロヂュース力
muryoimpl
0
230
「コードは上から下へ読むのが一番」と思った時に、思い出してほしい話
panda728
PRO
39
26k
SQL Server 2025 LT
odashinsuke
0
100
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Side Projects
sachag
455
43k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
110
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
130
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.8k
AI: The stuff that nobody shows you
jnunemaker
PRO
1
37
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
34
WCS-LA-2024
lcolladotor
0
390
The Spectacular Lies of Maps
axbom
PRO
1
400
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
32
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
130
Transcript
Desvendando Custom Drawing Matheus C. Candido Android @ Concrete speakerdeck.com/mcassiano
pixabay/somraya
val default = Paint() val smoother = Paint(FLAG_ANTI_ALIAS) val copy
= Paint(smoother)
FLAG_ANTI_ALIAS
stroke width paint.strokeWidth = 4f paint.strokeWidth = 6f paint.strokeWidth =
8f todos os valores são em pixels!
style Paint.Style.STROKE Paint.Style.FILL_AND_STROKE Paint.Style.FILL
join (ligações) Paint.Join.MITER Paint.Join.ROUND Paint.Join.BEVEL
cap (pontas) Source: Microsoft Xamarin Docs
pixabay/coyot
formas
formas canvas.drawRect( rectBounds, paint )
rectBounds???
formas canvas.drawRoundRect( rectFBounds, radiusX, radiusY, paint )
formas canvas.drawArc( rectFBounds, startAngle, sweepAngle, useCenter, paint )
formas canvas.drawCircle( centerX, centerY, radius, paint )
paths
transformações canvas.save() // faça alguma transformação canvas.restore()
transformações val count = canvas.save() // faça alguma transformação canvas.restoreToCount(count)
translate canvas.translate(deltaX, deltaY)
rotate canvas.rotate(degrees) canvas.rotate(degrees, pivotX, pivotY)
scale canvas.scale(scaleX, scaleY) canvas.scale(scaleX, scaleY, pivotX, pivotY)
skew canvas.skew(skewX, skewY)
clipping (recortes)
clipping (recortes) clipOutPath clipOutRect
clipping (recortes) clipRect clipPath
bitmaps
bitmaps drawables
bitmaps drawables Levels example: https://ryanharter.com/blog/2015/04/03/custom-drawables/
bitmaps drawables custom views
bitmaps drawables custom views item decorators
performance • evite alocações no onDraw • faça clip nas
regiões que não for desenhar • use as ferramentas de profiling para verificar overdraw e debugar quebra de frames
acessibilidade AccessibilityNodeProvider ExploreByTouchHelper
acessibilidade getVirtualViewAt(x: Float, y: Float) getVisibleVirtualViews(virtualViewIds: MutableList<Int>) onPerformActionForVirtualView( virtualViewId: Int,
action: Int, arguments: Bundle? ) onPopulateNodeForVirtualView( virtualViewId: Int, node: AccessibilityNodeInfoCompat )
acessibilidade ????
virtual view data class VirtualView( var id: Int = View.NO_ID,
var contentDescription: CharSequence, val rect: Rect = Rect() )
node provider override fun getVirtualViewAt( x: Float, y: Float ):
Int { val view = virtualViews.find{ it.rect.contains(x, y) } return view?.id ?: HOST_ID }
node provider override fun onPopulateNodeForVirtualView( virtualViewId: Int, node: AccessibilityNodeInfoCompat )
{ val view = virtualViews.find { it.id == virtualViewId } view?.let { node.setBoundsInParent(it.rect) node.contentDescription = it.contentDescription } }
exemplos
backgrounds (itemdecoration) Exemplo: https://github.com/ajarl/item-decoration-sample/blob/master/ app/src/main/java/com/example/itemdecorationsample/ItemDecoration.kt
backgrounds (itemdecoration) Exemplo: https://github.com/ajarl/item-decoration-sample/blob/master/ app/src/main/java/com/example/itemdecorationsample/ItemDecoration.kt
backgrounds (itemdecoration) Exemplo: https://github.com/ajarl/item-decoration-sample/blob/master/ app/src/main/java/com/example/itemdecorationsample/ItemDecoration.kt
histograma Exemplo: https://github.com/mcassiano/custom-drawing
mcassiano
None