1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 00:21:15 +03:00
Commit Graph

160 Commits

Author SHA1 Message Date
Guillaume Ayoub
592b621999 Fix images embedded from multiple pages
Fix #1486.
2021-11-05 22:11:09 +01:00
Lucie Anglade
abd54c4bd4 Set SVG ratio when width and height are 0 2021-10-28 11:21:37 +02:00
Guillaume Ayoub
2e96bdee35 Simplify API to get intrinsic size of images
The previous API wasn’t stateless, as it sometimes required to call
get_intrinsic_size before accessing intrinsic_ratio. The new API offers a
single method to get width, height and ratio.
2021-08-03 18:39:14 +02:00
Guillaume Ayoub
aee609da43 Use stream variable name instead of old context 2021-07-17 14:29:28 +02:00
Guillaume Ayoub
add1dad80b Use named parameters for stream transformation 2021-07-17 14:25:58 +02:00
Guillaume Ayoub
d8526d4b41 Fix and test resized SVG files
The SVG sample is 10 years old, and viewbox was lowercase. That’s viewBox, not
viewbox. Our new renderer is case-sensitive for attributes.
2021-07-17 00:53:39 +02:00
Guillaume Ayoub
ea44564983 Typo in comment 2021-07-13 00:20:10 +02:00
Guillaume Ayoub
cbd617516f Use cache index instead of Python id() for PDF image name
Cache index is reproducible between renderings, generating equivalent (and
testable) PDF files.
2021-07-12 22:50:05 +02:00
Guillaume Ayoub
5ae4afd35c Use stream variable name instead of old-fashioned context 2021-07-12 16:57:48 +02:00
Guillaume Ayoub
cef8cf109d Fix and simplify image size management 2021-07-12 15:07:31 +02:00
Guillaume Ayoub
c0c9879bc5 Handle stroke-opacity and fill-opacity
This commit also cleans a lot of things about the way opacity is handled,
with many small bug fixes.

Fix #1371.
2021-06-02 20:35:06 +02:00
Guillaume Ayoub
2d19becf19 Improve SVG support 2021-04-30 18:13:08 +02:00
Guillaume Ayoub
becd494f91 Add an option to optimize fonts
Fix #359.
2021-04-28 14:55:52 +02:00
Guillaume Ayoub
66d2b4da3c First SVG text test 2021-04-14 16:56:30 +02:00
Guillaume Ayoub
0d8fb23145 Clean SVG support 2021-04-11 16:13:59 +02:00
Guillaume Ayoub
882681a99c Preserve ratio for svg tags 2021-03-23 13:58:31 +01:00
Guillaume Ayoub
b7392374e2 Handle linear gradients 2021-03-19 15:58:22 +01:00
Guillaume Ayoub
561734e8ae Make SVG tests pass again 2021-03-12 16:59:02 +01:00
Guillaume Ayoub
de9359ad46 Fix intrinsic sizes calculation 2021-03-12 15:20:20 +01:00
Guillaume Ayoub
43ec426f6b Add all SVG shapes, inheritance and transformations 2021-03-07 20:34:24 +01:00
Guillaume Ayoub
9d300c1528 First SVG shapes 2021-03-07 18:00:38 +01:00
Lucie Anglade
a4ed61f1b6 Transform is done in pydyfsvg 2021-03-07 18:00:37 +01:00
Lucie Anglade
a5e20cfe4c Support SVG with pydyf 2021-03-07 18:00:37 +01:00
Guillaume Ayoub
30c21d92e9 Fully remove Cairo from documentation and code 2020-12-10 22:47:27 +01:00
Guillaume Ayoub
f10b3b56c8 Fix error raised when SVG images are rendered 2020-12-08 15:51:35 +01:00
Guillaume Ayoub
cfb9017e84 Remove CairoSVG
Fix #1263.
2020-12-07 12:27:18 +01:00
Guillaume Ayoub
5ed5b54d59 Handle transparent colors in gradients correctly
Gradients must be drawn using a pre-multiplied color space. It means that stop
colors are "weighted" by their alpha channel when we define how transition is
done between two colors.

To explain why this is needed, the best example is "transparent". The
"trasparent" color is set to rgba(0, 0, 0, 0), also known as transparent
black. When there’s a transition from red to transparent, we don’t want to have
a transition to black, as it would be if RGBA values were extrapolated. We want
to have a transition to transparent red.

This problem appears for each transition between colors whose RGB and A
channels are both different.

To fix this, we use the same plain color as the one from the previous stop for
transitions to transparent, and the same plain color as the one from the next
stop for transitions from transparent. For semi-transparent colors, we set a
weight proportional to the color alpha, meaning that opaque colors will take
more place than transparent ones.

This bug appears in Safari: https://bugs.webkit.org/show_bug.cgi?id=150940.
It obviously means that we’re better than Apple. Obviously.
2020-11-30 20:54:26 +01:00
Guillaume Ayoub
5f5f30d3e8 Support transparent gradients 2020-11-30 19:12:41 +01:00
Guillaume Ayoub
94cf4bf5e0 Fix colors in repeating linear gradients 2020-10-25 20:18:13 +01:00
Guillaume Ayoub
8cd28aee31 Small fixes on linear gradients 2020-10-25 15:52:58 +01:00
Guillaume Ayoub
1ff768c103 Support linear gradients 2020-10-25 14:54:08 +01:00
Guillaume Ayoub
60df2d174e Handle repeating radial gradients 2020-10-25 13:41:23 +01:00
Guillaume Ayoub
02e6beb041 Fix gradient documentation and comments 2020-10-25 07:32:41 +01:00
Guillaume Ayoub
b37feca543 Fix radial gradients and related tests 2020-10-24 21:35:17 +02:00
Guillaume Ayoub
7f2c64e5a6 Handle degenerate radial gradients 2020-10-24 20:49:42 +02:00
Guillaume Ayoub
18e567c95e Fix radial gradients 2020-10-24 20:46:38 +02:00
Guillaume Ayoub
04f40ae9b2 Fix various tests 2020-10-24 18:00:48 +02:00
Guillaume Ayoub
bd0a6eee45 Fix non-repeating linear gradients 2020-10-24 17:42:13 +02:00
Guillaume Ayoub
9d29716b91 Merge remote-tracking branch 'origin/master' into pydyf 2020-07-31 14:46:36 +02:00
Guillaume Ayoub
c56b96b3c1 Add an option to optimize embedded images size 2020-06-22 16:05:14 +02:00
Guillaume Ayoub
30db42b08a Fix gradients domain 2020-06-08 16:34:36 +02:00
Guillaume Ayoub
6aa16733ec Remove useless import 2020-06-08 16:10:24 +02:00
Guillaume Ayoub
8f9e15a57e Handle image-rendering 2020-06-08 00:01:09 +02:00
Guillaume Ayoub
58016053a0 Handle solid gradients 2020-06-07 23:40:01 +02:00
Guillaume Ayoub
d6cdb690a2 Handle multi-color gradients 2020-06-07 11:40:30 +02:00
Guillaume Ayoub
29365f3318 Re-enable user_to_device_distance 2020-06-07 11:04:12 +02:00
Guillaume Ayoub
0350a8c055 Handle very simple gradients 2020-06-07 00:32:47 +02:00
Lucie Anglade
f2a7614138 Rotate image 2020-06-03 19:47:34 +02:00
Lucie Anglade
f530502e05 Handle jpg images 2020-06-03 17:58:53 +02:00
Guillaume Ayoub
9372b94e8d Clean formatted strings 2020-05-30 15:55:44 +02:00