mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:17:44 +00:00
LibWeb: Support transforms, stroking, gradients, etc for SVG <text>
This makes use of the new Gfx::Path::text() to handle SVG text elements, with this text is just a regular path, and can be manipulated like any other graphics element. This removes the SVGTextPaintable and makes both <text> and geometry elements use a new (shared) SVGPathPaintable. This is identical to the old SVGGeometryPaintable. This simplifies painting as once something is resolved to a Gfx::Path, the painting logic is the same.
This commit is contained in:
parent
50d33f79fa
commit
4c5d48f861
30 changed files with 144 additions and 180 deletions
BIN
Tests/LibWeb/Ref/reference/images/svg-text-effects-ref.png
Normal file
BIN
Tests/LibWeb/Ref/reference/images/svg-text-effects-ref.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
15
Tests/LibWeb/Ref/reference/svg-text-effects-ref.html
Normal file
15
Tests/LibWeb/Ref/reference/svg-text-effects-ref.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
}
|
||||
body {
|
||||
background-color: white;
|
||||
}
|
||||
</style>
|
||||
<!-- To rebase:
|
||||
1. Open svg-text-effects.html in Ladybird
|
||||
2. Resize the window till there's x and y scrollbars
|
||||
3. Right click > "Take Full Screenshot"
|
||||
4. Update the image below:
|
||||
-->
|
||||
<img src="./images/svg-text-effects-ref.png">
|
31
Tests/LibWeb/Ref/svg-text-effects.html
Normal file
31
Tests/LibWeb/Ref/svg-text-effects.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<link rel="match" href="reference/svg-text-effects-ref.html" />
|
||||
<svg height="200" width="350" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.text {
|
||||
font: italic 40px serif;
|
||||
}
|
||||
|
||||
.thakis {
|
||||
font: bold 70px sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: white;
|
||||
}
|
||||
</style>
|
||||
<linearGradient id="gradient">
|
||||
<stop offset="0%" stop-color="rgba(255, 0, 0, 1)"/>
|
||||
<stop offset="10%" stop-color="rgba(255, 154, 0, 1)"/>
|
||||
<stop offset="20%" stop-color="rgba(208, 222, 33, 1)"/>
|
||||
<stop offset="30%" stop-color="rgba(79, 220, 74, 1)"/>
|
||||
<stop offset="40%" stop-color="rgba(63, 218, 216, 1)"/>
|
||||
<stop offset="50%" stop-color="rgba(47, 201, 226, 1)"/>
|
||||
<stop offset="60%" stop-color="rgba(28, 127, 238, 1)"/>
|
||||
<stop offset="70%" stop-color="rgba(95, 21, 242, 1)"/>
|
||||
<stop offset="80%" stop-color="rgba(186, 12, 248, 1)"/>
|
||||
<stop offset="90%" stop-color="rgba(251, 7, 217, 1)"/>
|
||||
<stop offset="100%" stop-color="rgba(255, 0, 0, 1)"/>
|
||||
</linearGradient>
|
||||
<text x="20" y="105" class="text" transform="rotate(-10 50 100)">There you go :^)</text>
|
||||
<text x="90" y="220" class="thakis" fill="url(#gradient)" transform="rotate(-10 50 100) skewY(-10)">thakis</text>
|
||||
</svg>
|
Loading…
Add table
Add a link
Reference in a new issue