// Generated by Lisette bindgen
// Source: image (Go stdlib)
// Go: 1.25.10
// Lisette: 0.3.0

import "go:image/color"
import "go:io"

/// YCbCrSubsampleRatio is the chroma subsample ratio used in a YCbCr image.
pub struct YCbCrSubsampleRatio(int)

pub const YCbCrSubsampleRatio410: YCbCrSubsampleRatio = 5

pub const YCbCrSubsampleRatio411: YCbCrSubsampleRatio = 4

pub const YCbCrSubsampleRatio420: YCbCrSubsampleRatio = 2

pub const YCbCrSubsampleRatio422: YCbCrSubsampleRatio = 1

pub const YCbCrSubsampleRatio440: YCbCrSubsampleRatio = 3

pub const YCbCrSubsampleRatio444: YCbCrSubsampleRatio = 0

/// Decode decodes an image that has been encoded in a registered format.
/// The string returned is the format name used during format registration.
/// Format registration is typically done by an init function in the codec-
/// specific package.
pub fn Decode(r: io.Reader) -> Result<(Image, string), error>

/// DecodeConfig decodes the color model and dimensions of an image that has
/// been encoded in a registered format. The string returned is the format name
/// used during format registration. Format registration is typically done by
/// an init function in the codec-specific package.
pub fn DecodeConfig(r: io.Reader) -> Result<(Config, string), error>

/// NewAlpha returns a new [Alpha] image with the given bounds.
pub fn NewAlpha(r: Rectangle) -> Ref<Alpha>

/// NewAlpha16 returns a new [Alpha16] image with the given bounds.
pub fn NewAlpha16(r: Rectangle) -> Ref<Alpha16>

/// NewCMYK returns a new CMYK image with the given bounds.
pub fn NewCMYK(r: Rectangle) -> Ref<CMYK>

/// NewGray returns a new [Gray] image with the given bounds.
pub fn NewGray(r: Rectangle) -> Ref<Gray>

/// NewGray16 returns a new [Gray16] image with the given bounds.
pub fn NewGray16(r: Rectangle) -> Ref<Gray16>

/// NewNRGBA returns a new [NRGBA] image with the given bounds.
pub fn NewNRGBA(r: Rectangle) -> Ref<NRGBA>

/// NewNRGBA64 returns a new [NRGBA64] image with the given bounds.
pub fn NewNRGBA64(r: Rectangle) -> Ref<NRGBA64>

/// NewNYCbCrA returns a new [NYCbCrA] image with the given bounds and subsample
/// ratio.
pub fn NewNYCbCrA(r: Rectangle, subsampleRatio: YCbCrSubsampleRatio) -> Ref<NYCbCrA>

/// NewPaletted returns a new [Paletted] image with the given width, height and
/// palette.
pub fn NewPaletted(r: Rectangle, p: color.Palette) -> Ref<Paletted>

/// NewRGBA returns a new [RGBA] image with the given bounds.
pub fn NewRGBA(r: Rectangle) -> Ref<RGBA>

/// NewRGBA64 returns a new [RGBA64] image with the given bounds.
pub fn NewRGBA64(r: Rectangle) -> Ref<RGBA64>

/// NewUniform returns a new [Uniform] image of the given color.
pub fn NewUniform(c: color.Color) -> Ref<Uniform>

/// NewYCbCr returns a new YCbCr image with the given bounds and subsample
/// ratio.
pub fn NewYCbCr(r: Rectangle, subsampleRatio: YCbCrSubsampleRatio) -> Ref<YCbCr>

/// Pt is shorthand for [Point]{X, Y}.
pub fn Pt(x: int, y: int) -> Point

/// Rect is shorthand for [Rectangle]{Pt(x0, y0), [Pt](x1, y1)}. The returned
/// rectangle has minimum and maximum coordinates swapped if necessary so that
/// it is well-formed.
pub fn Rect(x0: int, y0: int, x1: int, y1: int) -> Rectangle

/// RegisterFormat registers an image format for use by [Decode].
/// Name is the name of the format, like "jpeg" or "png".
/// Magic is the magic prefix that identifies the format's encoding. The magic
/// string can contain "?" wildcards that each match any one byte.
/// [Decode] is the function that decodes the encoded image.
/// [DecodeConfig] is the function that decodes just its configuration.
pub fn RegisterFormat(
  name: string,
  magic: string,
  decode: fn(io.Reader) -> Result<Image, error>,
  decodeConfig: fn(io.Reader) -> Result<Config, error>,
)

/// Alpha is an in-memory image whose At method returns [color.Alpha] values.
pub struct Alpha {
  pub Pix: Slice<uint8>,
  pub Stride: int,
  pub Rect: Rectangle,
}

/// Alpha16 is an in-memory image whose At method returns [color.Alpha16] values.
pub struct Alpha16 {
  pub Pix: Slice<uint8>,
  pub Stride: int,
  pub Rect: Rectangle,
}

/// CMYK is an in-memory image whose At method returns [color.CMYK] values.
pub struct CMYK {
  pub Pix: Slice<uint8>,
  pub Stride: int,
  pub Rect: Rectangle,
}

/// Config holds an image's color model and dimensions.
pub struct Config {
  pub ColorModel: Option<color.Model>,
  pub Width: int,
  pub Height: int,
}

/// Gray is an in-memory image whose At method returns [color.Gray] values.
pub struct Gray {
  pub Pix: Slice<uint8>,
  pub Stride: int,
  pub Rect: Rectangle,
}

/// Gray16 is an in-memory image whose At method returns [color.Gray16] values.
pub struct Gray16 {
  pub Pix: Slice<uint8>,
  pub Stride: int,
  pub Rect: Rectangle,
}

/// Image is a finite rectangular grid of [color.Color] values taken from a color
/// model.
pub interface Image {
  fn At(x: int, y: int) -> Option<color.Color>
  fn Bounds() -> Rectangle
  fn ColorModel() -> Option<color.Model>
}

/// NRGBA is an in-memory image whose At method returns [color.NRGBA] values.
pub struct NRGBA {
  pub Pix: Slice<uint8>,
  pub Stride: int,
  pub Rect: Rectangle,
}

/// NRGBA64 is an in-memory image whose At method returns [color.NRGBA64] values.
pub struct NRGBA64 {
  pub Pix: Slice<uint8>,
  pub Stride: int,
  pub Rect: Rectangle,
}

/// NYCbCrA is an in-memory image of non-alpha-premultiplied Y'CbCr-with-alpha
/// colors. A and AStride are analogous to the Y and YStride fields of the
/// embedded YCbCr.
pub struct NYCbCrA {
  pub YCbCr: YCbCr,
  pub A: Slice<uint8>,
  pub AStride: int,
}

/// Paletted is an in-memory image of uint8 indices into a given palette.
pub struct Paletted {
  pub Pix: Slice<uint8>,
  pub Stride: int,
  pub Rect: Rectangle,
  pub Palette: color.Palette,
}

/// PalettedImage is an image whose colors may come from a limited palette.
/// If m is a PalettedImage and m.ColorModel() returns a [color.Palette] p,
/// then m.At(x, y) should be equivalent to p[m.ColorIndexAt(x, y)]. If m's
/// color model is not a color.Palette, then ColorIndexAt's behavior is
/// undefined.
pub interface PalettedImage {
  fn At(x: int, y: int) -> Option<color.Color>
  fn Bounds() -> Rectangle
  fn ColorIndexAt(x: int, y: int) -> uint8
  fn ColorModel() -> Option<color.Model>
}

/// A Point is an X, Y coordinate pair. The axes increase right and down.
pub struct Point {
  pub X: int,
  pub Y: int,
}

/// RGBA is an in-memory image whose At method returns [color.RGBA] values.
pub struct RGBA {
  pub Pix: Slice<uint8>,
  pub Stride: int,
  pub Rect: Rectangle,
}

/// RGBA64 is an in-memory image whose At method returns [color.RGBA64] values.
pub struct RGBA64 {
  pub Pix: Slice<uint8>,
  pub Stride: int,
  pub Rect: Rectangle,
}

/// RGBA64Image is an [Image] whose pixels can be converted directly to a
/// color.RGBA64.
pub interface RGBA64Image {
  fn At(x: int, y: int) -> Option<color.Color>
  fn Bounds() -> Rectangle
  fn ColorModel() -> Option<color.Model>
  fn RGBA64At(x: int, y: int) -> color.RGBA64
}

/// A Rectangle contains the points with Min.X <= X < Max.X, Min.Y <= Y < Max.Y.
/// It is well-formed if Min.X <= Max.X and likewise for Y. Points are always
/// well-formed. A rectangle's methods always return well-formed outputs for
/// well-formed inputs.
/// 
/// A Rectangle is also an [Image] whose bounds are the rectangle itself. At
/// returns color.Opaque for points in the rectangle and color.Transparent
/// otherwise.
pub struct Rectangle {
  pub Min: Point,
  pub Max: Point,
}

/// Uniform is an infinite-sized [Image] of uniform color.
/// It implements the [color.Color], [color.Model], and [Image] interfaces.
pub struct Uniform {
  pub C: Option<color.Color>,
}

/// YCbCr is an in-memory image of Y'CbCr colors. There is one Y sample per
/// pixel, but each Cb and Cr sample can span one or more pixels.
/// YStride is the Y slice index delta between vertically adjacent pixels.
/// CStride is the Cb and Cr slice index delta between vertically adjacent pixels
/// that map to separate chroma samples.
/// It is not an absolute requirement, but YStride and len(Y) are typically
/// multiples of 8, and:
/// 
/// 	For 4:4:4, CStride == YStride/1 && len(Cb) == len(Cr) == len(Y)/1.
/// 	For 4:2:2, CStride == YStride/2 && len(Cb) == len(Cr) == len(Y)/2.
/// 	For 4:2:0, CStride == YStride/2 && len(Cb) == len(Cr) == len(Y)/4.
/// 	For 4:4:0, CStride == YStride/1 && len(Cb) == len(Cr) == len(Y)/2.
/// 	For 4:1:1, CStride == YStride/4 && len(Cb) == len(Cr) == len(Y)/4.
/// 	For 4:1:0, CStride == YStride/4 && len(Cb) == len(Cr) == len(Y)/8.
pub struct YCbCr {
  pub Y: Slice<uint8>,
  pub Cb: Slice<uint8>,
  pub Cr: Slice<uint8>,
  pub YStride: int,
  pub CStride: int,
  pub SubsampleRatio: YCbCrSubsampleRatio,
  pub Rect: Rectangle,
}

pub var Black: Ref<Uniform>

/// ErrFormat indicates that decoding encountered an unknown format.
pub var ErrFormat: error

pub var Opaque: Ref<Uniform>

pub var Transparent: Ref<Uniform>

pub var White: Ref<Uniform>

pub var ZP: Point

pub var ZR: Rectangle

impl Alpha {
  fn AlphaAt(self: Ref<Alpha>, x: int, y: int) -> color.Alpha

  fn At(self: Ref<Alpha>, x: int, y: int) -> color.Color

  fn Bounds(self: Ref<Alpha>) -> Rectangle

  fn ColorModel(self: Ref<Alpha>) -> color.Model

  /// Opaque scans the entire image and reports whether it is fully opaque.
  fn Opaque(self: Ref<Alpha>) -> bool

  /// PixOffset returns the index of the first element of Pix that corresponds to
  /// the pixel at (x, y).
  fn PixOffset(self: Ref<Alpha>, x: int, y: int) -> int

  fn RGBA64At(self: Ref<Alpha>, x: int, y: int) -> color.RGBA64

  fn Set(self: Ref<Alpha>, x: int, y: int, c: color.Color)

  fn SetAlpha(self: Ref<Alpha>, x: int, y: int, c: color.Alpha)

  fn SetRGBA64(self: Ref<Alpha>, x: int, y: int, c: color.RGBA64)

  /// SubImage returns an image representing the portion of the image p visible
  /// through r. The returned value shares pixels with the original image.
  fn SubImage(self: Ref<Alpha>, r: Rectangle) -> Image
}

impl Alpha16 {
  fn Alpha16At(self: Ref<Alpha16>, x: int, y: int) -> color.Alpha16

  fn At(self: Ref<Alpha16>, x: int, y: int) -> color.Color

  fn Bounds(self: Ref<Alpha16>) -> Rectangle

  fn ColorModel(self: Ref<Alpha16>) -> color.Model

  /// Opaque scans the entire image and reports whether it is fully opaque.
  fn Opaque(self: Ref<Alpha16>) -> bool

  /// PixOffset returns the index of the first element of Pix that corresponds to
  /// the pixel at (x, y).
  fn PixOffset(self: Ref<Alpha16>, x: int, y: int) -> int

  fn RGBA64At(self: Ref<Alpha16>, x: int, y: int) -> color.RGBA64

  fn Set(self: Ref<Alpha16>, x: int, y: int, c: color.Color)

  fn SetAlpha16(self: Ref<Alpha16>, x: int, y: int, c: color.Alpha16)

  fn SetRGBA64(self: Ref<Alpha16>, x: int, y: int, c: color.RGBA64)

  /// SubImage returns an image representing the portion of the image p visible
  /// through r. The returned value shares pixels with the original image.
  fn SubImage(self: Ref<Alpha16>, r: Rectangle) -> Image
}

impl CMYK {
  fn At(self: Ref<CMYK>, x: int, y: int) -> color.Color

  fn Bounds(self: Ref<CMYK>) -> Rectangle

  fn CMYKAt(self: Ref<CMYK>, x: int, y: int) -> color.CMYK

  fn ColorModel(self: Ref<CMYK>) -> color.Model

  /// Opaque scans the entire image and reports whether it is fully opaque.
  fn Opaque(self: Ref<CMYK>) -> bool

  /// PixOffset returns the index of the first element of Pix that corresponds to
  /// the pixel at (x, y).
  fn PixOffset(self: Ref<CMYK>, x: int, y: int) -> int

  fn RGBA64At(self: Ref<CMYK>, x: int, y: int) -> color.RGBA64

  fn Set(self: Ref<CMYK>, x: int, y: int, c: color.Color)

  fn SetCMYK(self: Ref<CMYK>, x: int, y: int, c: color.CMYK)

  fn SetRGBA64(self: Ref<CMYK>, x: int, y: int, c: color.RGBA64)

  /// SubImage returns an image representing the portion of the image p visible
  /// through r. The returned value shares pixels with the original image.
  fn SubImage(self: Ref<CMYK>, r: Rectangle) -> Image
}

impl Gray {
  fn At(self: Ref<Gray>, x: int, y: int) -> color.Color

  fn Bounds(self: Ref<Gray>) -> Rectangle

  fn ColorModel(self: Ref<Gray>) -> color.Model

  fn GrayAt(self: Ref<Gray>, x: int, y: int) -> color.Gray

  /// Opaque scans the entire image and reports whether it is fully opaque.
  fn Opaque(self: Ref<Gray>) -> bool

  /// PixOffset returns the index of the first element of Pix that corresponds to
  /// the pixel at (x, y).
  fn PixOffset(self: Ref<Gray>, x: int, y: int) -> int

  fn RGBA64At(self: Ref<Gray>, x: int, y: int) -> color.RGBA64

  fn Set(self: Ref<Gray>, x: int, y: int, c: color.Color)

  fn SetGray(self: Ref<Gray>, x: int, y: int, c: color.Gray)

  fn SetRGBA64(self: Ref<Gray>, x: int, y: int, c: color.RGBA64)

  /// SubImage returns an image representing the portion of the image p visible
  /// through r. The returned value shares pixels with the original image.
  fn SubImage(self: Ref<Gray>, r: Rectangle) -> Image
}

impl Gray16 {
  fn At(self: Ref<Gray16>, x: int, y: int) -> color.Color

  fn Bounds(self: Ref<Gray16>) -> Rectangle

  fn ColorModel(self: Ref<Gray16>) -> color.Model

  fn Gray16At(self: Ref<Gray16>, x: int, y: int) -> color.Gray16

  /// Opaque scans the entire image and reports whether it is fully opaque.
  fn Opaque(self: Ref<Gray16>) -> bool

  /// PixOffset returns the index of the first element of Pix that corresponds to
  /// the pixel at (x, y).
  fn PixOffset(self: Ref<Gray16>, x: int, y: int) -> int

  fn RGBA64At(self: Ref<Gray16>, x: int, y: int) -> color.RGBA64

  fn Set(self: Ref<Gray16>, x: int, y: int, c: color.Color)

  fn SetGray16(self: Ref<Gray16>, x: int, y: int, c: color.Gray16)

  fn SetRGBA64(self: Ref<Gray16>, x: int, y: int, c: color.RGBA64)

  /// SubImage returns an image representing the portion of the image p visible
  /// through r. The returned value shares pixels with the original image.
  fn SubImage(self: Ref<Gray16>, r: Rectangle) -> Image
}

impl NRGBA {
  fn At(self: Ref<NRGBA>, x: int, y: int) -> color.Color

  fn Bounds(self: Ref<NRGBA>) -> Rectangle

  fn ColorModel(self: Ref<NRGBA>) -> color.Model

  fn NRGBAAt(self: Ref<NRGBA>, x: int, y: int) -> color.NRGBA

  /// Opaque scans the entire image and reports whether it is fully opaque.
  fn Opaque(self: Ref<NRGBA>) -> bool

  /// PixOffset returns the index of the first element of Pix that corresponds to
  /// the pixel at (x, y).
  fn PixOffset(self: Ref<NRGBA>, x: int, y: int) -> int

  fn RGBA64At(self: Ref<NRGBA>, x: int, y: int) -> color.RGBA64

  fn Set(self: Ref<NRGBA>, x: int, y: int, c: color.Color)

  fn SetNRGBA(self: Ref<NRGBA>, x: int, y: int, c: color.NRGBA)

  fn SetRGBA64(self: Ref<NRGBA>, x: int, y: int, c: color.RGBA64)

  /// SubImage returns an image representing the portion of the image p visible
  /// through r. The returned value shares pixels with the original image.
  fn SubImage(self: Ref<NRGBA>, r: Rectangle) -> Image
}

impl NRGBA64 {
  fn At(self: Ref<NRGBA64>, x: int, y: int) -> color.Color

  fn Bounds(self: Ref<NRGBA64>) -> Rectangle

  fn ColorModel(self: Ref<NRGBA64>) -> color.Model

  fn NRGBA64At(self: Ref<NRGBA64>, x: int, y: int) -> color.NRGBA64

  /// Opaque scans the entire image and reports whether it is fully opaque.
  fn Opaque(self: Ref<NRGBA64>) -> bool

  /// PixOffset returns the index of the first element of Pix that corresponds to
  /// the pixel at (x, y).
  fn PixOffset(self: Ref<NRGBA64>, x: int, y: int) -> int

  fn RGBA64At(self: Ref<NRGBA64>, x: int, y: int) -> color.RGBA64

  fn Set(self: Ref<NRGBA64>, x: int, y: int, c: color.Color)

  fn SetNRGBA64(self: Ref<NRGBA64>, x: int, y: int, c: color.NRGBA64)

  fn SetRGBA64(self: Ref<NRGBA64>, x: int, y: int, c: color.RGBA64)

  /// SubImage returns an image representing the portion of the image p visible
  /// through r. The returned value shares pixels with the original image.
  fn SubImage(self: Ref<NRGBA64>, r: Rectangle) -> Image
}

impl NYCbCrA {
  /// AOffset returns the index of the first element of A that corresponds to the
  /// pixel at (x, y).
  fn AOffset(self: Ref<NYCbCrA>, x: int, y: int) -> int

  fn At(self: Ref<NYCbCrA>, x: int, y: int) -> color.Color

  fn Bounds(self: Ref<NYCbCrA>) -> Rectangle

  /// COffset returns the index of the first element of Cb or Cr that corresponds
  /// to the pixel at (x, y).
  fn COffset(self: Ref<NYCbCrA>, x: int, y: int) -> int

  fn ColorModel(self: Ref<NYCbCrA>) -> color.Model

  fn NYCbCrAAt(self: Ref<NYCbCrA>, x: int, y: int) -> color.NYCbCrA

  /// Opaque scans the entire image and reports whether it is fully opaque.
  fn Opaque(self: Ref<NYCbCrA>) -> bool

  fn RGBA64At(self: Ref<NYCbCrA>, x: int, y: int) -> color.RGBA64

  /// SubImage returns an image representing the portion of the image p visible
  /// through r. The returned value shares pixels with the original image.
  fn SubImage(self: Ref<NYCbCrA>, r: Rectangle) -> Image

  fn YCbCrAt(self: Ref<NYCbCrA>, x: int, y: int) -> color.YCbCr

  /// YOffset returns the index of the first element of Y that corresponds to
  /// the pixel at (x, y).
  fn YOffset(self: Ref<NYCbCrA>, x: int, y: int) -> int
}

impl Paletted {
  fn At(self: Ref<Paletted>, x: int, y: int) -> Option<color.Color>

  fn Bounds(self: Ref<Paletted>) -> Rectangle

  fn ColorIndexAt(self: Ref<Paletted>, x: int, y: int) -> uint8

  fn ColorModel(self: Ref<Paletted>) -> color.Model

  /// Opaque scans the entire image and reports whether it is fully opaque.
  fn Opaque(self: Ref<Paletted>) -> bool

  /// PixOffset returns the index of the first element of Pix that corresponds to
  /// the pixel at (x, y).
  fn PixOffset(self: Ref<Paletted>, x: int, y: int) -> int

  fn RGBA64At(self: Ref<Paletted>, x: int, y: int) -> color.RGBA64

  fn Set(self: Ref<Paletted>, x: int, y: int, c: color.Color)

  fn SetColorIndex(self: Ref<Paletted>, x: int, y: int, index: uint8)

  fn SetRGBA64(self: Ref<Paletted>, x: int, y: int, c: color.RGBA64)

  /// SubImage returns an image representing the portion of the image p visible
  /// through r. The returned value shares pixels with the original image.
  fn SubImage(self: Ref<Paletted>, r: Rectangle) -> Image
}

impl Point {
  /// Add returns the vector p+q.
  fn Add(self, q: Point) -> Point

  /// Div returns the vector p/k.
  fn Div(self, k: int) -> Point

  /// Eq reports whether p and q are equal.
  fn Eq(self, q: Point) -> bool

  /// In reports whether p is in r.
  fn In(self, r: Rectangle) -> bool

  /// Mod returns the point q in r such that p.X-q.X is a multiple of r's width
  /// and p.Y-q.Y is a multiple of r's height.
  fn Mod(self, r: Rectangle) -> Point

  /// Mul returns the vector p*k.
  fn Mul(self, k: int) -> Point

  /// String returns a string representation of p like "(3,4)".
  fn String(self) -> string

  /// Sub returns the vector p-q.
  fn Sub(self, q: Point) -> Point
}

impl RGBA {
  fn At(self: Ref<RGBA>, x: int, y: int) -> color.Color

  fn Bounds(self: Ref<RGBA>) -> Rectangle

  fn ColorModel(self: Ref<RGBA>) -> color.Model

  /// Opaque scans the entire image and reports whether it is fully opaque.
  fn Opaque(self: Ref<RGBA>) -> bool

  /// PixOffset returns the index of the first element of Pix that corresponds to
  /// the pixel at (x, y).
  fn PixOffset(self: Ref<RGBA>, x: int, y: int) -> int

  fn RGBA64At(self: Ref<RGBA>, x: int, y: int) -> color.RGBA64

  fn RGBAAt(self: Ref<RGBA>, x: int, y: int) -> color.RGBA

  fn Set(self: Ref<RGBA>, x: int, y: int, c: color.Color)

  fn SetRGBA(self: Ref<RGBA>, x: int, y: int, c: color.RGBA)

  fn SetRGBA64(self: Ref<RGBA>, x: int, y: int, c: color.RGBA64)

  /// SubImage returns an image representing the portion of the image p visible
  /// through r. The returned value shares pixels with the original image.
  fn SubImage(self: Ref<RGBA>, r: Rectangle) -> Image
}

impl RGBA64 {
  fn At(self: Ref<RGBA64>, x: int, y: int) -> color.Color

  fn Bounds(self: Ref<RGBA64>) -> Rectangle

  fn ColorModel(self: Ref<RGBA64>) -> color.Model

  /// Opaque scans the entire image and reports whether it is fully opaque.
  fn Opaque(self: Ref<RGBA64>) -> bool

  /// PixOffset returns the index of the first element of Pix that corresponds to
  /// the pixel at (x, y).
  fn PixOffset(self: Ref<RGBA64>, x: int, y: int) -> int

  fn RGBA64At(self: Ref<RGBA64>, x: int, y: int) -> color.RGBA64

  fn Set(self: Ref<RGBA64>, x: int, y: int, c: color.Color)

  fn SetRGBA64(self: Ref<RGBA64>, x: int, y: int, c: color.RGBA64)

  /// SubImage returns an image representing the portion of the image p visible
  /// through r. The returned value shares pixels with the original image.
  fn SubImage(self: Ref<RGBA64>, r: Rectangle) -> Image
}

impl Rectangle {
  /// Add returns the rectangle r translated by p.
  fn Add(self, p: Point) -> Rectangle

  /// At implements the [Image] interface.
  fn At(self, x: int, y: int) -> color.Color

  /// Bounds implements the [Image] interface.
  fn Bounds(self) -> Rectangle

  /// Canon returns the canonical version of r. The returned rectangle has minimum
  /// and maximum coordinates swapped if necessary so that it is well-formed.
  fn Canon(self) -> Rectangle

  /// ColorModel implements the [Image] interface.
  fn ColorModel(self) -> color.Model

  /// Dx returns r's width.
  fn Dx(self) -> int

  /// Dy returns r's height.
  fn Dy(self) -> int

  /// Empty reports whether the rectangle contains no points.
  fn Empty(self) -> bool

  /// Eq reports whether r and s contain the same set of points. All empty
  /// rectangles are considered equal.
  fn Eq(self, s: Rectangle) -> bool

  /// In reports whether every point in r is in s.
  fn In(self, s: Rectangle) -> bool

  /// Inset returns the rectangle r inset by n, which may be negative. If either
  /// of r's dimensions is less than 2*n then an empty rectangle near the center
  /// of r will be returned.
  fn Inset(self, n: int) -> Rectangle

  /// Intersect returns the largest rectangle contained by both r and s. If the
  /// two rectangles do not overlap then the zero rectangle will be returned.
  fn Intersect(self, s: Rectangle) -> Rectangle

  /// Overlaps reports whether r and s have a non-empty intersection.
  fn Overlaps(self, s: Rectangle) -> bool

  /// RGBA64At implements the [RGBA64Image] interface.
  fn RGBA64At(self, x: int, y: int) -> color.RGBA64

  /// Size returns r's width and height.
  fn Size(self) -> Point

  /// String returns a string representation of r like "(3,4)-(6,5)".
  fn String(self) -> string

  /// Sub returns the rectangle r translated by -p.
  fn Sub(self, p: Point) -> Rectangle

  /// Union returns the smallest rectangle that contains both r and s.
  fn Union(self, s: Rectangle) -> Rectangle
}

impl Uniform {
  fn At(self: Ref<Uniform>, x: int, y: int) -> Option<color.Color>

  fn Bounds(self: Ref<Uniform>) -> Rectangle

  fn ColorModel(self: Ref<Uniform>) -> color.Model

  fn Convert(self: Ref<Uniform>, color: color.Color) -> Option<color.Color>

  /// Opaque scans the entire image and reports whether it is fully opaque.
  fn Opaque(self: Ref<Uniform>) -> bool

  fn RGBA(self: Ref<Uniform>) -> (uint32, uint32, uint32, uint32)

  fn RGBA64At(self: Ref<Uniform>, x: int, y: int) -> color.RGBA64
}

impl YCbCr {
  fn At(self: Ref<YCbCr>, x: int, y: int) -> color.Color

  fn Bounds(self: Ref<YCbCr>) -> Rectangle

  /// COffset returns the index of the first element of Cb or Cr that corresponds
  /// to the pixel at (x, y).
  fn COffset(self: Ref<YCbCr>, x: int, y: int) -> int

  fn ColorModel(self: Ref<YCbCr>) -> color.Model

  fn Opaque(self: Ref<YCbCr>) -> bool

  fn RGBA64At(self: Ref<YCbCr>, x: int, y: int) -> color.RGBA64

  /// SubImage returns an image representing the portion of the image p visible
  /// through r. The returned value shares pixels with the original image.
  fn SubImage(self: Ref<YCbCr>, r: Rectangle) -> Image

  fn YCbCrAt(self: Ref<YCbCr>, x: int, y: int) -> color.YCbCr

  /// YOffset returns the index of the first element of Y that corresponds to
  /// the pixel at (x, y).
  fn YOffset(self: Ref<YCbCr>, x: int, y: int) -> int
}

impl YCbCrSubsampleRatio {
  fn String(self) -> string
}
