DEV Community

Cover image for How to draw text on Canvas using drawText API in Jetpack Compose?
Raksha for Canopas Software

Posted on

 

How to draw text on Canvas using drawText API in Jetpack Compose?

Exploring text on Canvas using drawText API in Jetpack Compose.

Before Compose 1.3.0, there was no drawText(). We couldn’t draw text directly on the Jetpack Compose canvas, we had to use android native canvas canvas.nativeCanvas.drawText to draw text.

The recent release of Jetpack Compose 1.3.0 introduces many new APIs. And Text on Canvas is one of them.

Please note that this API is still in the experimental state and it is likely to change in the future.

In this blog post, we’ll explore the new DrawScope.drawText() API with multiple examples.

For those who are interested in code only, here you go.

The original post is published on the Canopas blog.

Latest comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.