lisette-stdlib 0.2.13

Little language inspired by Rust that compiles to Go
Documentation
// Generated by Lisette bindgen
// Source: image/draw (Go stdlib)
// Go: 1.25.10
// Lisette: 0.2.1

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

pub enum Op: int {
  Over = 0,
  Src = 1,
}

pub const Over: Op = 0

pub const Src: Op = 1

/// Draw calls [DrawMask] with a nil mask.
pub fn Draw(
  dst: Image,
  r: image.Rectangle,
  src: image.Image,
  sp: image.Point,
  op: Op,
)

/// DrawMask aligns r.Min in dst with sp in src and mp in mask and then replaces the rectangle r
/// in dst with the result of a Porter-Duff composition. A nil mask is treated as opaque.
pub fn DrawMask(
  dst: Image,
  r: image.Rectangle,
  src: image.Image,
  sp: image.Point,
  mask: image.Image,
  mp: image.Point,
  op: Op,
)

/// Drawer contains the [Draw] method.
pub interface Drawer {
  fn Draw(dst: Image, r: image.Rectangle, src: image.Image, sp: image.Point)
}

/// Image is an image.Image with a Set method to change a single pixel.
pub interface Image {
  fn At(x: int, y: int) -> Option<color.Color>
  fn Bounds() -> image.Rectangle
  fn ColorModel() -> Option<color.Model>
  fn Set(x: int, y: int, c: color.Color)
}

/// Quantizer produces a palette for an image.
pub interface Quantizer {
  fn Quantize(p: color.Palette, m: image.Image) -> color.Palette
}

/// RGBA64Image extends both the [Image] and [image.RGBA64Image] interfaces with a
/// SetRGBA64 method to change a single pixel. SetRGBA64 is equivalent to
/// calling Set, but it can avoid allocations from converting concrete color
/// types to the [color.Color] interface type.
pub interface RGBA64Image {
  fn At(x: int, y: int) -> Option<color.Color>
  fn Bounds() -> image.Rectangle
  fn ColorModel() -> Option<color.Model>
  fn RGBA64At(x: int, y: int) -> color.RGBA64
  fn Set(x: int, y: int, c: color.Color)
  fn SetRGBA64(x: int, y: int, c: color.RGBA64)
}

pub var FloydSteinberg: Drawer

impl Op {
  /// Draw implements the [Drawer] interface by calling the Draw function with this
  /// [Op].
  fn Draw(
    self,
    dst: Image,
    r: image.Rectangle,
    src: image.Image,
    sp: image.Point,
  )
}