Created
March 7, 2016 08:21
-
-
Save suzaku/f1c8ef50f88251c6d52d to your computer and use it in GitHub Desktop.
A function that fill an image with specified background color
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func createImage(width int, height int, background color.RGBA) *image.RGBA { | |
rect := image.Rect(0, 0, width, height) | |
img := image.NewRGBA(rect) | |
draw.Draw(img, img.Bounds(), &image.Uniform{background}, image.ZP, draw.Src) | |
return img | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment