This commit is contained in:
2026-03-29 17:03:48 +03:00
parent 7143e96ef3
commit 3880b353c1
20 changed files with 491 additions and 23 deletions

18
pkg/center/main.go Normal file
View File

@@ -0,0 +1,18 @@
package center
type Into struct {
Src, Dst image.Image
}
func (i Into) Bounds() image.Rectangle { return i.Dst.Bounds() }
func (i Into) ColorModel() color.Model { return i.Dst.ColorModel }
func (i Into) At(x, y int) color.Color {
x1, y1 := (i.Dst.Bounds().Dx()/2)-(i.Src.Bounds().Dx()/2),
(i.Dst.Bounds().Dy()/2)-(i.Src.Bounds().Dy()/2)
r := image.Rect(x1, y1,
x1+i.Src.Bounds().Dx(), y1+i.Src.Bounds().Dy())
if (image.Point{x, y}).In(r) {
return i.Src.At(x-x1,y-y2)
}
return i.Dst.At(x, y)
}