This commit is contained in:
2025-08-17 22:02:26 +03:00
parent c718034307
commit d55b3cf864
6 changed files with 13 additions and 20 deletions

View File

@@ -4,20 +4,14 @@ import (
"image"
"image/color"
"image/png"
"strconv"
"io"
"strconv"
"time"
"github.com/potassium5703/imageutils"
"git.niplace.ru/XoxJlopeZ_1488/clock/letter"
"git.niplace.ru/XoxJlopeZi488/clock/letter"
"git.niplace.ru/XoxJlopeZi4BB/imageutils"
)
func Check(err error) {
if err != nil {
panic(err)
}
}
var img1, img2 = letter.Nums[6].Render(), letter.Nums[9].Render()
func DownRightBlank(img image.Image) image.Image {
@@ -33,7 +27,7 @@ func LeftUpBlank(img image.Image) image.Image {
}
func RenderNum(n int) image.Image {
var img image.Image = image.NewRGBA(image.Rect(0,0,0,0))
var img image.Image = image.NewRGBA(image.Rect(0, 0, 0, 0))
s := strconv.Itoa(n)
for i := range s {
n, err := strconv.Atoi(string(s[i]))
@@ -78,6 +72,9 @@ func Time(w io.Writer) {
img := RenderTime(t)
img = Margin(img, 3)
img = imageutils.Scale(img, 1<<6)
Check(png.Encode(w, img))
err := png.Encode(w, img)
if err != nil {
panic(err)
}
}

View File

@@ -1,8 +1,8 @@
package clock
import (
"testing"
"io"
"testing"
)
func BenchmarkNumber(b *testing.B) {

View File

@@ -3,7 +3,7 @@ package main
import (
"net/http"
"git.niplace.ru/XoxJlopeZ_1488/clock"
"git.niplace.ru/XoxJlopeZi488/clock"
// "clock/imageutils"
)

6
go.mod
View File

@@ -1,5 +1,3 @@
module git.niplace.ru/XoxJlopeZ_1488/clock
module git.niplace.ru/XoxJlopeZi4BB/clock
go 1.22.2
require github.com/potassium5703/imageutils v0.0.0-20240510093354-04c781c03a25
go 1.26

2
go.sum
View File

@@ -1,2 +0,0 @@
github.com/potassium5703/imageutils v0.0.0-20240510093354-04c781c03a25 h1:HLqfANMhaSvT5j1S8GTdUr9/+MN6OcAeI+YkjPqDTQc=
github.com/potassium5703/imageutils v0.0.0-20240510093354-04c781c03a25/go.mod h1:eTB7aSWxiurq6gf9A8pZMtwBZAEYRws37EH0Uytaafo=

View File

@@ -1,7 +1,7 @@
package letter
import (
"github.com/potassium5703/imageutils"
"git.niplace.ru/XoxJlopeZi4BB/clock/letter"
"image"
"image/color"
"image/draw"