Languages

Menu
Sites
Language
Saving and Reloading Canvas Drawing

Hi

 

I am trying to make a Native application that draws and saves the drawing.

For the purpose of drawing, I am using Canvas in the same way as used in the MultiTouch Sample Application.

But I am not able to find a way to save that drawing and reload it later.

I am new to the tizen development environment, so some guidance in this topic can help.

 

Thanks

Sam

Responses

2 Replies
Alex Ashirov

Hi,

You can take a look at the following 3 classes:

Tizen::Graphics::Bitmap

Tizen::Media::Image

Tizen::Graphics::Canvas

The article below contains code sample which explains how to load and draw jpg image on canvas using these 3 classes.

https://developer.tizen.org/dev-guide/2.2.0/org.tizen.native.apireference/classTizen_1_1Media_1_1Image.html

If you need to store image from canvas to a file then you need to create Bitmap from the canvas using

Tizen::Graphics::Bitmap::Construct(const Canvas & canvas, const Tizen::Graphics::Rectangle & rect )

After that you need to store the created Bitmap using Tizen::Media::Image.

Alex Dem

Hi,
just fyi:
The reliable way to drawing on canvas is reimplement onDraw method:
https://developer.tizen.org/forums/native-application-development/draw-on-canvas
Alexey.