Documentation ¶
Index ¶
- Variables
- func ApplyErrorDiffusion(img AdjustableImage, palette color.Palette, diffusers *ErrorDiffusionMatrix) *image.Paletted
- func Downscale(img image.Image, factor int) *image.RGBA
- func Resize(img image.Image, x, y int) *image.RGBA
- func Upscale(img image.Image, factor int) *image.RGBA
- type AdjustableImage
- type ErrorDiffuser
- type ErrorDiffusionMatrix
Constants ¶
This section is empty.
Variables ¶
View Source
var FloydSteinBerg = *makeFloydSteinBerg()
FloydSteinBerg is the EDM used for FS dithering
View Source
var JarvisJudiceNinke = ErrorDiffusionMatrix{
{1, 0, 7.0 / 48.0},
{2, 0, 5.0 / 48.0},
{-2, 1, 3.0 / 48.0},
{-1, 1, 5.0 / 48.0},
{0, 1, 7.0 / 48.0},
{1, 1, 5.0 / 48.0},
{2, 1, 3.0 / 48.0},
{-2, 2, 1.0 / 48.0},
{-1, 2, 3.0 / 48.0},
{0, 2, 5.0 / 48.0},
{1, 2, 3.0 / 48.0},
{2, 2, 1.0 / 48.0},
}
JarvisJudiceNinke is the EDM used for JarvisJudiceNinke dithering
View Source
var Nothing = ErrorDiffusionMatrix{}
View Source
var Simple = *makeSimpleDiffuser()
Simple is the EDM used for simple 2d dithering
View Source
var Stucki = *makeStuckiDiffuser()
Stucki is the EDM used for Stucki dithering
Functions ¶
func ApplyErrorDiffusion ¶ added in v0.7.0
func ApplyErrorDiffusion(img AdjustableImage, palette color.Palette, diffusers *ErrorDiffusionMatrix) *image.Paletted
ApplyErrorDiffusion will apply the error diffusion dithering, with the provided slice of error spreading ErrorDiffuser elements.
Types ¶
type AdjustableImage ¶ added in v0.8.0
type AdjustableImage interface { ColorModel() color.Model Bounds() image.Rectangle RGBAAt(x, y int) color.RGBA Set(x, y int, c color.Color) }
AdjustableImage is an interface to define images that implement the .Set() function
type ErrorDiffuser ¶ added in v0.7.0
type ErrorDiffuser struct {
// contains filtered or unexported fields
}
ErrorDiffuser represents one spreaded error, with parameters x_offset, y_offset, and the fraction of the error to divide
type ErrorDiffusionMatrix ¶ added in v0.8.0
type ErrorDiffusionMatrix []ErrorDiffuser
ErrorDiffusionMatrix is the matrix that is used to spread the errors
Click to show internal directories.
Click to hide internal directories.