Updated Pattern interface
This commit is contained in:
		
							parent
							
								
									b575413a0a
								
							
						
					
					
						commit
						c7e44633b1
					
				| @ -1,12 +1,16 @@ | |||||||
| package artist | package artist | ||||||
| 
 | 
 | ||||||
| import "image/color" | import "image" | ||||||
|  | import "git.tebibyte.media/sashakoshka/tomo/canvas" | ||||||
| 
 | 
 | ||||||
| // Pattern is capable of generating a pattern pixel by pixel. | // Pattern is capable of drawing to a canvas within the bounds of a given | ||||||
|  | // clipping rectangle. | ||||||
| type Pattern interface { | type Pattern interface { | ||||||
| 	// AtWhen returns the color of the pixel located at (x, y) relative to | 	// Draw draws to destination, using the bounds of destination as a width | ||||||
| 	// the origin point of the pattern (0, 0), when the pattern has the | 	// and height for things like gradients, bevels, etc. The pattern may | ||||||
| 	// specified width and height. Patterns may ignore the width and height | 	// not draw outside the union of destination.Bounds() and clip. The | ||||||
| 	// parameters, but it may be useful for some patterns such as gradients. | 	// clipping rectangle effectively takes a subset of the pattern. To | ||||||
| 	AtWhen (x, y, width, height int) (color.RGBA) | 	// change the bounds of the pattern itself, use canvas.Cut() on the | ||||||
|  | 	// destination before passing it to Draw(). | ||||||
|  | 	Draw (destination canvas.Canvas, clip image.Rectangle) | ||||||
| } | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user