github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/image/png/reader.go (about)

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // パッケージpngは、PNG画像のデコーダとエンコーダを実装します。
     6  //
     7  // PNGの仕様は https://www.w3.org/TR/PNG/ にあります。
     8  package png
     9  
    10  import (
    11  	"github.com/shogo82148/std/image"
    12  	"github.com/shogo82148/std/io"
    13  )
    14  
    15  // FormatErrorは、入力が有効なPNGではないことを報告します。
    16  type FormatError string
    17  
    18  func (e FormatError) Error() string
    19  
    20  // UnsupportedErrorは、入力が有効だが未実装のPNG機能を使用していることを報告します。
    21  type UnsupportedError string
    22  
    23  func (e UnsupportedError) Error() string
    24  
    25  // Decodeは、rからPNG画像を読み取り、それを [image.Image] として返します。
    26  // 返されるImageの型は、PNGの内容に依存します。
    27  func Decode(r io.Reader) (image.Image, error)
    28  
    29  // DecodeConfigは、画像全体をデコードすることなく、PNG画像のカラーモデルと寸法を返します。
    30  func DecodeConfig(r io.Reader) (image.Config, error)