Sergey Zaitsev
Sergey Zaitsev

Reputation: 164

How to smooth canvas drawing in Android?

I'm using Canvas for drawing in my Android application. But the result has bad quality (see the picture)the result

scaled

So, canvas drawing don't draw additional pixels with more dark color between "stairs pixels" for smoothing. Like this smoothing

But I'm interesting how to do it. Are there some preferences or methods for smoothing the picture? Thanx!

Edited: I've founded here

Upvotes: 2

Views: 2275

Answers (1)

williamj949
williamj949

Reputation: 11316

Use the ANTI-ALIAS flag for drawing smooth edges.

Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
//or
Paint p = new Paint();
p.setAntiAlias(true);

Upvotes: 5

Related Questions