Documentation ¶
Index ¶
- Constants
- func Finalize()
- type Alignment
- type Canvas
- func (self *Canvas) AdaptiveBlur(sigma float64) error
- func (self *Canvas) AdaptiveResize(width uint, height uint) error
- func (self *Canvas) AddNoise() error
- func (self *Canvas) Annotate(text string, x, y float64)
- func (self *Canvas) AnnotateWithProperties(text string, x, y float64, prop *TextProperties)
- func (self *Canvas) AppendCanvas(source *Canvas, x int, y int) error
- func (self *Canvas) AutoOrientate() error
- func (self *Canvas) BackgroundColor() string
- func (self *Canvas) Blank(width uint, height uint) error
- func (self *Canvas) Blob() ([]byte, error)
- func (self *Canvas) Blur(sigma float64) error
- func (self *Canvas) Chop(x int, y int, width uint, height uint) error
- func (self *Canvas) Circle(radius float64)
- func (self *Canvas) Clone() *Canvas
- func (self *Canvas) Contrast(sharpen bool) error
- func (self *Canvas) Crop(x int, y int, width uint, height uint) error
- func (self *Canvas) Destroy() error
- func (self *Canvas) DrawAnnotation(content string, width, height uint) error
- func (self *Canvas) Ellipse(a float64, b float64)
- func (self *Canvas) Error() error
- func (self *Canvas) FillColor() string
- func (self *Canvas) Fit(width uint, height uint) error
- func (self *Canvas) Flip() error
- func (self *Canvas) Flop() error
- func (self *Canvas) Font() (string, float64)
- func (self *Canvas) FontFamily() string
- func (self *Canvas) FontName() string
- func (self *Canvas) FontSize() float64
- func (self *Canvas) FontWeight() uint
- func (self *Canvas) Format() string
- func (self *Canvas) GetFormat() string
- func (self *Canvas) GetImageBlob() ([]byte, error)
- func (self *Canvas) Height() uint
- func (self *Canvas) InterlaceScheme() uint
- func (self *Canvas) Line(x float64, y float64)
- func (self *Canvas) Metadata() map[string]string
- func (self *Canvas) NewTextProperties(readDefault bool) *TextProperties
- func (self *Canvas) Open(filename string) error
- func (self *Canvas) OpenBlob(blob []byte, length uint) error
- func (self *Canvas) PixelIterator(x, y int, width, height uint) *PixelIterator
- func (self *Canvas) PopDrawing() error
- func (self *Canvas) PushDrawing() error
- func (self *Canvas) Quality() uint
- func (self *Canvas) QuantumRange() uint
- func (self *Canvas) Rectangle(x float64, y float64)
- func (self *Canvas) Resize(width uint, height uint) error
- func (self *Canvas) ResizeWithFilter(width uint, height uint, filter uint, blur float32) error
- func (self *Canvas) Rotate(rad float64)
- func (self *Canvas) RotateCanvas(rad float64) error
- func (self *Canvas) Scale(x float64, y float64)
- func (self *Canvas) SetBackgroundColor(color string) error
- func (self *Canvas) SetBrightness(factor float64) error
- func (self *Canvas) SetCaption(content string) error
- func (self *Canvas) SetColor(color string) bool
- func (self *Canvas) SetContrast(factor float64) error
- func (self *Canvas) SetFillColor(color string)
- func (self *Canvas) SetFont(font string, size float64)
- func (self *Canvas) SetFontFamily(family string)
- func (self *Canvas) SetFontName(font string)
- func (self *Canvas) SetFontSize(size float64)
- func (self *Canvas) SetFontWeight(weight uint)
- func (self *Canvas) SetFormat(format string) error
- func (self *Canvas) SetGravity(gravity uint)
- func (self *Canvas) SetHue(factor float64) error
- func (self *Canvas) SetInterlaceScheme(scheme uint) error
- func (self *Canvas) SetMetadata(key string, value string) error
- func (self *Canvas) SetOption(key, value string) error
- func (self *Canvas) SetQuality(quality uint) error
- func (self *Canvas) SetSaturation(factor float64) error
- func (self *Canvas) SetSepiaTone(threshold float64) error
- func (self *Canvas) SetSize(width, height uint) error
- func (self *Canvas) SetStrokeAntialias(value bool)
- func (self *Canvas) SetStrokeColor(color string)
- func (self *Canvas) SetStrokeLineCap(value uint)
- func (self *Canvas) SetStrokeLineJoin(value uint)
- func (self *Canvas) SetStrokeOpacity(value float64)
- func (self *Canvas) SetStrokeWidth(value float64)
- func (self *Canvas) SetTextAlignment(a Alignment)
- func (self *Canvas) SetTextAntialias(b bool)
- func (self *Canvas) SetTextKerning(k float64)
- func (self *Canvas) SetTextProperties(def *TextProperties)
- func (self *Canvas) SetType(imageType uint) error
- func (self *Canvas) SharpenImage(radius float32, sigma float32, channel int) error
- func (self *Canvas) SigmoidalContrast(sharpen bool, alpha float64, beta float64) error
- func (self *Canvas) Strip() error
- func (self *Canvas) StrokeAntialias() bool
- func (self *Canvas) StrokeColor() string
- func (self *Canvas) StrokeLineCap() uint
- func (self *Canvas) StrokeLineJoin() uint
- func (self *Canvas) StrokeOpacity() float64
- func (self *Canvas) StrokeWidth() float64
- func (self *Canvas) TextAlignment() Alignment
- func (self *Canvas) TextAntialias() bool
- func (self *Canvas) TextKerning() float64
- func (self *Canvas) TextProperties() *TextProperties
- func (self *Canvas) Thumbnail(width uint, height uint) error
- func (self *Canvas) Translate(x float64, y float64)
- func (self *Canvas) Type() uint
- func (self *Canvas) Update() error
- func (self *Canvas) Width() uint
- func (self *Canvas) Write(filename string) error
- type Pixel
- type PixelIterator
- type TextProperties
Constants ¶
const ( STROKE_BUTT_CAP = uint(C.ButtCap) STROKE_ROUND_CAP = uint(C.RoundCap) STROKE_SQUARE_CAP = uint(C.SquareCap) STROKE_MITER_JOIN = uint(C.MiterJoin) STROKE_ROUND_JOIN = uint(C.RoundJoin) STROKE_BEVEL_JOIN = uint(C.BevelJoin) FILL_EVEN_ODD_RULE = uint(C.EvenOddRule) FILL_NON_ZERO_RULE = uint(C.NonZeroRule) RAD_TO_DEG = 180 / math.Pi DEG_TO_RAD = math.Pi / 180 UNDEFINED_ORIENTATION = uint(C.UndefinedOrientation) TOP_LEFT_ORIENTATION = uint(C.TopLeftOrientation) TOP_RIGHT_ORIENTATION = uint(C.TopRightOrientation) BOTTOM_RIGHT_ORIENTATION = uint(C.BottomRightOrientation) BOTTOM_LEFT_ORIENTATION = uint(C.BottomLeftOrientation) LEFT_TOP_ORIENTATION = uint(C.LeftTopOrientation) RIGHT_TOP_ORIENTATION = uint(C.RightTopOrientation) RIGHT_BOTTOM_ORIENTATION = uint(C.RightBottomOrientation) LEFT_BOTTOM_ORIENTATION = uint(C.LeftBottomOrientation) POINT_FILTER = uint(C.PointFilter) BOX_FILTER = uint(C.BoxFilter) TRIANGLE_FILTER = uint(C.TriangleFilter) HERMITE_FILTER = uint(C.HermiteFilter) HANNING_FILTER = uint(C.HanningFilter) HAMMING_FILTER = uint(C.HammingFilter) BLACKMAN_FILTER = uint(C.BlackmanFilter) GAUSSIAN_FILTER = uint(C.GaussianFilter) QUADRATIC_FILTER = uint(C.QuadraticFilter) CUBIC_FILTER = uint(C.CubicFilter) CATROM_FILTER = uint(C.CatromFilter) MITCHEL_FILTER = uint(C.MitchellFilter) BESSEL_FILTER = uint(C.BesselFilter) JINC_FILTER = uint(C.BesselFilter) SINC_FAST_FILTER = uint(C.SincFastFilter) SINC_FILTER = uint(C.SincFilter) KAISER_FILTER = uint(C.KaiserFilter) WELSH_FILTER = uint(C.WelshFilter) PARZEN_FILTER = uint(C.ParzenFilter) BOHMAN_FILTER = uint(C.BohmanFilter) BARTLETT_FILTER = uint(C.BartlettFilter) LAGRANGE_FILTER = uint(C.LagrangeFilter) LANCZOS_FILTER = uint(C.LanczosFilter) LANCZOS_SHARP_FILTER = uint(C.LanczosSharpFilter) LANCZOS2_FILTER = uint(C.Lanczos2Filter) LANCZOS2_SHARP_FILTER = uint(C.Lanczos2SharpFilter) ROBIDOUX_FILTER = uint(C.RobidouxFilter) UNDEFINED_TYPE = uint(C.UndefinedType) BILEVEL_TYPE = uint(C.BilevelType) GRAYSCALE_TYPE = uint(C.GrayscaleType) GRAYSCALE_MATTER_TYPE = uint(C.GrayscaleMatteType) PALETTE_TYPE = uint(C.PaletteType) PALETTE_MATTE_TYPE = uint(C.PaletteMatteType) TRUE_COLOR_TYPE = uint(C.TrueColorType) TRUE_COLOR_MATTE_TYPE = uint(C.TrueColorMatteType) COLOR_SEPARATION_TYPE = uint(C.ColorSeparationType) COLOR_SEPARATION_MATTE_TYPE = uint(C.ColorSeparationMatteType) OPTIMIZE_TYPE = uint(C.OptimizeType) UNDEFINED_INTERLACE = uint(C.UndefinedInterlace) NO_INTERLACE = uint(C.NoInterlace) LINE_INTERLACE = uint(C.LineInterlace) PLANE_INTERLACE = uint(C.PlaneInterlace) PARTITION_INTERLACE = uint(C.PartitionInterlace) GIF_INTERLACE = uint(C.GIFInterlace) JPEG_INTERLACE = uint(C.JPEGInterlace) PNG_INTERLACE = uint(C.PNGInterlace) UNDEFINED_GRAVITY = uint(C.UndefinedGravity) FORGET_GRAVITY = uint(C.ForgetGravity) NORTH_WEST_GRAVITY = uint(C.NorthWestGravity) NORTH_GRAVITY = uint(C.NorthGravity) NORTH_EAST_GRAVITY = uint(C.NorthEastGravity) WEST_GRAVITY = uint(C.WestGravity) CENTER_GRAVITY = uint(C.CenterGravity) EAST_GRAVITY = uint(C.EastGravity) SOUTH_WEST_GRAVITY = uint(C.SouthWestGravity) SOUTH_GRAVITY = uint(C.SouthGravity) SOUTH_EAST_GRAVITY = uint(C.SouthEastGravity) )
const ( UndefinedAlign Alignment = Alignment(C.UndefinedAlign) LeftAlign = Alignment(C.LeftAlign) CenterAlign = Alignment(C.CenterAlign) RightAlign = Alignment(C.RightAlign) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
Holds a Canvas object
func (*Canvas) AdaptiveBlur ¶
Adaptively blurs the image by blurring less intensely near the edges and more intensely far from edges.
func (*Canvas) AdaptiveResize ¶
Adaptively changes the size of the canvas, returns true on success.
func (*Canvas) Annotate ¶
Draws a string at the specified coordinates and using the current canvas Alignment.
func (*Canvas) AnnotateWithProperties ¶
func (self *Canvas) AnnotateWithProperties(text string, x, y float64, prop *TextProperties)
Draws a string at the specified coordinates and using the specified Text Properties Does not modify the canvas' default TextProperties
func (*Canvas) AppendCanvas ¶
Puts a canvas on top of the current one.
func (*Canvas) AutoOrientate ¶
Auto-orientates canvas based on its original image's EXIF metadata
func (*Canvas) BackgroundColor ¶
Returns canvas' background color.
func (*Canvas) Chop ¶
Removes a region of a canvas and collapses the canvas to occupy the removed portion.
func (*Canvas) Contrast ¶
Enhances the intensity differences between the lighter and darker elements of the image. Set sharpen to a value other than 0 to increase the image contrast otherwise the contrast is reduced.
func (*Canvas) DrawAnnotation ¶
func (*Canvas) FillColor ¶
Returns the fill color for enclosed areas on the current drawing surface.
func (*Canvas) Flip ¶
Creates a vertical mirror image by reflecting the pixels around the central x-axis.
func (*Canvas) Flop ¶
Creates a horizontal mirror image by reflecting the pixels around the central y-axis.
func (*Canvas) FontFamily ¶
Returns canvas' current font family
func (*Canvas) FontWeight ¶
Returns canvas' current font weight
func (*Canvas) GetImageBlob ¶
func (*Canvas) InterlaceScheme ¶
func (*Canvas) Line ¶
Draws a line starting on the current coordinate system origin and ending on the specified coordinates.
func (*Canvas) NewTextProperties ¶
func (self *Canvas) NewTextProperties(readDefault bool) *TextProperties
Returns a TextProperties structure. Parameters:
readDefault: if false, returns an empty structure. if true, returns a structure set with current canvas settings
func (*Canvas) PixelIterator ¶
func (self *Canvas) PixelIterator(x, y int, width, height uint) *PixelIterator
func (*Canvas) PopDrawing ¶
Destroys the current drawing surface and returns the latest surface that was pushed to the stack.
func (*Canvas) PushDrawing ¶
Clones the current drawing surface and stores it in a stack.
func (*Canvas) Quality ¶
Returns the compression quality of the canvas. Ranges from 1 (lowest) to 100 (highest).
func (*Canvas) QuantumRange ¶
func (*Canvas) ResizeWithFilter ¶
Changes the size of the canvas using specified filter and blur, returns true on success.
func (*Canvas) Rotate ¶
Applies a rotation of a given angle (in radians) on the current coordinate system.
func (*Canvas) RotateCanvas ¶
Rotates the whole canvas.
func (*Canvas) SetBackgroundColor ¶
Sets canvas' background color.
func (*Canvas) SetBrightness ¶
Adjusts the canvas's brightness given a factor (-1.0 thru 1.0)
func (*Canvas) SetCaption ¶
func (*Canvas) SetContrast ¶
func (*Canvas) SetFillColor ¶
Sets the fill color for enclosed areas on the current drawing surface.
func (*Canvas) SetFont ¶
Sets canvas' font name and size. If font is 0-length, the current font family is not changed If size is <= 0, the current font size is not changed
func (*Canvas) SetFontFamily ¶
Sets canvas' default font family
func (*Canvas) SetFontName ¶
Sets canvas' default font name
func (*Canvas) SetFontSize ¶
Sets canvas' default font size
func (*Canvas) SetFontWeight ¶
Sets canvas' default font weight
func (*Canvas) SetGravity ¶
func (*Canvas) SetInterlaceScheme ¶
func (*Canvas) SetMetadata ¶
Associates a metadata key with its value.
func (*Canvas) SetQuality ¶
Changes the compression quality of the canvas. Ranges from 1 (lowest) to 100 (highest).
func (*Canvas) SetSaturation ¶
Adjusts the canvas's saturation given a factor (-1.0 thru 1.0)
func (*Canvas) SetSepiaTone ¶
func (*Canvas) SetStrokeAntialias ¶
Sets antialiasing setting for the current drawing stroke.
func (*Canvas) SetStrokeColor ¶
Sets the stroke color on the current drawing surface.
func (*Canvas) SetStrokeLineCap ¶
Sets the type of the line cap on the current drawing surface.
func (*Canvas) SetStrokeLineJoin ¶
Sets the type of the line join on the current drawing surface.
func (*Canvas) SetStrokeOpacity ¶
Sets the opacity of the stroke on the current drawing surface.
func (*Canvas) SetStrokeWidth ¶
Sets the width of the stroke on the current drawing surface.
func (*Canvas) SetTextAlignment ¶
Sets canvas' default text alignment. Available values are: UndefinedAlign (?), LeftAlign, CenterAlign, RightAlign
func (*Canvas) SetTextAntialias ¶
Sets canvas' default text antialiasing option.
func (*Canvas) SetTextKerning ¶
Sets canvas' default text antialiasing option.
func (*Canvas) SetTextProperties ¶
func (self *Canvas) SetTextProperties(def *TextProperties)
Sets canvas' default TextProperties
func (*Canvas) SharpenImage ¶
Sharpens an image. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, the radius should be larger than sigma. Use a radius of 0 and selects a suitable radius for you. You can pass 0 as channel number - to use default channels
func (*Canvas) SigmoidalContrast ¶
Adjusts the contrast of an image with a non-linear sigmoidal contrast algorithm. Increase the contrast of the image using a sigmoidal transfer function without saturating highlights or shadows. Contrast indicates how much to increase the contrast (0 is none; 3 is typical; 20 is pushing it); mid-point indicates where midtones fall in the resultant image (0 is white; 50 is middle-gray; 100 is black). Set sharpen to true to increase the image contrast otherwise the contrast is reduced.
func (*Canvas) StrokeAntialias ¶
Returns antialiasing setting for the current drawing stroke.
func (*Canvas) StrokeColor ¶
Returns the stroke color on the current drawing surface.
func (*Canvas) StrokeLineCap ¶
Returns the type of the line cap on the current drawing surface.
func (*Canvas) StrokeLineJoin ¶
Returns the type of the line join on the current drawing surface.
func (*Canvas) StrokeOpacity ¶
Returns the opacity of the stroke on the current drawing surface.
func (*Canvas) StrokeWidth ¶
Returns the width of the stroke on the current drawing surface.
func (*Canvas) TextAlignment ¶
Returns the canvas' current text aligment
func (*Canvas) TextAntialias ¶
Returns the canvas' current text aligment
func (*Canvas) TextKerning ¶
Returns the canvas' current text aligment
func (*Canvas) TextProperties ¶
func (self *Canvas) TextProperties() *TextProperties
Gets a copy of canvas' current TextProperties
func (*Canvas) Thumbnail ¶
Converts the current image into a thumbnail of the specified width and height preserving ratio. It uses Crop() to clip the image to the specified area.
If width or height are bigger than the current image, a centered thumbnail will be produced.
Is width and height are smaller than the current image, the image will be resized and cropped, if needed.
type PixelIterator ¶
type PixelIterator struct {
// contains filtered or unexported fields
}
func (*PixelIterator) Destroy ¶
func (self *PixelIterator) Destroy()
func (*PixelIterator) Error ¶
func (self *PixelIterator) Error() error
func (*PixelIterator) NextRow ¶
func (self *PixelIterator) NextRow() (row []*Pixel)
func (*PixelIterator) Sync ¶
func (self *PixelIterator) Sync() error
type TextProperties ¶
type TextProperties struct { Font string Family string Size float64 // Stretch C.StretchType Weight uint // Style C.StyleType // Resolution [2]C.double Alignment Alignment Antialias bool // Decoration C.DecorationType // Encoding string Kerning float64 // Interline float64 // Interword float64 UnderColor *C.PixelWand }
structure containing all text properties for an annotation except the colors that are defined by FillColor and StrokeColor