Skip to content

Canvas widget for 2D graphics#193

Merged
hecrj merged 28 commits into
masterfrom
feature/canvas
Feb 20, 2020
Merged

Canvas widget for 2D graphics#193
hecrj merged 28 commits into
masterfrom
feature/canvas

Conversation

@hecrj
Copy link
Copy Markdown
Member

@hecrj hecrj commented Feb 18, 2020

Solar system - Iced

Related to #32.

This PR implements a new Canvas widget in iced_wgpu that is capable of drawing 2D graphics with GPU rasterization by leveraging lyon.

The widget can be found in the new canvas module, alongside a bunch of other useful types for drawing and compositing layers. Check out the documentation to learn more!

Overall, the public API is very similar to the CanvasRenderingContext2D of the Web Canvas API, although some of its functionality is still missing.

I have also implemented MSAA support for the Mesh2D primitive in iced_wgpu. This setting can be enabled with the new antialiasing field in Settings.

A Canvas simply produces a set of Mesh2D primitives (see #140) when drawn. In the long run, we should try to help with nical/lyon#185 or use a more advanced rasterizer like pathfinder.

Finally, I have created two new examples to showcase the Canvas widget:

  • solar_system, a simple animated solar system showcasing how to compose different transforms.
  • clock, an application that draws a clock and its hands to display the current time.

Clock - Iced

@hecrj hecrj added the feature New feature or request label Feb 18, 2020
@hecrj hecrj added this to the 0.1.0 milestone Feb 18, 2020
@hecrj hecrj self-assigned this Feb 18, 2020
@artursapek
Copy link
Copy Markdown
Contributor

beautiful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants