Package draw

import "image/draw"
Overview
Index
Examples

Overview ▾

打包绘图提供图像合成功能.

有关此程序包的介绍,请参见" Go image / draw程序包": https : //golang.org/doc/articles/image_draw.html

func Draw

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

使用零遮罩进行Draw调用DrawMask.

func DrawMask

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

DrawMask将dst中的r.Min与src中的sp以及mask中的mp对齐,然后用Porter-Duff合成的结果替换dst中的矩形r. 无面膜被视为不透明.

type Drawer 1.2

抽屉包含Draw方法.

type Drawer interface {
    // Draw aligns r.Min in dst with sp in src and then replaces the
    // rectangle r in dst with the result of drawing src on dst.
    Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point)
}

FloydSteinberg是一个抽屉,是具有Floyd-Steinberg误差扩散的Src Op.

var FloydSteinberg Drawer = floydSteinberg{}

范例(FloydSteinberg)

type Image

Image是一幅图像.使用Set方法更改单个像素的图像.

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

type Op

Op是Porter-Duff合成运算符.

type Op int
const (
    // Over specifies ``(src in mask) over dst''.
    Over Op = iota
    // Src specifies ``src in mask''.
    Src
)

func (Op) Draw 1.2

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

Draw通过使用此Op调用Draw函数来实现Drawer接口.

type Quantizer 1.2

量化器为图像生成调色板.

type Quantizer interface {
    // Quantize appends up to cap(p) - len(p) colors to p and returns the
    // updated palette suitable for converting m to a paletted image.
    Quantize(p color.Palette, m image.Image) color.Palette
}

by  ICOPY.SITE