Documentation
¶
Index ¶
- Constants
- Variables
- func HSLToRGB(h, s, l float64) color.RGBA
- func HSVToRGB(h, s, v float64) color.RGBA
- func OpenTo(path string) (image.Image, error)
- func RGBToHSL(c color.RGBA) (float64, float64, float64)
- func RGBToHSV(c color.RGBA) (h, s, v float64)
- func Scratch(cm color.Model, X, Y int) *pxl
- type Action
- type Adjuster
- type AdjustmentFunc
- type BlendFunc
- type BlendPosition
- type Blender
- type Canvas
- type Cloner
- type ColorModel
- type ColorStats
- type Config
- func DefaultConfig(fn ConfigFn) Config
- func NewConfig(order int, fn ConfigFn) Config
- func SetColorModel(m string) Config
- func SetFileType(k string) Config
- func SetLogger(l log.Logger) Config
- func SetMeasure(pp float64, ppu string) Config
- func SetPaletteFn(fn PaletteFunc) Config
- func SetPath(in, out string) Config
- func SetRect(x, y int) Config
- type ConfigFn
- type Configuration
- type Convoluter
- type Cropper
- type FileType
- type Histogram
- type Identity
- type ImageImage
- type Measure
- type Moint
- func (p Moint) Add(o Moint) Moint
- func (p Moint) Distance(o Moint) float64
- func (p Moint) Div(k float64) Moint
- func (p Moint) Eq(o Moint) bool
- func (p Moint) Fixed() fixed.Point26_6
- func (p Moint) IPoint() image.Point
- func (p Moint) In(r image.Rectangle) bool
- func (p Moint) Interpolate(o Moint, t float64) Moint
- func (p Moint) Mod(r image.Rectangle) Moint
- func (p Moint) Mul(k float64) Moint
- func (p Moint) String() string
- func (p Moint) Sub(o Moint) Moint
- type MointFunc
- type NoiseFunc
- type Noiser
- type Nooper
- type Operator
- type PaletteFunc
- type Paletter
- type Paster
- type Pather
- type Pix
- type Pxl
- type RGBA164
- type RGBAHistogram
- type ResampleFilter
- type ResampleFilterFunc
- type Resizer
- type Saver
- type TDir
- type Transformer
- type Translater
Constants ¶
const PATHNOOP = "PathNoop"
A default path.
Variables ¶
var ( WorkingColorModel = RGBA WorkingColorModelString = "RGBA" WorkingColorModelFn = color.RGBAModel WorkingColorModelNew = image.NewRGBA )
var ( NearestNeighbor = ResampleFilter{ "nearestneighbor", 0, nil, } Linear = ResampleFilter{ "linear", 1.0, func(x float64) float64 { x = math.Abs(x) if x < 1.0 { return 1.0 - x } return 0 }, } )
var AvailableColorModels = []ColorModel{ ALPHA, ALPHA16, CMYK, GRAY, GRAY16, NRGBA, NRGBA64, RGBA, RGBA64, }
A variable containing a listing of available and fully functional FileType.
var (
AvailablePPU []string = []string{defaultPPU, "mm", "inch"} //
)
var EmptyIntersectError = xrr.Xrror("Unable to crop empty intersect of %v and provided %v").Out
var NoBlendPositionError = xrr.Xrror("no blend position")
var NoDirectionError = xrr.Xrror("'%s' is not a direction to flip").Out
var SaveNoopError = xrr.Xrror("cannot save a non operational canvas")
var ZeroResizeError = xrr.Xrror("zero value prevents resizing\n\twidth %d\n\theight %d\n\tempty canvas: %t").Out
Functions ¶
func HSLToRGB ¶
HSLToRGB converts from HSL to RGB color model. Parameter h is the hue and its range is from 0 to 360 degrees. Parameter s is the saturation and its range is from 0.0 to 1.0. Parameter l is the lightness and its range is from 0.0 to 1.0.
func HSVToRGB ¶
HSVToRGB converts from HSV to RGB color model. Parameter h is the hue and its range is from 0 to 360 degrees. Parameter s is the saturation and its range is from 0.0 to 1.0. Parameter v is the value and its range is from 0.0 to 1.0.
func RGBToHSL ¶
RGBToHSL converts from RGB to HSL color model. Parameter c is the RGBA color and must implement the color.RGBA interface. Returned values h, s and l correspond to the hue, saturation and lightness. The hue is of range 0 to 360 and the saturation and lightness are of range 0.0 to 1.0.
Types ¶
type Action ¶
type Action int
A type indicating the action identity of the canvas: noop, new, open, clone.
type Adjuster ¶
type Adjuster interface {
Adjust(AdjustmentFunc) error
}
type ColorModel ¶
type ColorModel int
const ( COLORNOOP ColorModel = iota ALPHA ALPHA16 CMYK GRAY GRAY16 NRGBA NRGBA64 RGBA RGBA64 )
func (ColorModel) String ¶
func (c ColorModel) String() string
type ColorStats ¶
type Config ¶
func DefaultConfig ¶
func SetColorModel ¶
func SetFileType ¶
func SetMeasure ¶
func SetPaletteFn ¶
func SetPaletteFn(fn PaletteFunc) Config
type Configuration ¶
type Histogram ¶
type Histogram struct {
Bins []int
}
func (*Histogram) Cumulative ¶
Cumulative returns a new Histogram in which each bin is the cumulative value of its previous bins
func (*Histogram) Image ¶
Image returns a grayscale image representation of the Histogram. The width and height of the image will be equivalent to the number of Bins in the Histogram.
type ImageImage ¶
type ImageImage interface { ColorModel() color.Model Bounds() image.Rectangle At(x, y int) color.Color Opaque() bool PixOffset(int, int) int Set(x, y int, c color.Color) SubImage(image.Rectangle) image.Image }
The interface corresponding to the most relevant functionality of Image in the image package.
type Measure ¶
type Measure interface { PP(string) float64 SetPP(string, float64) Height() float64 Width() float64 Radius() float64 Distance(string, Moint, Moint) float64 Anchor(string) Moint SetAnchor(string, MointFunc) }
An interface of tools for examining, manipulating, and measuring a rectangle.
type Moint ¶
type Moint struct {
X, Y float64
}
A struct encompassing a 2D float64 X - Y coordinate for measurement. Functionality is paralell to image.Point, but not an interface.
func (Moint) Interpolate ¶
Interpolate other Point to provided float64.
type Nooper ¶
type Nooper interface {
Noop() bool
}
An interface for denoting a non operational Canvas.
type Operator ¶
type Operator interface { Adjuster Blender Convoluter Noiser Transformer Translater }
An interface for performing (relatively default & easy) operations on an image.
type Pxl ¶
type Pxl interface { ImageImage Measure Paletter Paster Pix }
Interface for core image data. Encapsulates image.Image plus other image package image functionality in addition to direct pixel access, paletting, pasting, and physical measurement.
type RGBA164 ¶
type RGBA164 struct {
R, G, B, A float64
}
RGBA color using the range of 0-1 in float64
type RGBAHistogram ¶
func NewRGBAHistogram ¶
func NewRGBAHistogram(img image.Image) *RGBAHistogram
NewRGBAHistogram constructs a RGBAHistogram out of the provided image. A sub-histogram is created per RGBA channel with 256 bins each.
func (*RGBAHistogram) Cumulative ¶
func (h *RGBAHistogram) Cumulative() *RGBAHistogram
Cumulative returns a new RGBAHistogram in which each bin is the cumulative value of its previous bins per channel.
func (*RGBAHistogram) Image ¶
func (h *RGBAHistogram) Image() *image.RGBA
Image returns an RGBA image representation of the RGBAHistogram. An image width of 256 represents the 256 Bins per channel and the image height of 256 represents the max normalized histogram value per channel. Each RGB channel from the histogram is mapped to its corresponding channel in the image, so that for example if the red channel is extracted from the image, it corresponds to the red channel histogram.
type ResampleFilter ¶
type ResampleFilter struct { Key string Support float64 Fn ResampleFilterFunc }
func (ResampleFilter) String ¶
func (r ResampleFilter) String() string
type ResampleFilterFunc ¶
type Resizer ¶
type Resizer interface {
Resize(w, h int, f ResampleFilter) error
}