Is there an API like setting a pixel to Canvas object?

124 views
asked Jun 27, 2018 in GUI Development by Kangmin Choi
Hi,

I'm using Canvas object to create my own component and I need an API like setting a pixel at the specified coordinate.

I tried to find it, but it looks like that there is no similiar API in Canvas object.

If there is any other way of setting a pixel, please let me know.

1 Answer

0 votes
answered Jun 27, 2018 by Paul Banach

Hello,

you can use the Canvas' method DrawLine() to draw a line with 1 pixel width. Anyway, trying to compose a complete image by using Canvas and setting pixels one by one will be very inefficient. The Embedded Wizard Graphics Engine pipeline is not optimized to access the pixel individually. This is even not possible on particular target systems like the OpenGL ES. Generally, there are following application cases:

1. You compose the GUI application from views and other GUI components. Embedded Wizatrd optimizes the composition trying to elliminate unnecessary operations.

2. You use the Canvas object and fill it with rectangles, images, text, etc. You benefit from the optimized routines to draw the affected shapes. If your target supports hardware acceleration, it is used here. In fact, the here used functionality is the basement for the view composition mentioned in the item 1 above.

3. You want to create a pixel image. In this case create and fill an Extern Bitmap. With Extern Bitmap you can access and modify the pixel memory of the bitmap directly in the native code (ANSI C). In other words you can calculate and set pixel individually. See also: Displaying dynamically loaded images and Extern Bitmap interface.

Best regards

Paul Banach

commented Jun 28, 2018 by Kangmin Choi
Hi Paul,

Thanks for your kind reply. It helped me a lot.

Best Regards,

Kangmin

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

...