]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
deps: Upgrade github.com/gohugoio/gift v0.1.0 => v0.2.0
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 20 Jan 2026 00:43:03 +0000 (01:43 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 20 Jan 2026 08:33:30 +0000 (09:33 +0100)
go.mod
go.sum
resources/images/auto_orient.go
resources/images/dither.go
resources/images/mask.go
resources/images/opacity.go
resources/images/overlay.go
resources/images/padding.go
resources/images/process.go
resources/images/text.go

diff --git a/go.mod b/go.mod
index 3c971354621c53cf79f312deb817ceb4045d1bbd..1a8bf97ce453c35a447afccbddfa27d9b0b4a4ef 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -35,7 +35,7 @@ require (
        github.com/gobuffalo/flect v1.0.3
        github.com/gobwas/glob v0.2.3
        github.com/goccy/go-yaml v1.19.2
-       github.com/gohugoio/gift v0.1.0
+       github.com/gohugoio/gift v0.2.0
        github.com/gohugoio/go-i18n/v2 v2.1.3-0.20251018145728-cfcc22d823c6
        github.com/gohugoio/go-radix v1.2.0
        github.com/gohugoio/hashstructure v0.6.0
diff --git a/go.sum b/go.sum
index ef96f149e7168b4570e7ed936569c5f4d5d0feb8..a2f182198334bd42e44d7760873ac627bddec90b 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -270,6 +270,8 @@ github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
 github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
 github.com/gohugoio/gift v0.1.0 h1:KDx+OBrSn/sXmnMdMLYocOLn35MrBpnVhgQghHxd7g8=
 github.com/gohugoio/gift v0.1.0/go.mod h1:1Mrm5CjF33KpD749Dwj+UAjWZ3LC6cBXGuTMa5XwoP4=
+github.com/gohugoio/gift v0.2.0 h1:vA31pP0rTVmBxBrhpY3WEt+4zM4g+1sDqYeemwsYeqc=
+github.com/gohugoio/gift v0.2.0/go.mod h1:1Mrm5CjF33KpD749Dwj+UAjWZ3LC6cBXGuTMa5XwoP4=
 github.com/gohugoio/go-i18n/v2 v2.1.3-0.20251018145728-cfcc22d823c6 h1:pxlAea9eRwuAnt/zKbGqlFO2ZszpIe24YpOVLf+N+4I=
 github.com/gohugoio/go-i18n/v2 v2.1.3-0.20251018145728-cfcc22d823c6/go.mod h1:m5hu1im5Qc7LDycVLvee6MPobJiRLBYHklypFJR0/aE=
 github.com/gohugoio/go-radix v1.2.0 h1:D5GTk8jIoeXirBSc2P4E4NdHKDrenk9k9N0ctU5Yrhg=
index a57987c7850f2860a39eb30c8656cac0c895836d..cb5efc45467543e14474aa539505f6e6d8e1259c 100644 (file)
@@ -38,7 +38,7 @@ type ImageFilterFromOrientationProvider interface {
        AutoOrient(orientation int) gift.Filter
 }
 
-func (f autoOrientFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) error {
+func (f autoOrientFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) {
        panic("not supported")
 }
 
index 825b06e87a1437ce1990f7fa8d17aebbd773b4ac..61b8362fcaf63ae86ff58b21bc5a27446a51a5ad 100644 (file)
@@ -62,8 +62,8 @@ var ditherMethodsOrdered = map[string]dither.OrderedDitherMatrix{
        "vertical5x3":                dither.Vertical5x3,
 }
 
-func (f ditherFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) error {
-       return gift.New().Draw(dst, f.ditherer.Dither(src))
+func (f ditherFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) {
+       gift.New().Draw(dst, f.ditherer.Dither(src))
 }
 
 func (f ditherFilter) Bounds(srcBounds image.Rectangle) image.Rectangle {
index b3688ef90187068c0aa661e64db5ff950f5b3f98..5ab21bc46cb8680c5c0a0a5f113e7ecea2162ffe 100644 (file)
@@ -15,10 +15,10 @@ type maskFilter struct {
 }
 
 // Draw applies the mask to the base image.
-func (f maskFilter) Draw(dst draw.Image, baseImage image.Image, options *gift.Options) error {
+func (f maskFilter) Draw(dst draw.Image, baseImage image.Image, options *gift.Options) {
        maskImage, err := f.mask.DecodeImage()
        if err != nil {
-               return fmt.Errorf("failed to decode image: %s", err)
+               panic(fmt.Sprintf("failed to decode image: %s", err))
        }
 
        // Ensure the mask is the same size as the base image
@@ -54,11 +54,7 @@ func (f maskFilter) Draw(dst draw.Image, baseImage image.Image, options *gift.Op
        draw.DrawMask(outputImage, baseBounds, baseImage, image.Point{}, alphaMask, image.Point{}, draw.Over)
 
        // Copy the result to the destination
-       if err := gift.New().Draw(dst, outputImage); err != nil {
-               return fmt.Errorf("failed to draw masked image: %s", err)
-       }
-
-       return nil
+       gift.New().Draw(dst, outputImage)
 }
 
 // Bounds returns the bounds of the resulting image.
index b2eaf5f1218053ad5355a040c055861878ddb0ef..37132ab63422fef25c7f267bb2ecfc0af2bd294f 100644 (file)
@@ -27,12 +27,11 @@ type opacityFilter struct {
        opacity float32
 }
 
-func (f opacityFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) error {
+func (f opacityFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) {
        // 0 is fully transparent and 255 is opaque.
        alpha := uint8(f.opacity * 255)
        mask := image.NewUniform(color.Alpha{alpha})
        draw.DrawMask(dst, dst.Bounds(), src, image.Point{}, mask, image.Point{}, draw.Over)
-       return nil
 }
 
 func (f opacityFilter) Bounds(srcBounds image.Rectangle) image.Rectangle {
index 91934ddb92d078eab1496f6f6242216bf213bba1..bc5bb3e782375ab55b1fb5811fcc8058e3a56fb6 100644 (file)
@@ -28,15 +28,13 @@ type overlayFilter struct {
        x, y int
 }
 
-func (f overlayFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) error {
+func (f overlayFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) {
        overlaySrc, err := f.src.DecodeImage()
        if err != nil {
-               return fmt.Errorf("failed to decode image: %s", err)
+               panic(fmt.Sprintf("failed to decode image: %s", err))
        }
-       if err := gift.New().Draw(dst, src); err != nil {
-               return err
-       }
-       return gift.New().DrawAt(dst, overlaySrc, image.Pt(f.x, f.y), gift.OverOperator)
+       gift.New().Draw(dst, src)
+       gift.New().DrawAt(dst, overlaySrc, image.Pt(f.x, f.y), gift.OverOperator)
 }
 
 func (f overlayFilter) Bounds(srcBounds image.Rectangle) image.Rectangle {
index 73341b89ef1969c34d808a16b1a44f898c060a55..70a5a01820a7033cc4a475c0d18316b731d8a96b 100644 (file)
@@ -28,7 +28,7 @@ type paddingFilter struct {
        ccolor                   color.Color // canvas color
 }
 
-func (f paddingFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) error {
+func (f paddingFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) {
        w := src.Bounds().Dx() + f.left + f.right
        h := src.Bounds().Dy() + f.top + f.bottom
 
@@ -41,10 +41,8 @@ func (f paddingFilter) Draw(dst draw.Image, src image.Image, options *gift.Optio
 
        i := image.NewRGBA(image.Rect(0, 0, w, h))
        draw.Draw(i, i.Bounds(), image.NewUniform(f.ccolor), image.Point{}, draw.Src)
-       if err := gift.New().Draw(dst, i); err != nil {
-               return err
-       }
-       return gift.New().DrawAt(dst, src, image.Pt(f.left, f.top), gift.OverOperator)
+       gift.New().Draw(dst, i)
+       gift.New().DrawAt(dst, src, image.Pt(f.left, f.top), gift.OverOperator)
 }
 
 func (f paddingFilter) Bounds(srcBounds image.Rectangle) image.Rectangle {
index ed21fce5f17e7d84bf303f91e7de709c06acbf56..7cd4a886ddf9069ff73fbd578dac8095ffc8dc2c 100644 (file)
@@ -30,7 +30,7 @@ type processFilter struct {
        spec string
 }
 
-func (f processFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) error {
+func (f processFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) {
        panic("not supported")
 }
 
index ae2831638ae5f8bd7156d95b0d3b8b119ad60ae3..8eef2dd5ad42359f107c47555eb67f9c268fdb42 100644 (file)
@@ -42,7 +42,7 @@ type textFilter struct {
        fontSource  hugio.ReadSeekCloserProvider
 }
 
-func (f textFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) error {
+func (f textFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) {
        // Load and parse font
        ttf := goregular.TTF
        if f.fontSource != nil {
@@ -143,7 +143,6 @@ func (f textFilter) Draw(dst draw.Image, src image.Image, options *gift.Options)
                d.DrawString(line)
                y = y + fontHeight + f.linespacing
        }
-       return nil
 }
 
 func (f textFilter) Bounds(srcBounds image.Rectangle) image.Rectangle {