Olivier Goffart
1dba04721a
Add a qt_viewer example that uses QWidget
2021-03-23 17:13:41 +01:00
Simon Hausmann
f5fb0bf297
Prospective Qt linkage fix for macOS
...
Try adding an LC_RPATH command to the cdylib that we're building (for example libsixtyfps_cpp.dylib),
to fix linkage against Qt, which uses `@rpath/QtCore.framework/XXX` for inter-library linkage dependencies.
2021-03-17 14:02:33 +01:00
Olivier Goffart
35cce45cbc
Add a fii feature so that we don't compile in the ffi code if not required
2021-03-16 18:09:57 +01:00
Olivier Goffart
6f88d78303
Rename Resource
to ImageReference
in the runtime
2021-03-11 10:06:23 +01:00
Olivier Goffart
89bbdce88e
Polish a bit the Brush API
2021-03-10 16:54:33 +01:00
Olivier Goffart
6f715c5612
Don't call render for items outside of the clip rects
2021-03-05 13:05:02 +01:00
Simon Hausmann
27bdb4d481
Added Window.default-font-family
...
One step towards getting rid of `DemoText` in the printer demo
2021-03-02 13:25:21 +01:00
Simon Hausmann
f087cc18bc
Remove extern "C" functions from wasm module
...
We don't need these functions and their export. They account for ~20kb in
the optimized .wasm - plus JS glue code.
2021-02-26 17:04:49 +01:00
Simon Hausmann
d5d537b1ce
Remove redundant to_string() call
2021-02-17 15:28:58 +01:00
Simon Hausmann
3ba92bdc6d
Add API to the wasm interpreter to download and register fonts
2021-02-17 15:21:30 +01:00
Simon Hausmann
445ddd58d5
API cleanup
...
Remove the `application` infix from `register_application_font`, to
reduce the changes that it might be interpreted to be a function that
also changes the default font in all text elements.
2021-02-17 14:37:31 +01:00
Simon Hausmann
f7ab4625e4
Prospective build fix
...
Use the same to_string_lossy() code path on all platforms
2021-02-17 14:32:02 +01:00
Simon Hausmann
45fe6c3e8d
Add the ability to load application fonts by path
...
The viewer command line tool also gains the ability to specify them via `--app-font=/path/to/font.ttf` , which can be specified multiple times.
2021-02-17 14:16:52 +01:00
Simon Hausmann
7cea088a2c
Add support for letter-spacing in text
...
This is conveniently supported by femtovg and Qt
2021-02-16 22:14:50 +01:00
Olivier Goffart
15e0112d2d
Qt: Fix image-fit of colorized image
...
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
2021-02-16 10:10:30 +01:00
Olivier Goffart
ed1fc31b84
Put the window background color in the StyleMetrics
...
And make use of Window::background in Qt
2021-02-15 15:57:58 +01:00
Olivier Goffart
deea260eac
Fix image-fit in the Qt backend
...
Only scale the loaded image for image format that make sense (ie: svg)
and when doing that, keep the aspect ratio
2021-02-15 12:10:43 +01:00
Olivier Goffart
a71edafa33
Refactor the way the mouse events are processed
...
Have a function first called before the children, and then the main function
called after the children if they did not accept the event. This will allow
processing the Flickable gesture properly
2021-02-12 20:47:59 +01:00
Simon Hausmann
fd5757bc44
Simplify coordinate handling for item rendering
...
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.
2021-02-12 17:12:58 +01:00
Olivier Goffart
9eac131ae5
Add the logo in the docs
2021-02-12 08:24:42 +01:00
Simon Hausmann
b5095e9729
Fix source scaling detection for the Qt backend
...
ClippedImage without a source rect or one that's identical to the target should also allow for source scaling
2021-02-10 21:33:04 +01:00
Simon Hausmann
f704e4c823
Implement rendering SVG with specified size
...
Relates to #129
2021-02-10 21:08:58 +01:00
Simon Hausmann
8a66af0746
Clean up image size determination in the rendering backend
...
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.
2021-02-10 17:34:29 +01:00
Simon Hausmann
2dd5ea61bb
Add support for Path.fill-rule
...
For some reason it's not working with the Qt renderer though
2021-02-10 14:08:32 +01:00
Olivier Goffart
9db575952d
Fix bold font with Qt
...
Qt expect a font between 0 and 99.
This is the mapping somehow used for QFont::Weight enum
2021-02-09 10:59:11 +01:00
Olivier Goffart
f7a76dc352
Add ImageFit::cover, and fix ImageFit::contain
2021-02-09 10:52:04 +01:00
Olivier Goffart
743d729ecb
Silent warning
2021-02-04 18:15:06 +01:00
Olivier Goffart
0e2471f76b
Image::colorize support
...
(Qt only)
2021-02-04 17:44:01 +01:00
Simon Hausmann
3f541972ef
Change Rectangle::border-color
to be a brush
...
This allows things like filling a thick border with a gradient.
2021-02-04 17:05:00 +01:00
Simon Hausmann
1a9419638d
Change the type of the color property for Text
and TextInput
to be a brush
...
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.
2021-02-04 11:54:57 +01:00
Simon Hausmann
d92c8cab23
Fix path fitting
...
Include the stroke width in the boundaries when fitting a path into the
size of a `Path` element.
2021-02-04 09:09:23 +01:00
Simon Hausmann
66df71a3ca
Convert Path
to support brushes
...
* Rename `fill-color` to `fill`
* Rename `stroke-colo` to `stroke`
* Support using a brush for both properties
2021-02-03 15:45:33 +01:00
Simon Hausmann
c41062e9bb
Fix linear gradient rendering with the GL backend
...
Share the code for transforming the gradient's angle to start and end points,
and apply the transformation to the bounds.
2021-02-03 14:38:29 +01:00
Olivier Goffart
8555f4f83a
Fix Qt gradients coordinate mode
2021-02-03 13:29:02 +01:00
Olivier Goffart
8f93fdcc4e
Convert Linear Gradient to QBrush
...
(Untested)
2021-02-03 12:57:51 +01:00
Simon Hausmann
7982325da4
Change Rectangle::background's type to be a brush
...
This also introduces the brush type in the compiler and generators. At the
moment only conversion from Color is implemented.
2021-02-03 12:49:44 +01:00
Simon Hausmann
93c0fe54ea
Prepare for using graphics::Brush in the rendering backends
...
by introducing mappings to QBrush and femtovg::Paint
2021-02-03 08:39:53 +01:00
Simon Hausmann
1f091cb1c0
Rename Rectangle.color to Rectangle.background
...
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.
2021-02-02 17:01:12 +01:00
Simon Hausmann
69508575ec
Fix rendering of Flickable
...
It should clip to its geometry
2021-02-01 15:35:36 +01:00
Simon Hausmann
3648995fef
Fix window size with Qt backend when no size is specified
...
Our memory tutorial and docs sometimes use `Window { ... }` without any
`width` or `height` specified. That we should not tell the window manager :)
2021-01-29 16:11:05 +01:00
Olivier Goffart
f928026d98
Fix mouse over with the Qt backend
2021-01-28 18:22:23 +01:00
Olivier Goffart
b5bb27c083
Fix the memory game's tile not closing with the Qt backend
...
updating a model does not make the redraw_listener dirty
2021-01-28 18:16:28 +01:00
Simon Hausmann
e387d72421
Fix rendering artifacts with the GL backend in the memory tutorial
...
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()`.
2021-01-28 17:57:35 +01:00
Olivier Goffart
a07fbf777a
Fix initial windows size with the Qt backend
2021-01-28 17:23:10 +01:00
Olivier Goffart
0aa3561a55
Fix build.rs not being re-run when the cpp! code changes
2021-01-28 17:23:10 +01:00
Simon Hausmann
9e09f6fa0d
Fix rendering of the right curtain in the memory example with the Qt backend
...
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.
2021-01-28 17:12:26 +01:00
Olivier Goffart
fea2478859
Update version number everywhere
2021-01-28 16:34:13 +01:00
Simon Hausmann
680995432e
Minor fixes to the BoxShadow
element
...
* Use the same property names as `Rectangle`
* Use the same sizing behavior
Also added a "manual" test.
2021-01-27 15:34:27 +01:00
Simon Hausmann
96263e04ca
Fix fitted path rendering
...
In the old backend we transformed the path to fit into the given width/height.
The new printer page uses that.
2021-01-27 15:03:24 +01:00
Olivier Goffart
d934a20bfa
Text word wrap and elide
2021-01-27 12:55:20 +01:00