Added hair style examples and generator

This commit is contained in:
Samuel Hawksby-Robinson 2020-08-22 15:59:01 +01:00
parent 5998edc178
commit c328cf7483
No known key found for this signature in database
GPG Key ID: 64CF99D4A64A1205
3 changed files with 27 additions and 2 deletions

View File

@ -12,6 +12,10 @@
![](examples/hair.png)
### Hair Styles
![](examples/hair_styles.png)
### Eye colours
![](examples/eyes.png)

BIN
examples/hair_styles.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

25
main.go
View File

@ -22,7 +22,8 @@ var (
func main() {
exampleSkin()
exampleHair()
exampleHairColour()
exampleHairStyles()
exampleEyes()
}
@ -72,7 +73,7 @@ func exampleSkin() {
draw2dimg.SaveToPngFile("examples/skins.png", rgba)
}
func exampleHair() {
func exampleHairColour() {
avatarsPerRow := 5
nLowRight := lowRight
@ -95,6 +96,26 @@ func exampleHair() {
draw2dimg.SaveToPngFile("examples/hair.png", rgba)
}
func exampleHairStyles() {
nLowRight := lowRight
nLowRight.X = nLowRight.X * len(hair.Styles)
rgba := image.NewRGBA(image.Rectangle{Min: upLeft, Max: nLowRight})
for i, s := range hair.Styles {
img := image.NewRGBA(image.Rectangle{Min: upLeft, Max: lowRight})
drawAvatar(img, colours.Skin[0], colours.Black, colours.Black, s)
minP := image.Point{X: upLeft.X + (i)*dimentions.Width, Y: upLeft.Y}
maxP := image.Point{X: lowRight.X + (i)*dimentions.Width, Y: lowRight.Y}
rect := image.Rectangle{Min: minP, Max: maxP}
draw.Draw(rgba, rect, img, image.Point{X: 0, Y: 0}, draw.Src)
}
draw2dimg.SaveToPngFile("examples/hair_styles.png", rgba)
}
func exampleEyes() {
nLowRight := lowRight
nLowRight.X = nLowRight.X * len(colours.Eye)