Commit graph

5155 commits

Author SHA1 Message Date
Simon Hausmann
1a08b392e3 Fix the wasm build of the imagefilter example 2021-08-10 15:56:01 +02:00
Simon Hausmann
ddbe704764 Fix C++ build
The tests include headers that exposed that we do need SharedImageBuffer
in the internal C++ types namespace.
2021-08-10 15:56:01 +02:00
Simon Hausmann
0d3c38899f minor doc fix: capitalize Rust 2021-08-10 15:56:01 +02:00
Simon Hausmann
d023475f1c Rename Image::new_rgb*() to Image::from_rgb* 2021-08-10 15:56:01 +02:00
Simon Hausmann
76041684c0 Simplify scenario description in Image docs
It doesn't have to be an external crate that renders images, just Rust code generally.

Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-08-10 15:56:01 +02:00
Simon Hausmann
a2860b389e internal cleanup: remove cbindgen workaround for name clash
Since cbindgen strips the module name, we ended up with an RGB8 type and the RGB8 (and alpha) variants
in the generated code, which made the SharedImageBuffer
constructor ambiguous.

That's not needed anymore now that we use RGB8Pixel and RGBA8Pixel.
2021-08-10 15:56:01 +02:00
Simon Hausmann
6d1ec9b5d5 minor cleanup: we might not need to skip the plotter example
... from the upgrade test, as it is not in the checkout anyway.
2021-08-10 15:56:01 +02:00
Simon Hausmann
2053a12eb6 Fix changelog entry for sixtyfps::Image 2021-08-10 15:56:01 +02:00
Simon Hausmann
2a420d7a86 Remove imgref dependency from the public Image API
There's only one place where we need this ourselves and that's also
easily done by hand. Otherwise the `as_bytes(_mut)()` accessor provides the
functionality along with `width()` and `height()`.

Other than that the API is mostly consuming, given that `sixtyfps::Image`
has no way of extracting the data again.
2021-08-10 15:56:01 +02:00
Simon Hausmann
cfb6caca01 Fix calling Image::size() on default or pixel-buffer constructed images
For such images we do not need a backend and can avoid the panic.
2021-08-10 15:56:01 +02:00
Simon Hausmann
6016007c6f Avoid the need for SharedPixelBuffer users to depend on rgb
Re-export the two typical pixel types, for convenience. Of course other
types can be used, too, if the user depends on rgb directly.
2021-08-10 15:56:01 +02:00
Simon Hausmann
50f4b08b6e Remove imgref and rgb dependencies from the plotter example
With `as_bytes_mut()` on `SharedPixelBuffer` those dependencies are not needed anymore,
they are now implicit.
2021-08-10 15:56:01 +02:00
Simon Hausmann
f237e1a09b Remove unnecessary imgref dependency from the image filter example 2021-08-10 15:56:01 +02:00
Simon Hausmann
c18b289e62 Provide convenience as_bytes(_mut) for SharedPixelBuffer
This avoids the need for users of the API to import the ComponentBytes trait from rgb.
2021-08-10 15:56:01 +02:00
Simon Hausmann
8b62564a4b Fix incorrect self parameter in SharedPixelBuffer
We don't need a mutable reference for `as_slice()`
2021-08-10 15:56:01 +02:00
Simon Hausmann
485fc72d15 Adapt the plotter example to the SharedImageBuffer API removal 2021-08-10 15:56:01 +02:00
Simon Hausmann
42ba8ba7b0 Adapt the imagefilter example to the SharedImageBuffer API removal 2021-08-10 15:56:01 +02:00
Simon Hausmann
f25f85844d Remove SharedImageBuffer from the public Rust API
and instead fold the constructor functions into Image as `new_rgb8`/`new_rgba8` and `new_rgba8_premultiplied`.
2021-08-10 15:56:01 +02:00
Simon Hausmann
2d374a3ff9 internal cleanup: Remove commented out plotters dependency 2021-08-10 15:56:01 +02:00
Simon Hausmann
12916e7488 Fix C++ build after Image API changes
Export missing types
2021-08-10 15:56:01 +02:00
Simon Hausmann
2e9e818691 Mark SharedPixelBuffer as repr(C)
For use in the ffi later
2021-08-10 15:56:01 +02:00
Simon Hausmann
b6254d2fd7 Fix doc error
In a non-Qt build ImageInner would be unused and trigger a warning that's an error.
2021-08-10 15:56:01 +02:00
Simon Hausmann
59eaaee262 Prospective fix for updater test in CI
Disable the imagefilter and plotter for 0.0.5, 0.0.6 and 0.1.0.
In the future we want to test them though.
2021-08-10 15:56:01 +02:00
Simon Hausmann
10da1a9499 Add an example to filter images in Rust
This demonstrates how to use the image crate and feed data into
SixtyFPS.
2021-08-10 15:56:01 +02:00
Simon Hausmann
64522d9d17 Qt backend: speed up determining the size of embedded images
Don't go through the dance of copying the image buffer into a QImage just to determine the size.
2021-08-10 15:56:01 +02:00
Simon Hausmann
50fb40525a Fix typo
Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-08-10 15:56:01 +02:00
Simon Hausmann
1d83837228 Add a plotter example using plotters
This is kind of an interactive port of
https://github.com/38/plotters/blob/master/examples/3d-plot2.rs
2021-08-10 15:56:01 +02:00
Simon Hausmann
8a3a68a4fa Add API to Rust sixtyfps::Image to enable creation from user supplied image buffers
This adds an ImageBuffer and PixelBuffer type for SharedVector
backed images. The documentation explains how to use this
with low-level rendering functions and the popular image crate.

Fixes #387
2021-08-10 15:56:01 +02:00
Olivier Goffart
76de53cead Update cbindgen 2021-08-10 10:49:43 +02:00
ogoffart
53f286258c Bump version number to 0.1.1 2021-08-10 08:06:20 +00:00
Olivier Goffart
298f6bbe89 Fix the version update script
- Skip helper crates
- remove leading quote
2021-08-10 10:04:46 +02:00
Olivier Goffart
db1e197dba The shell in github action don't expand **/ properly 2021-08-10 09:53:31 +02:00
Olivier Goffart
dcc9537213 Prospective fix for the upgrade version script 2021-08-10 09:49:38 +02:00
Olivier Goffart
7315776d3e Version bump script: push to a branch 2021-08-10 09:46:29 +02:00
Olivier Goffart
e55b5ff81a Prospective fix for the version scrupt 2021-08-10 09:35:28 +02:00
Olivier Goffart
74c00b1cec Add a github action to bump version numbers 2021-08-10 09:03:29 +02:00
Simon Hausmann
f0a7c4f817 Fix build with Qt 6
QFont::resolve(uint mask) is QFont::setResolveMask(...) in Qt 6.

Fixes #399
2021-08-10 09:02:01 +02:00
Olivier Goffart
5d9608a565 Keep the Rotate element as internal 2021-08-09 17:43:22 +02:00
Olivier Goffart
b6137ecbc4 Error when trying to use internal builtin items 2021-08-09 17:43:22 +02:00
Simon Hausmann
7384ebdc32 Deprecated SharedVector::as_slice_mut() in favor of SharedVector::as_mut_slice()
The standard library uses the latter name.
2021-08-09 14:51:09 +02:00
Tobias Hunger
c3ce321429 Janitor: Fix clippy::ptr_arg 2021-08-09 13:19:34 +02:00
Tobias Hunger
afa52d0f18 Janitor: Remove unneeded mut 2021-08-09 13:19:34 +02:00
Tobias Hunger
cbdea7c9c7 Janitor: Fix clippy::missing_safety_doc 2021-08-09 13:19:34 +02:00
Tobias Hunger
9dcd107e84 Janitor: Fix clippy::single_match 2021-08-09 13:19:34 +02:00
Tobias Hunger
d50dcf77f5 Janitor: Fix clippy::from_iter_instead_of_collect 2021-08-09 13:19:34 +02:00
Tobias Hunger
bac4d895ce Janitor: Fix clippy::while_let_on_iterator 2021-08-09 13:19:34 +02:00
Tobias Hunger
ce30f9b989 Janitor: Fix clippy::extra_unused_lifetimes 2021-08-09 13:19:34 +02:00
Tobias Hunger
094f4bb082 Janitor: Fix clippy::cmp_owned 2021-08-09 13:19:34 +02:00
Tobias Hunger
1d71a2beeb Janitor: Fix clippy::collapsible_if 2021-08-09 13:19:34 +02:00
Tobias Hunger
58fa485b56 Janitor: Fix clippy::into_iter_on_ref 2021-08-09 13:19:34 +02:00