Commit graph

34 commits

Author SHA1 Message Date
Olivier Goffart
4e7bbcf2ba
Try to improve rendering (positioning) of signed field distance font. (#6868)
* WIP: swrenderer: use fixed point for the pixmap font coordinate

* swrenderer: signed distance field: move the glyph to the middle

* swrenderer: round the advance instead of truncating it in distance field

* swrenderer: actually align the gplyph on the sub-pixel precision

sub-pixel within the source.

* swrenderer: adapt the threshold for signed distance field

sqrt(2) is the distance to the diagonal, seems like this gives sharper fonts

* Fix bug in the elision, and re-upload the screenshort

the screenshot changed because the afvanced is now rounded intead of
truncated
2024-11-30 23:03:31 +01:00
Olivier Goffart
b0c7ac41f0 Add debug statements
to help debugging #6432
2024-11-07 17:24:06 +01:00
Olivier Goffart
d8ab4e4600 Signed DistanceField font rendering in swrenderer
Note that this is still disabled in the compiler with no way to enable
it with public API
2024-10-23 09:12:30 +02:00
Olivier Goffart
43b05074e0
Software renderer: fix drawing partialy clipped texture with rotation (#6445)
We were assuming that the extra clip was always on a unrotated image,
the rendering code didn't account for rotated screens

ChangeLog: Software renderer: fix artifact with partial drawing and rotation
2024-10-04 15:16:41 +02:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Olivier Goffart
f45bab6a3f swrenderer: Support multiple rectangles for the dirty regions
This allow to be much faster in the case two small area of the screen
changes.
2024-04-26 14:45:23 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Tobias Hunger
9873cfd7c0 janitor: Run cargo clippy --fix
Only the hand-picked sensible things, not all of it ;-)

Also fix a few typos that cspell complained about when I
tried to commit and some formatting changes that cargo fmt
insisted on when commiting.
2024-03-14 13:42:38 +01:00
Olivier Goffart
5e7ddf3a19 Image Tiling
(Doesn't work yet with 9slice)
2024-02-26 12:16:41 +01:00
Olivier Goffart
424f046416 swrenderer: refactor image drawing algorithm
For tiling, we will need to know the actual source size in addition to
the scaling factor that can be different. So store the scaling factors
in the scene command, as well as an offset where to start.

This is more accurate in case of clipping and rotation.
For rotation that doesn't matter (appart from the fact that the testing
can now be more strict)
But for clipping this prevent glitches with partial rendering where it
would seem like the image are moving a bit by a pixel when it is redrawn
with a different clip
2024-02-15 18:25:47 +01:00
Olivier Goffart
b2920b1714 Software renderer: use 16 bit precision when drawing image
This is important when zooming, and still allow images of 65535 pixel
width or height
2024-02-13 14:46:27 +01:00
J-P Nurmi
1971f598bb SW: non-uniform border radius 2024-02-06 18:01:35 +01:00
Olivier Goffart
277dce6345 swrenderer: Optimize image rendering
Do the match on the format before the loop
2023-11-18 13:21:11 +01:00
Tobias Hunger
b12575a4c4 janitor: Go over our spell checking setup
* Extend the cspell word list
* Remove those extensions from individual source files
* white-list licenses and such as we should not meddle with those
* Fix spelling
2023-10-16 09:01:51 +02:00
Olivier Goffart
b6636b2e94 swrender: Implement window rotation by 180° and 270°
(The tests are still failling)
2023-10-09 18:07:23 +02:00
Olivier Goffart
ec36d46740 WIP: experiment with screen rotation
TODO:
 - Polish the API
 - Most screenshot test are failling because the rotation don't draw the
   rounded rectangle exactly the same (that's because the border
   rectangle algo is not perfect), and also scaled image are not pixel
   perfect

The updated screenshot is because of a small change in the image
rendering algorithm that changes the rounding slightly.
2023-10-09 18:07:23 +02:00
Olivier Goffart
46ec7875ed Software renderer: partial rendering with winit and fix non-opaque background
Implement the partial rendering with winit and our software renderer.

When the background is not opaque, we must still initialize all the
pixel with 0 otherwise we blend over the previous frame.
(That wasn't visible before because the buffer was always empty)
2023-09-13 16:08:57 +02:00
Simon Hausmann
cd0056ca92 Make it easier to use the software renderer with PremultipliedRgbaColor and Rgb565 in "foreign" environments
Implement rgb::Pod/rgb::Zeroable for PremultipliedRgbaColor and Rgb565
Pixel. This allows for bytemuck::cast_slice(), making it easier to copy
software renderer output into another buffer that's the same format but
Vec<u8> for example.
2023-08-07 11:46:43 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Tobias Hunger
e02c360000 Clippy polish 2023-06-28 14:22:30 +02:00
Olivier Goffart
da83857a60 Remove embedded_graphics dependency from i-slint-core
This feature was never used.
2023-06-22 14:12:01 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Olivier Goffart
98747cd385 Winit software renderer: Fix transparent background
Despite the documentation of softbuffer claiming that the high bits
should be 0, it seems to be interpreted as an alpha value when the
window is actually transparent.
And the values are considered as premultiplied alpha

Also use a Premultiplied aplha for the buffer so we can even have
transparent window with the software renderer
2023-05-03 19:29:51 +02:00
Tobias Hunger
3ac01c3f07 clippy: Fix clippy warnings 2023-03-09 09:35:29 +01:00
Olivier Goffart
995d960a2a Comile with Rust < 1.66
wrapping_add_signed was added in Rust 1.66
2023-02-02 15:54:07 +01:00
Olivier Goffart
a4eb1ab287 swrenderer support for linear gradient
Only simple rectangle (no borders or radius)
2023-02-02 15:54:07 +01:00
Olivier Goffart
b620986e35 Fix 16bit blending
The comments were a bit off, and we were loosing one bit in the blue LSB

Reported in https://github.com/slint-ui/slint/pull/1576#pullrequestreview-1232577955
2023-01-05 12:08:21 +01:00
Olivier Goffart
830e33876f swrenderer: Fix drawing of images
There was some confusin on the meaning of the alpha and colorize and how
it is computed for AlphaMap images
2022-11-30 16:49:23 +01:00
Florian Blasius
00bd4909e1
SoftwareRenderer: render texture with opacity and color alpha channel (#1877)
* swr: add alpha field to texture
2022-11-21 15:26:35 +01:00
Simon Hausmann
d698af5326 Move physical length definitions into the software renderer
Their choice of i16 is specific to the software renderer. In say the Skia renderer
the physical coordinate space would still use Skia's Scalar (floating points).
2022-09-30 09:03:02 +02:00
Olivier Goffart
36845dcbab
Support drawing embedded textures with the non-software renderers 2022-09-07 18:44:14 +02:00
Tobias Hunger
639dcaf702 api: Rename module swrenderer to software_renderer
Also rename the `swrenderer` feature to `software-renderer`.
2022-09-07 10:11:11 +02:00
Renamed from internal/core/swrenderer/draw_functions.rs (Browse further)