Skip to content

Instantly share code, notes, and snippets.

@worstkiller
Created August 13, 2021 19:05
Show Gist options
  • Save worstkiller/2d2179442b693cd716410ad4128c5070 to your computer and use it in GitHub Desktop.
Save worstkiller/2d2179442b693cd716410ad4128c5070 to your computer and use it in GitHub Desktop.
facebook canvas conposable
@Composable
fun facebookIcon() {
val assetManager = LocalContext.current.assets
val paint = Paint().apply {
textAlign = Paint.Align.CENTER
textSize = 200f
color = Color.White.toArgb()
typeface = Typeface.createFromAsset(assetManager, "FACEBOLF.OTF")
}
Canvas(
modifier = Modifier
.size(100.dp)
.padding(16.dp)
) {
drawRoundRect(
color = Color(0xFF1776d1),
cornerRadius = CornerRadius(20f, 20f)
)
drawContext.canvas.nativeCanvas.drawText("f", center.x + 25, center.y + 90, paint)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment