Simon Hausmann
01c3347d19
Make fluent the new default style
...
It's not ugly :-)
2021-08-10 15:56:38 +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
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
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
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
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
ogoffart
53f286258c
Bump version number to 0.1.1
2021-08-10 08:06:20 +00: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
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
afa52d0f18
Janitor: Remove unneeded mut
2021-08-09 13:19:34 +02:00
Olivier Goffart
58af765b07
Fix the qt backend always rebuilding
...
(because of one of the previous changes which renamed the file)
2021-08-06 21:48:38 +02:00
Olivier Goffart
3d7ce0fed8
Rename the qt/widgets.rs to qt/qt_widgets.rs
...
there are other files wih widgets in their name, so disambiguate
2021-08-06 18:48:58 +02:00
Olivier Goffart
fb5be2ed8a
Fix compiler warning
2021-08-06 18:46:56 +02:00
Olivier Goffart
6789e7195e
Fix compilation
...
The recently removed property was actually not complely unused
2021-08-06 15:58:13 +02:00
Olivier Goffart
a89d83e58f
Apply suggestions from code review
...
Co-authored-by: Simon Hausmann <simon.hausmann@sixtyfps.io>
2021-08-06 15:58:13 +02:00
Olivier Goffart
d41839abe3
Compiler pass for the TabWidget
...
it will lower the TabWidget into a TabWidgetImpl and the tabs into TabImpl
2021-08-06 15:58:13 +02:00
Olivier Goffart
29e0ae913c
TabBar: implement something in the ugly style
...
and change the TabImpl API
2021-08-06 15:58:13 +02:00
Olivier Goffart
18572fbaa3
WIP: More TabWidget work in progress
2021-08-06 15:58:13 +02:00
Olivier Goffart
9d40779d69
WIP work for TabWidget
2021-08-06 15:58:13 +02:00
Tobias Hunger
9c12421c18
Janitor: Fix clippy::option_map_unit_fn
2021-08-05 23:41:56 +02:00
Simon Hausmann
9f4fa3599a
internal cleanup: make the GL backend cSpell clean
2021-08-05 13:52:55 +02:00
Simon Hausmann
3ec2274365
internal cleanup: rename the eventloop module to event_loop
...
That's consistent with graphics_window and silences cSpell
2021-08-05 13:46:42 +02:00
Tobias Hunger
ce976a1dbb
Janitor: Fix clippy::useless_conversion
2021-08-04 22:50:35 +02:00
Tobias Hunger
c74565a883
Janitor: Fix clippy::needless_return
2021-08-04 22:50:35 +02:00
Tobias Hunger
24a2021226
Janitor: Fix clippy::needless_borrow
2021-08-04 22:50:35 +02:00
Tobias Hunger
04a2df540a
Janitor: Fix clippy::upper_case_acronyms
2021-08-04 22:50:35 +02:00
Simon Hausmann
601e93b9f5
Style fixup: Avoid a huge match expression
...
Instead merging the match with a variable declared later down is easier to read.
2021-08-03 16:47:23 +02:00
Simon Hausmann
25fac2bcd5
GL backend: Avoid run-time opengl errors with clipped zero width or height rectangles
...
If a Rectangle has a border-radius and clipping, we use an FBO to render
the children and then use femtovg's stencil clipping. If the Rectangle
has a zero width or height, we would end up trying to create a texture
with such dimensions, which produces run-time opengl errors.
We can detect this situation and avoid it early on. The same might happen for shadows.
Fixes #377
2021-08-03 16:47:23 +02:00
Simon Hausmann
faedf2d5a9
cSpell: silence qt_window.rs
2021-08-03 16:18:43 +02:00
Olivier Goffart
1dab4c35d9
For embedded data, store the extension in the binary
...
This is usefull for the detection of SVG
2021-08-03 16:15:31 +02:00
Simon Hausmann
3374a214f1
cSpell: silence graphics_window.rs
2021-08-03 16:14:40 +02:00
Simon Hausmann
29f5853332
Provide sixtyfps::Window
by reference in the Rust API
...
This also removes Clone from the Window again, to avoid having to face
the question: Does cloning a window duplicate it on the screen?
2021-08-03 10:32:04 +02:00
Simon Hausmann
d867d7b58a
Fix rendering of text selection with combining characters with the GL backend
...
When the text selection end follows right after a grapheme that uses less
glyphs than characters, then there may not be a matching glyph with the byte
index, therefore we wouldn't set the selection_end_x and draw incorrectly.
Take the visual tail of the last glyph then.
2021-08-01 09:35:19 +02:00
Simon Hausmann
35541cffd9
Fix cursor rendering with the Qt backend for non-ascii text
...
We calculate the cursor position as byte offset in the utf-8 encoded string,
while Qt expects an index in the utf-16 encoded QString.
When those differ, the cursor is rendered at the wrong location.
Fixes #363
2021-08-01 09:34:50 +02:00
Olivier Goffart
90cdb5ab5d
Add a changed
callback to Slider
...
Closes #125
2021-07-31 15:14:03 +02:00
Tobias Hunger
f1f0182826
Janitor: Fix clippy::needless_return
2021-07-30 09:27:48 +02:00
Tobias Hunger
34d461cb2b
Janitor: Fix clippy::clone_on_copy
2021-07-30 09:27:48 +02:00
Olivier Goffart
43e07320a5
Fix comments and naming found in review in #355
2021-07-28 16:57:09 +02:00
Olivier Goffart
7821926002
Rust: defaults to the native
style when Qt is available
...
This requires some gymnastics to get right as the information
need to be passed to the compiler despite having no direct dependency
between the compiler and the runtime or backends.
So use a file in the build directory to tell the default style
cc: #83
2021-07-28 16:57:09 +02:00
Simon Hausmann
3d1c71b762
Fix formatting (cargo fmt)
...
Amends f75745ea30
2021-07-27 19:37:06 +02:00
Simon Hausmann
aacb47dfaf
qt native button: Apply suggestions from code review
...
Add the icon type explicitly to make it easier to do "eye" based type matching with the cpp! macro.
Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-07-27 19:37:06 +02:00
Simon Hausmann
14c6819791
Add support for icons in the Button widget
...
The icon in the gallery example was generated via https://emoji.aranja.com
2021-07-27 19:37:06 +02:00
Simon Hausmann
dbdd8d8cb3
cspell: silence in fonts.rs
2021-07-26 14:37:40 +02:00
Simon Hausmann
40e7d45e2d
Tweak manual font fallbacks on Linux
...
Add the noto color emoji font that's default on Ubuntu at least
(until we can use fontconfig proper)
2021-07-26 14:37:24 +02:00
Tobias Hunger
d34fd5add2
Fix float comparison in qt_window.rs
...
Amends 02bdcbf6ff
2021-07-24 22:53:52 +02:00
Tobias Hunger
2cdc5848a2
Janitor: Replace float comparison dance with approx_eq from euclid
...
Sixtyfps uses euclid already, so let's use euclid for float comparisons
as well.
I changed the code to decide whether a number is a positive integer to
make do without a comparison along the way.
2021-07-23 13:48:52 +02:00
Tobias Hunger
27b42687fa
Janitor: Fix clippy::redundant_closure
2021-07-23 13:48:52 +02:00
Tobias Hunger
9539a53480
Janitor: Fix clippy::redundant_clone
2021-07-23 13:48:52 +02:00
Tobias Hunger
1c21ba89ee
Janitor: Fix clippy::if_let_some_result
2021-07-23 13:48:52 +02:00
Tobias Hunger
97be634b9b
Janitor: Fix clippy::match_like_matches_macro
2021-07-23 13:48:52 +02:00