Commit graph

72 commits

Author SHA1 Message Date
pylbrecht
7c8c230d93 Add transform to Pattern::Surface to properly draw images 2019-12-17 19:52:03 +01:00
pylbrecht
9a2370a3a8 Consider empty gradients in is_zero_size_gradient() 2019-12-17 19:52:02 +01:00
pylbrecht
ada7986fef Handle BlendMode::Clear in GenericDrawTarget::fill() 2019-12-17 19:52:02 +01:00
pylbrecht
a50aef6f00 Add a layer to store Pattern related information
Some information of `canvas_data::Pattern` was lost by
converting it to `raqote::Source` due to the fact that Raqote
did not store this information (e.g. linear gradient's start/end
points). We introduce another layer to keep this information for later
use (like in `is_zero_size_gradient()`).
2019-12-17 19:52:02 +01:00
pylbrecht
1aecf40922 Implement "repeat-x" and "repeat-y" for images 2019-12-17 19:52:02 +01:00
pylbrecht
25d036f05c Set images' ExtendMode based on available information 2019-12-17 19:52:02 +01:00
pylbrecht
1cdcbb25fa Handle overlapping gradient stops for linear gradients
From `addColorStop(offset, color)`s spec:
If multiple stops are added at the same offset on a gradient, they must
be placed in the order added, with the first one closest to the start of
the gradient, and each subsequent one infinitesimally further along
towards the end point (in effect causing all but the first and last stop
added at each point to be ignored)

https://www.w3.org/html/test/results/2dcontext/annotated-spec/canvas.html#testrefs.2d.gradient.interpolate.overlapu
2019-12-17 19:52:01 +01:00
pylbrecht
04e9523e5f Use push_layer_with_blend() only when necessary
push_layer_with_blend() comes at a performance cost, so we only use it
on blend modes that require it.
2019-12-17 19:52:01 +01:00
pylbrecht
a02daef7b2 Make arc() wrap angles mod 2pi 2019-12-17 19:52:01 +01:00
pylbrecht
02e3325416 Make arc() use anticlockwise argument 2019-12-17 19:52:01 +01:00
pylbrecht
da9b4c33cd Make fill() handle all composition operations 2019-12-17 19:52:00 +01:00
pylbrecht
47ee2729ec Make fill() draw uncovered pixels as (0,0,0,0) for certain composition ops 2019-12-17 19:52:00 +01:00
pylbrecht
4d4e68ca6b Respect direction when drawing arcs 2019-12-17 19:52:00 +01:00
pylbrecht
a473f50245 Respect FilterMode when drawing images 2019-12-17 19:51:59 +01:00
pylbrecht
16f06f24c5 Add check for handling equal radial gradients 2019-12-17 19:51:59 +01:00
pylbrecht
d87e5d831b Add check to handle zerosize linear gradients 2019-12-17 19:51:59 +01:00
pylbrecht
55256df0ba Use tolerance > 0 in Path::contains_point() 2019-12-17 19:51:58 +01:00
pylbrecht
5c6a12a116 Create raqote::SolidSource with premultiplied color
SolidSource expects a premultiplied color.
2019-12-17 19:51:57 +01:00
pylbrecht
77a8bc4a1d Fix conversion of image data slice 2019-12-17 19:51:57 +01:00
pylbrecht
b8b33788b6 Handle empty paths in PathBuilder::get_current_point()
The case of calling get_current_point() on empty paths has not been
handled and caused panics.
2019-12-17 19:51:57 +01:00
pylbrecht
d6f46b5513 Apply transformation in Path::contains_point() 2019-12-17 19:51:56 +01:00
pylbrecht
c8025c9147 Don't reuse PathBuilder after calling finish() 2019-12-17 19:51:56 +01:00
pylbrecht
fa2de68919 Implement DrawTarget::snapshot() 2019-10-11 20:07:36 +02:00
pylbrecht
772f2bc2ee Implement Path::transformed_copy_to_builder() 2019-10-11 20:07:35 +02:00
pylbrecht
f88c6efd63 Show warn! for shadow drawing operations 2019-10-11 20:06:48 +02:00
pylbrecht
308908ed40 Implement LinearGradient and RadialGradient 2019-09-17 16:58:13 +02:00
pylbrecht
b8f92937b3 Implement ColorBurn 2019-09-17 11:54:39 +02:00
pylbrecht
430fad8b13 Update raqote 2019-09-17 11:54:39 +02:00
pylbrecht
818b5d4150 Add naive implementation for ellipse()
rust-azure's ellipse() C++ implementation copy/pasted and kind of ported
to Rust. Obviously needs refactor to turn it into idiomatic Rust.
2019-09-17 11:48:44 +02:00
pylbrecht
d24568218b Don't use catch all in match 2019-09-01 19:26:04 +02:00
pylbrecht
47a6129332 Use raqote's implementation of Path::contains_point() 2019-09-01 19:22:20 +02:00
pylbrecht
7c81d20869 Implement create_gradient_stops() 2019-08-29 14:17:03 +02:00
pylbrecht
89b8bd516f Refactor Path::contains_point() using any() 2019-08-25 16:43:29 +02:00
pylbrecht
ee7f3dbc46 Implement PathBuilder::get_current_point() 2019-08-25 16:19:33 +02:00
pylbrecht
2a0be451ae Implement Path::contains_point() 2019-08-25 15:50:04 +02:00
Bastien Orivel
f829eaea03 Fix the build and tidy and address nits 2019-08-21 19:19:43 +02:00
Bastien Orivel
168a526221 Implement Source::Surface for FillOrStrokeStyle with raqote 2019-08-21 19:10:57 +02:00
Bastien Orivel
8a57876482 Implement get_format
Since raqote doesn't have multiple formats for its surfaces, this is a
noop to avoid crashing with the unimplemented
2019-08-21 19:10:57 +02:00
Bastien Orivel
dc78b6a989 Implement a few functions to make tests in draw-image and draw-path pass 2019-08-21 19:10:57 +02:00
Bastien Orivel
3dd0b462c2 Make tidy happy again 2019-08-21 19:10:57 +02:00
Bastien Orivel
0a3c6637bb Implement create_similar_draw_target 2019-08-21 19:10:57 +02:00
Bastien Orivel
4c73e4bb3f Imlplement get_composition_op 2019-08-21 19:10:57 +02:00
Bastien Orivel
a28d00013c Implement set_shadow_color, set_global_composition and stroke_rect 2019-08-21 19:10:57 +02:00
Bastien Orivel
a9fd26729b Match the azure backend regarding cap stuff
I think this is wrong because it won't respect cap style at all when
stroking lines but we'll cross that bridge when we get to it
2019-08-21 19:10:57 +02:00
Bastien Orivel
97674082d3 Pass BlendMode::Clear to the fill method of DrawTarget in clear_rect
This makes some tests regarding clearing rects pass. Otherwise the rect
wouldn't get cleared properly and it'd keep its original color but get
an alpha of 0
2019-08-21 19:10:56 +02:00
Bastien Orivel
777ef4f3e8 Implement snapshot_data_owned 2019-08-21 19:10:56 +02:00
Bastien Orivel
97364dc6af Implement get_size 2019-08-21 19:10:56 +02:00
Bastien Orivel
fda815bcbb Properly pass draw_options in fill_rect 2019-08-21 19:10:56 +02:00
Bastien Orivel
e90d1a1d8d Implement stroke_line and set_stroke_style 2019-08-21 19:10:56 +02:00
Bastien Orivel
9229dc4d85 Implement clear_rect 2019-08-21 19:10:56 +02:00