From ffde1b150faca940bc6c172068aa068cf468aa39 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 25 Apr 2025 15:15:36 +0200 Subject: [chore] Move deps to code.superseriousbusiness.org (#4054) --- .../go-png-image-structure/v2/chunk_decoder.go | 81 ---------------------- 1 file changed, 81 deletions(-) delete mode 100644 vendor/codeberg.org/superseriousbusiness/go-png-image-structure/v2/chunk_decoder.go (limited to 'vendor/codeberg.org/superseriousbusiness/go-png-image-structure/v2/chunk_decoder.go') diff --git a/vendor/codeberg.org/superseriousbusiness/go-png-image-structure/v2/chunk_decoder.go b/vendor/codeberg.org/superseriousbusiness/go-png-image-structure/v2/chunk_decoder.go deleted file mode 100644 index 518bc91ad..000000000 --- a/vendor/codeberg.org/superseriousbusiness/go-png-image-structure/v2/chunk_decoder.go +++ /dev/null @@ -1,81 +0,0 @@ -package pngstructure - -import ( - "bytes" - "fmt" - - "encoding/binary" -) - -type ChunkDecoder struct { -} - -func NewChunkDecoder() *ChunkDecoder { - return new(ChunkDecoder) -} - -func (cd *ChunkDecoder) Decode(c *Chunk) (decoded interface{}, err error) { - switch c.Type { - case "IHDR": - return cd.decodeIHDR(c) - } - - // We don't decode this type. - return nil, nil -} - -type ChunkIHDR struct { - Width uint32 - Height uint32 - BitDepth uint8 - ColorType uint8 - CompressionMethod uint8 - FilterMethod uint8 - InterlaceMethod uint8 -} - -func (ihdr *ChunkIHDR) String() string { - return fmt.Sprintf("IHDR", - ihdr.Width, ihdr.Height, ihdr.BitDepth, ihdr.ColorType, ihdr.CompressionMethod, ihdr.FilterMethod, ihdr.InterlaceMethod, - ) -} - -func (cd *ChunkDecoder) decodeIHDR(c *Chunk) (*ChunkIHDR, error) { - var ( - b = bytes.NewBuffer(c.Data) - ihdr = new(ChunkIHDR) - readf = func(data interface{}) error { - return binary.Read(b, binary.BigEndian, data) - } - ) - - if err := readf(&ihdr.Width); err != nil { - return nil, err - } - - if err := readf(&ihdr.Height); err != nil { - return nil, err - } - - if err := readf(&ihdr.BitDepth); err != nil { - return nil, err - } - - if err := readf(&ihdr.ColorType); err != nil { - return nil, err - } - - if err := readf(&ihdr.CompressionMethod); err != nil { - return nil, err - } - - if err := readf(&ihdr.FilterMethod); err != nil { - return nil, err - } - - if err := readf(&ihdr.InterlaceMethod); err != nil { - return nil, err - } - - return ihdr, nil -} -- cgit v1.2.3