Sygnerical
Sygnerical

Reputation: 221

Android - How is Canvas Used

I'm trying to draw circles using SurfaceView and I was curious about whether or not you always use canvas when you draw something. Are there are other ways instead of using canvas, and what are the pros/cons? Also, how would you personally draw a circle with SurfaceView?

Upvotes: 1

Views: 331

Answers (2)

fadden
fadden

Reputation: 52313

There are two basic options: use a Canvas, or OpenGL ES.

The easiest way to draw a circle is to use Canvas#drawCircle(). Doing the equivalent with OpenGL ES is more involved, though there are various toolkits that can simplify things.

Depending on your needs, you may want to consider using a custom View instead. Canvas rendering on a SurfaceView is not hardware accelerated, but Canvas rendering on a custom View can be.

Upvotes: 3

RajSharma
RajSharma

Reputation: 1971

I think there is no other ways to draw instead of canvas. You can use SurfaceView to draw any shape even a cricle also. First you ahev to get SurfaceHolder object and using that you can draw anything. Yo can follow these links- first second

Upvotes: 1

Related Questions