Big refactoring of PARCOURSMOB - Initial commit

This commit is contained in:
2022-08-11 17:26:55 +02:00
commit 7225d027c9
65 changed files with 10276 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
package profilepictures
import (
"fmt"
"image"
"image/color"
"image/draw"
"github.com/fogleman/gg"
"golang.org/x/image/font"
"golang.org/x/image/math/fixed"
)
func DefaultProfilePicture(initials string) *image.RGBA {
img := image.NewRGBA(image.Rect(0, 0, 300, 300))
col := color.RGBA{36, 56, 135, 255}
white := color.RGBA{255, 255, 255, 255}
point := fixed.Point26_6{fixed.I(40), fixed.I(200)}
draw.Draw(img, img.Bounds(), &image.Uniform{col}, image.Point{X: 0, Y: 0}, draw.Src)
ff, err := gg.LoadFontFace("themes/default/fonts/bitter.ttf", 150.0)
if err != nil {
fmt.Println(err)
return img
}
d := &font.Drawer{
Dst: img,
Src: image.NewUniform(white),
Face: ff,
Dot: point,
}
d.DrawString(initials)
return img
}