mirror of
https://github.com/servo/servo.git
synced 2025-08-13 17:35:36 +01:00
Implement gradient fill styles for canvas.
This commit is contained in:
parent
34950418ea
commit
d3199aef74
55 changed files with 290 additions and 228 deletions
30
tests/ref/canvas_linear_gradient_a.html
Normal file
30
tests/ref/canvas_linear_gradient_a.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
canvas {
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
|
||||
<canvas id="c" width="200" height="200">
|
||||
Your browser does not support the HTML5 canvas tag.</canvas>
|
||||
|
||||
<script>
|
||||
var c = document.getElementById("c");
|
||||
var ctx = c.getContext("2d");
|
||||
|
||||
var grd = ctx.createLinearGradient(10, 0, 190, 0);
|
||||
grd.addColorStop(0, "red");
|
||||
grd.addColorStop(1, "yellow");
|
||||
|
||||
ctx.fillStyle = grd;
|
||||
ctx.fillRect(10, 10, 180, 180);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue