Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android create layers in canvas

I want to learn how can I create layers (like in photoshop) in my android application. I want to achieve one basic thing: when I add an image in my canvas, which will be some figure for example, I want to be able to paint the canvas, but the painting must not effect the lines of figure. And then I need to save that image on my Sd card.

Any suggestions/advice/examples? What can I use to achieve this?

like image 657
Android-Droid Avatar asked May 18 '12 06:05

Android-Droid


People also ask

How does canvas work on Android?

The Canvas class holds the "draw" calls. To draw something, you need 4 basic components: A Bitmap to hold the pixels, a Canvas to host the draw calls (writing into the bitmap), a drawing primitive (e.g. Rect, Path, text, Bitmap), and a paint (to describe the colors and styles for the drawing).

What is matrix in canvas android?

Matrix 🔢 A 3 by 3 Matrix that stores information which can be used to transform a canvas. A Matrix can store the following kind of transformation information: scale, skew, rotation, translation.

How do you make a bitmap on canvas?

Use the Canvas method public void drawBitmap (Bitmap bitmap, Rect src, RectF dst, Paint paint) . Set dst to the size of the rectangle you want the entire image to be scaled into. EDIT: Here's a possible implementation for drawing the bitmaps in squares across on the canvas.

What is Android app canvas?

Canvas Student allows students to access their courses and groups using a mobile device. Students can submit assignments, participate in discussions, view grades and course materials. The app also provides access to course calendars, To Do items, notifications, and Conversations messages.


1 Answers

The order how you paint makes layers. Create some stack of objects what you paint and then modify individual objects (painting in layer) or move them in this stack (changing layers). Use the same order to create your image to save.

like image 174
Alex Avatar answered Sep 25 '22 22:09

Alex