mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:12:46 +00:00 
			
		
		
		
	LibWeb: Add canvas.strokeRect(), and fix scale & translate
Add an implementation of CanvasRenderingContext2DWrapper.strokeRect(). While implementing this I fixed fillRect() and the new strokeRect() to honor the .scale() and .translate() values that had previously been plumbed. Also enhance the canvas.html demo to utilize strokeRect(), scale(), and translate().
This commit is contained in:
		
							parent
							
								
									7291d5c86f
								
							
						
					
					
						commit
						39855fe9ef
					
				
					 5 changed files with 80 additions and 3 deletions
				
			
		|  | @ -16,8 +16,20 @@ canvas { | |||
| <script> | ||||
|     document.addEventListener("DOMContentLoaded", function() { | ||||
|         ctx = document.getElementById("foo").getContext("2d"); | ||||
|         ctx.fillStyle = 'red'; | ||||
|         ctx.fillRect(10, 10, 200, 100); | ||||
| 
 | ||||
|         var width = 200; | ||||
|         var height = 100; | ||||
|         for (var i = 0; i < 2; i++) | ||||
|         { | ||||
|             ctx.fillStyle = 'red'; | ||||
|             ctx.fillRect(10, 10, width, height); | ||||
| 
 | ||||
|             ctx.strokeStyle = 'blue'; | ||||
|             ctx.strokeRect(10, 10, width, height); | ||||
| 
 | ||||
|             ctx.scale(0.5, 0.5); | ||||
|             ctx.translate(10 + width * 2, 10 + height * 2); | ||||
|         } | ||||
|     }); | ||||
| </script> | ||||
| </head> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Brian Gianforcaro
						Brian Gianforcaro