Since colorize property force the native item to be a ClippedImage, it had
a source rectangle, despite with and height defaulting to 0 and therefore
having an empty source rect would cause the scaling to not be right
Remove the pos parameter to the render functions and instead let
the item renderer apply the transformation on the rendere (femtovg
canvas or QPainter).
So `draw_*` functions in the backend now always operate in item local
coordinates.
Don't use the item's rendering cache to determine the image size, as
that's soley for rendering. The Qt backend doesn't use the item cache
and the GL backend neither after this change. Instead both backends have
a cache for decoded images.
This allows filling glyphs with gradients. However femtovg
appears to apply the start/end position per-glyph
instead of globally - resulting in a different result than Qt.
Add support for built-in property aliases and rename `color` to
`background` - in preparation for it also changing to type brush.
Right now the alias is silent, a deprecation and overall change
will come in a subsequent change.
When a tile is open artifacts would be visible around the edge of the
tile. That's because a zero width rectangle would cause pixels to appear
with femtovg. The Qt backend however has an early abort in
`get_geometry!`.
This patches applies the same early-abort semantics to both backends and
switches to `<= 0`, corresponding to euclid::Size's `is_empty()`.
The right curtain - when open - is supposed to fully clip away the logo image.
However the early return in `get_geometry!` when the width / height is < 1
results in the clip rect never set on the painter.
This intends to provide a configurable rectangular "drop shadow". The
API is modeled after CSS/HTML5 Canvas where the element can be "bound"
to an existing rectangular shape (geometry and radius), the offset can
be used to place the shadow and color and blur configure the shadow.
The shadow's color fades into transparent.
TODO (in subsequent changes):
* Documentation
* Qt implementation
* Rename logo to the more generic meta as keyboard modifier.
* Use control as the real modifier and map command key to it with
winit and keep Qt semantics as-is.
This will give a nicer API to expose to .60. If the struct weren't
repr(C) then the booleans would be nicely packed, but alas that's not
happening. On the other hand we're not keeping many instances of them
around.
Fold CharacterInput into KeyPressed/KeyReleased and store the "key" as a string.
Also, instead of exposing the KeyCode we're encoding special characters
into the string.
This allows creating multiple windows for example, and it will allow for
showing windows in those tests that require a mapped window.
As a bonus, the run() function on generated components is not consuming
anymore.
The GL backend uses the item graphics cache for the image size function,
which uses a PropertyTracker. That tracker must have the Image's source
included in its dependencies, to avoid that when loading a HTML image
for example, the cache isn't invalidated when the source is changed
before the HTML image was loaded async. That's why the get() call on the
source property must happen from within the PropertyTracker's callback.
Compared to QImage::load(path), QPixmap::load(path) has the advantage
of using Qt's internal QPixmapCache, which will avoid repeated decoding of
images.
For all other items the default is the empty size.
This also required three fixes for the HTML image loading:
* The upload_pending property value was inverted, it needs to start
out as true (pending yes) and be set to false when it finished
loading (not pending anymore)
* Mark the upload_pending property as dirty before scheduling the
redraw, in case it's sync
* Pass the item rendering cache to the image_size function to ensure
that the Rc<CachedImage> is not only weak inside the image_cache
of the GLRendererData but also strong on the item.