// Generated by Lisette bindgen
// Source: image/png (Go stdlib)
// Go: 1.25.5
// Lisette: 0.1.11

import "go:image"
import "go:io"

pub enum CompressionLevel: int {
  BestCompression = -3,
  BestSpeed = -2,
  DefaultCompression = 0,
  NoCompression = -1,
}

pub const BestCompression: CompressionLevel = -3

pub const BestSpeed: CompressionLevel = -2

pub const DefaultCompression: CompressionLevel = 0

pub const NoCompression: CompressionLevel = -1

/// Decode reads a PNG image from r and returns it as an [image.Image].
/// The type of Image returned depends on the PNG contents.
pub fn Decode(r: io.Reader) -> Result<image.Image, error>

/// DecodeConfig returns the color model and dimensions of a PNG image without
/// decoding the entire image.
pub fn DecodeConfig(r: io.Reader) -> Result<image.Config, error>

/// Encode writes the Image m to w in PNG format. Any Image may be
/// encoded, but images that are not [image.NRGBA] might be encoded lossily.
pub fn Encode(w: io.Writer, m: image.Image) -> Result<(), error>

/// Encoder configures encoding PNG images.
pub struct Encoder {
  pub CompressionLevel: CompressionLevel,
  pub BufferPool: Option<EncoderBufferPool>,
}

/// EncoderBuffer holds the buffers used for encoding PNG images.
pub type EncoderBuffer

/// EncoderBufferPool is an interface for getting and returning temporary
/// instances of the [EncoderBuffer] struct. This can be used to reuse buffers
/// when encoding multiple images.
pub interface EncoderBufferPool {
  fn Get() -> Ref<EncoderBuffer>
  fn Put(arg0: Ref<EncoderBuffer>)
}

/// A FormatError reports that the input is not a valid PNG.
pub struct FormatError(string)

/// An UnsupportedError reports that the input uses a valid but unimplemented PNG feature.
pub struct UnsupportedError(string)

impl Encoder {
  /// Encode writes the Image m to w in PNG format.
  fn Encode(self: Ref<Encoder>, w: io.Writer, m: image.Image) -> Result<(), error>
}

impl FormatError {
  fn Error(self) -> string
}

impl UnsupportedError {
  fn Error(self) -> string
}
