Skip to content

Commit

Permalink
Custom RGB
Browse files Browse the repository at this point in the history
  • Loading branch information
CaffeeLake committed Oct 16, 2024
1 parent 995c508 commit 99c8229
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"image"
"image/color"
"image/draw"
"image/jpeg"
"image/png"
Expand Down Expand Up @@ -71,15 +72,15 @@ func cmd() {
}

img := image.NewRGBA(image.Rect(0, 0, 512, 512))
draw.Draw(img, img.Bounds(), image.White, image.Point{}, draw.Src)
draw.Draw(img, img.Bounds(), &image.Uniform{C: color.RGBA{R: 255, G: 255, B: 255, A: 255}}, image.Point{}, draw.Src)

c := freetype.NewContext()
c.SetDPI(72)
c.SetFont(font)
c.SetFontSize(448)
c.SetClip(img.Bounds())
c.SetDst(img)
c.SetSrc(image.Black)
c.SetSrc(&image.Uniform{C: color.RGBA{R: 0, G: 0, B: 0, A: 255}})
pt := freetype.Pt(32, 417)
_, err := c.DrawString(string(r), pt)
if err != nil {
Expand Down Expand Up @@ -114,7 +115,7 @@ func cmd() {
if err != nil {
log.Fatalln(err)
}
if _, err := f.WriteString(fmt.Sprintf("%s, u%06x, %s, %s\n", string(r), r, fontname, additionalpromptstr)); err != nil {
if _, err := f.WriteString(fmt.Sprintf("u%06x, %s, %s, %s\n", r, string(r), fontname, additionalpromptstr)); err != nil {
log.Fatalln(err)
}
f.Close()
Expand Down

0 comments on commit 99c8229

Please sign in to comment.