How to draw lines dynamically using the touchscreen (e.g. "paint" application)?

395 views
asked Jun 25, 2016 in GUI Development by Customer
Hi,
just a short question about a widget to make a "paint like" application. In my GUI I should have a window and into this I want to drag the finger and draw into this some lines. Looking into elements available I don't see a specific function to do this, the only method is to draw a pixel under the finger area and have a sequence of pixel built during the movement of finger?

1 Answer

0 votes
answered Aug 11, 2016 by Paul Banach

Use the Canvas object to create and store such dynamic pictures. The object provides various drawing functions allowing e.g. filling areas with a color or drawing line segments, ... From technical point of view, the Canvas object can be seen like an off-screen framebuffer. All operations you perform on the screen can also be performed on an Canvas object.

The Canvas object itself is not visible. It manages the picture content only. To show the content of the Canvas object, an ordinary Image view can be used. Just assign the Canvas object to the property Bitmap of the Image view. To update the screen after the picture within an Canvas object has changed, use the method InvalidateArea().

Following example demonstrates this application. See the comments inside the project:

http://ask.embedded-wizard.de/?qa=blob&qa_blobid=18193691439290994687

For more details see interface of the Graphics::Canvas class within 'Mosaic 2.0 User Manual'.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...