draw

Imports

Imports #

"image"
"image/color"
"image/internal/imageutil"

Constants & Variables

FloydSteinberg var #

FloydSteinberg is a [Drawer] that is the [Src] [Op] with Floyd-Steinberg error diffusion.

var FloydSteinberg Drawer = floydSteinberg{...}

Over const #

Over specifies ``(src in mask) over dst''.

const Over Op = iota

Src const #

Src specifies ``src in mask''.

const Src

m const #

m is the maximum color value returned by image.Color.RGBA.

const m = *ast.BinaryExpr

Type Aliases

Op type #

Op is a Porter-Duff compositing operator.

type Op int

Interfaces

Drawer interface #

Drawer contains the [Draw] method.

type Drawer interface {
Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point)
}

Image interface #

Image is an image.Image with a Set method to change a single pixel.

type Image interface {
image.Image
Set(x int, y int, c color.Color)
}

Quantizer interface #

Quantizer produces a palette for an image.

type Quantizer interface {
Quantize(p color.Palette, m image.Image) color.Palette
}

RGBA64Image interface #

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.

type RGBA64Image interface {
image.RGBA64Image
Set(x int, y int, c color.Color)
SetRGBA64(x int, y int, c color.RGBA64)
}

Structs

floydSteinberg struct #

type floydSteinberg struct {

}

Functions

Draw method #

func (floydSteinberg) Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point)

Draw function #

Draw calls [DrawMask] with a nil mask.

func Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point, op Op)

Draw method #

Draw implements the [Drawer] interface by calling the Draw function with this [Op].

func (op Op) Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point)

DrawMask function #

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.

func DrawMask(dst Image, r image.Rectangle, src image.Image, sp image.Point, mask image.Image, mp image.Point, op Op)

clamp function #

clamp clamps i to the interval [0, 0xffff].

func clamp(i int32) int32

clip function #

clip clips r against each image's bounds (after translating into the destination image's coordinate space) and shifts the points sp and mp by the same amount as the change in r.Min.

func clip(dst Image, r *image.Rectangle, src image.Image, sp *image.Point, mask image.Image, mp *image.Point)

drawCMYK function #

func drawCMYK(dst *image.RGBA, r image.Rectangle, src *image.CMYK, sp image.Point)

drawCopyOver function #

func drawCopyOver(dst *image.RGBA, r image.Rectangle, src *image.RGBA, sp image.Point)

drawCopySrc function #

drawCopySrc copies bytes to dstPix from srcPix. These arguments roughly correspond to the Pix fields of the image package's concrete image.Image implementations, but are offset (dstPix is dst.Pix[dpOffset:] not dst.Pix).

func drawCopySrc(dstPix []byte, dstStride int, r image.Rectangle, srcPix []byte, srcStride int, sp image.Point, bytesPerRow int)

drawFillOver function #

func drawFillOver(dst *image.RGBA, r image.Rectangle, sr uint32, sg uint32, sb uint32, sa uint32)

drawFillSrc function #

func drawFillSrc(dst *image.RGBA, r image.Rectangle, sr uint32, sg uint32, sb uint32, sa uint32)

drawGlyphOver function #

func drawGlyphOver(dst *image.RGBA, r image.Rectangle, src *image.Uniform, mask *image.Alpha, mp image.Point)

drawGray function #

func drawGray(dst *image.RGBA, r image.Rectangle, src *image.Gray, sp image.Point)

drawGrayMaskOver function #

func drawGrayMaskOver(dst *image.RGBA, r image.Rectangle, src *image.Gray, sp image.Point, mask *image.Alpha, mp image.Point)

drawNRGBAOver function #

func drawNRGBAOver(dst *image.RGBA, r image.Rectangle, src *image.NRGBA, sp image.Point)

drawNRGBASrc function #

func drawNRGBASrc(dst *image.RGBA, r image.Rectangle, src *image.NRGBA, sp image.Point)

drawPaletted function #

func drawPaletted(dst Image, r image.Rectangle, src image.Image, sp image.Point, floydSteinberg bool)

drawRGBA function #

func drawRGBA(dst *image.RGBA, r image.Rectangle, src image.Image, sp image.Point, mask image.Image, mp image.Point, op Op)

drawRGBA64ImageMaskOver function #

func drawRGBA64ImageMaskOver(dst *image.RGBA, r image.Rectangle, src image.RGBA64Image, sp image.Point, mask *image.Alpha, mp image.Point)

drawRGBAMaskOver function #

func drawRGBAMaskOver(dst *image.RGBA, r image.Rectangle, src *image.RGBA, sp image.Point, mask *image.Alpha, mp image.Point)

processBackward function #

func processBackward(dst image.Image, r image.Rectangle, src image.Image, sp image.Point) bool

sqDiff function #

sqDiff returns the squared-difference of x and y, shifted by 2 so that adding four of those won't overflow a uint32. x and y are both assumed to be in the range [0, 0xffff].

func sqDiff(x int32, y int32) uint32

Generated with Arrow