https://github.com/ruiwentang/mickey
Yet an other 2D Vector Graphic rendering library written in rust
https://github.com/ruiwentang/mickey
rust vector-graphics wgpu
Last synced: 20 days ago
JSON representation
Yet an other 2D Vector Graphic rendering library written in rust
- Host: GitHub
- URL: https://github.com/ruiwentang/mickey
- Owner: RuiwenTang
- License: apache-2.0
- Created: 2024-04-27T15:19:30.000Z (about 1 year ago)
- Default Branch: develop
- Last Pushed: 2025-01-27T07:30:01.000Z (3 months ago)
- Last Synced: 2025-03-26T07:11:08.833Z (about 1 month ago)
- Topics: rust, vector-graphics, wgpu
- Language: Rust
- Homepage:
- Size: 2 MB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mickey
Mickey is an other wheel of 2D vector graphic rendering project which I used to learn `rust` and `wgpu`. It is currently in the early stages of development, hoping one day I can publish it.
## Usage
```rust
use mickey::*
// record draws into Picture
let picture = {
let mut recorder = PictureRecorder::new();let mut paint = Paint::new();
paint.color = Color::from_rgba_u8(0x42, 0x85, 0xF4, 0xFF);
let rect = Rect::from_xywh(10.0, 10.0, 100.0, 160.0);
recorder.draw_rect(&rect, &paint);let mut oval = RRect::new_oval(rect);
oval.offset(40.0, 80.0);
paint.color = Color::from_rgba_u8(0xDB, 0x44, 0x37, 0xFF);
recorder.draw_rrect(&oval, &paint);paint.color = Color::from_rgba_u8(0x0F, 0x9D, 0x58, 0xFF);
recorder.draw_circle(180.0, 50.0, 25.0, &paint);paint.style = Stroke::default().with_width(4.0).into();
paint.color = Color::from_rgba_u8(0xF4, 0xB4, 0x0, 0xFF);let mut rrect = RRect::from_rect_xy(rect, 10.0, 10.0);
rrect.offset(80.0, 50.0);
recorder.draw_rrect(&rrect, &paint);recorder.finish_record()
};// after picture created it can be replied and flush onto a wgpu::Texture
let (device: wgpu::Device, queue: wgpu::Queue) = ... ; // init wgpu context
let texture : wgpu::Texture = ...; // create by yourselflet context = GPUContext::new(&device);
let mut surface = GPUSurface::new(&text.texture, texture.width(), texture.height(), true, device);
surface.replay(&picture);
surface.flush(&mut context, &device, &queue, Some(wgpu::Color {
r: 1.0,
g: 1.0,
b: 1.0,
a: 1.0,
}));```
## Current status:
- Geometry Shape support (Fill, Stroke)
- Path Clip
- Basic transform (translation, scaling, rotation)
## TODO
- [ ] Gradient Color
- [ ] Draw Image
- [ ] Text rendering
- [ ] PathEffect support (dash ... etc)
- [ ] Blur mask filter
- [ ] Advance blending