linebender / piet

An abstraction for 2D graphics.
Apache License 2.0
1.23k stars 95 forks source link

Add `make_image_with_stride` #554

Closed LucaCiucci closed 1 year ago

LucaCiucci commented 1 year ago

The make_image_with_stride function will allow to create images from a buffer with a specific row stride. See #553 for more info.

Progress:

Resolves #553.

LucaCiucci commented 1 year ago

I think the implementation is at a good point so I'm marking it as "ready for review". Some clippy are failing but I think this is related to #555.

xStrom commented 1 year ago

Yes #555 resolved CI errors in master and is now merged. You can now rebase your fork on master to get those fixes here too.

LucaCiucci commented 1 year ago

Done, I also corrected a mistake I made on cairo. Unfortunately, I cannot test piet-cairo and piet-coregraphics on my system.

LucaCiucci commented 1 year ago

I still have to implement some checks but I'm unsure about what kind of error to return when the given buf is smaller than bytest_per_pixel * stride * height. Maybe InvalidInput or BackendError?

xStrom commented 1 year ago

I think InvalidInput is a good choice.

LucaCiucci commented 1 year ago

I think I've done. Let me know if you are satisfied with the changes, especially with the fact that make_image is now a provided method.

xStrom commented 1 year ago

Looks like that error is now being triggered.

Running `target/debug/examples/test-picture --all --scale=1 --out=cairo_samples --compare=./piet/snapshots/cairo`
error in sample 2: 'Invalid input'
error generating sample: Invalid input

I have't looked deeper to see what's going on.

LucaCiucci commented 1 year ago

67af29b should fix this, but I cannot test it at the moment. Can you run the workflows again?