pix 0.7: Reference Manual

Index

  • Type the index terms you want to search for in the text input field.
  • Matching terms will be shown incrementally as you type.
  • Press Enter to navigate to the target of the first displayed index entry.
  • Alternatively, Tab to move to the index entry of interest and then press Enter to navigate to that documentation page.
  • To jump to this page from any other documentation page, press browser-specific shortcut modifiers with i. For example, on IE and Edge this would be Alt-i while on Firefox and Chrome Alt-Shift-i. Other browsers and platforms may differ.
  • addPath
    addPath path1 path2
    Adds a path to the current path.
    ::pix::path
  • almostEqual
    almostEqual color1 color2 ?epsilon?
    Almost equal colors.
    ::pix::color
  • angleToMiterLimit
    angleToMiterLimit angle
    Converts miter-limit-angle to miter-limit-ratio.
    ::pix::path
  • applyOpacity
    applyOpacity image opacity
    Multiplies alpha of the image by opacity.
    ::pix::img
  • arc
    arc context coordinates radius angleStart angleEnd ?ccw?
    Adds a circular arc to the current sub-path.
    ::pix::ctx
  • arc
    arc path coordinates radius angle0 angle1 ?ccw?
    Adds a circular arc to the current sub-path.
    ::pix::path
  • arcTo
    arcTo context coordinates1 coordinates2 radius
    Adds a circular arc using the given control points and radius.
    ::pix::ctx
  • arcTo
    arcTo path coordinates1 coordinates2 radius
    Adds a circular arc using the given control points and radius. Commonly used for making rounded corners.
    ::pix::path
  • ascent
    ascent typeface
    The font ascender value in font units.
    ::pix::font
  • beginPath
    beginPath context
    Starts a new path by emptying the list of sub-paths.
    ::pix::ctx
  • bezierCurveTo
    bezierCurveTo context coordinates1 coordinates2 coordinates3
    Adds a cubic Bézier curve to the current sub-path. It requires three points: the first two are control points and the third one is the end point. The starting point is the latest point in the current path, which can be changed using moveTo() before creating the Bézier curve.
    ::pix::ctx
  • bezierCurveTo
    bezierCurveTo path coordinates1 coordinates2 coordinates3
    Adds a cubic Bézier curve to the current sub-path.
    ::pix::path
  • blur
    blur image radius ?color?
    Applies Gaussian blur to the image given a radius.
    ::pix::img
  • capHeight
    capHeight typeface
    The font cap height value in font units (pixie >= 5.1.0).
    ::pix::font
  • ceil
    ceil image
    A value of 0 stays 0. Anything else turns into 255.
    ::pix::img
  • circle
    circle context coordinates radius
    Adds a circle to the current path.
    ::pix::ctx
  • circle
    circle path coordinates radius
    Adds a circle.
    ::pix::path
  • clearRect
    clearRect context coordinates size
    Erases the pixels in a rectangular area.
    ::pix::ctx
  • clip
    clip context ?path? ?windingRule?
    Turns the path into the current clipping region. The previous clipping region, if any, is intersected with the current or given path to create the new clipping region.
    ::pix::ctx
  • closePath
    closePath context
    Attempts to add a straight line from the current point to the start of the current sub-path. If the shape has already been closed or has only one point, this function does nothing.
    ::pix::ctx
  • closePath
    closePath path
    Attempts to add a straight line from the current point to the start of the current sub-path. If the shape has already been closed or has only one point, this function does nothing.
    ::pix::path
  • color
    color font color
    Sets font color (Same as pix::font::configure procedure).
    ::pix::font
  • colorHTMLtoRGBA
    colorHTMLtoRGBA HTMLcolor
    Converts an HTML color into an RGBA value and returns it as a Tcl list.
    ::pix
  • computeBounds
    computeBounds arrangement ?transform?
    Computes the bounds of an arrangement object.
    ::pix::font
  • computeBounds
    computeBounds path matrix
    Compute the bounds of the path.
    ::pix::path
  • configure
    configure font options
    Configure font::readFont parameters.
    ::pix::font
  • configure
    configure paint options
    Configure paint object parameters.
    ::pix::paint
  • copy
    copy font
    Copy font.
    ::pix::font
  • copy
    copy image
    This procedure creates a new image by copying the contents of the given image object.
    ::pix::img
  • copy
    copy paint
    Create a new Paint with the same properties.
    ::pix::paint
  • copy
    copy path
    Copy path.
    ::pix::path
  • darken
    darken color amount
    Darkens the color by amount 0-1.
    ::pix::color
  • defaultLineHeight
    defaultLineHeight font
    The default line height in pixels for the current font size.
    ::pix::font
  • desaturate
    desaturate color amount
    Desaturate (makes grayer) the color by amount 0-1.
    ::pix::color
  • descent
    descent typeface
    The font descender value in font units.
    ::pix::font
  • destroy
    destroy value
    Destroy current ctx or all contexts if special word all is specified.
    ::pix::ctx
  • destroy
    destroy value
    Destroy current font or all fonts if special word all is specified.
    ::pix::font
  • destroy
    destroy value
    Destroy current image or all images if special word all is specified.
    ::pix::img
  • destroy
    destroy value
    Destroy current paint or all paints if special word all is specified.
    ::pix::paint
  • destroy
    destroy value
    Destroy current path or all paths if special word all is specified.
    ::pix::path
  • destroy
    destroy value
    Destroy current svg or all svgs if special word all is specified.
    ::pix::svg
  • diff
    diff masterimage image
    Call this proc on the master image, passing the image to compare to the master image. The pix::img::diff method returns a dict with two elements.
    ::pix::img
  • distance
    distance color1 color2
    A distance function based on CIEDE2000 color difference formula.
    ::pix::color
  • draw
    draw image image2 ?matrix3? ?blendMode?
    Draws one image onto another using a matrix transform and color blending.
    ::pix::img
  • drawImage
    drawImage context image options
    Draws a source image onto the destination image.
    ::pix::ctx
  • ellipse
    ellipse context coordinates radiusx radiusy
    Adds an ellipse to the current sub-path.
    ::pix::ctx
  • ellipse
    ellipse path coordinates rx ry
    Adds a ellipse.
    ::pix::path
  • ellipticalArcTo
    ellipticalArcTo path coordinates_radius xAxisRotation largeArcFlag sweepFlag coordinates
    Adds an elliptical arc to the current sub-path, using the given radius ratios, sweep flags, and end position.
    ::pix::path
  • fallbackTypeface
    fallbackTypeface typeface char
    Looks through fallback typefaces to find one that has the glyph.
    ::pix::font
  • fill
    fill context ?path? ?windingRule?
    Fills the path with the current fillStyle.
    ::pix::ctx
  • fill
    fill image value
    Fills the image with the color.
    ::pix::img
  • fillCircle
    fillCircle context coordinates radius
    Draws a circle that is filled according to the current fillStyle
    ::pix::ctx
  • fillEllipse
    fillEllipse context coordinates radiusx radiusy
    Draws an ellipse that is filled according to the current fillStyle.
    ::pix::ctx
  • fillGradient
    fillGradient image paint
    Fills with the Paint gradient.
    ::pix::img
  • fillGradient
    fillGradient paint image
    Fills with the Paint gradient.
    ::pix::paint
  • fillOverlaps
    fillOverlaps path coordinates ?matrix? ?windingRule?
    Returns whether or not the specified point is contained in the current path.
    ::pix::path
  • fillPath
    fillPath 
    See img::fillPath procedure.
    ::pix::ctx
  • fillPath
    fillPath image pathValue paintValue ?matrix?
    Fills a path with a color or paint object.
    ::pix::img
  • fillPolygon
    fillPolygon context coordinates size sides
    Draws an n-sided regular polygon at (x, y) of size that is filled according to the current fillStyle.
    ::pix::ctx
  • fillRect
    fillRect context coordinates size
    Draws a rectangle that is filled according to the current fillStyle.
    ::pix::ctx
  • fillRoundedRect
    fillRoundedRect context coordinates size radius
    Draws a rounded rectangle that is filled according to the current fillStyle.
    ::pix::ctx
  • fillStyle
    fillStyle context value
    Fills current style.
    ::pix::ctx
  • fillText
    fillText context text coordinates
    Draws a text string at the specified coordinates, filling the string's characters with the current fillStyle.
    ::pix::ctx
  • fillText
    fillText image object ?args?
    Fills the image with the rendered text.
    ::pix::img
  • flipHorizontal
    flipHorizontal image
    This method modifies the image in place, flipping it around the Y-axis. As a result, the left and right sides of the image are swapped. This operation is useful for creating mirror images or for certain graphical effects.
    ::pix::img
  • flipVertical
    flipVertical image
    This method modifies the image in place, flipping it around the X-axis.
    ::pix::img
  • font
    font context filepath
    Sets font for current context.
    ::pix::ctx
  • fontSize
    fontSize context size
    Sets font size for current context.
    ::pix::ctx
  • get
    get context
    Retrieves detailed information about the current context and returns it as a Tcl dictionary.
    ::pix::ctx
  • get
    get image
    Gets image size.
    ::pix::img
  • getAdvance
    getAdvance typeface char
    Try to get the advance width for the given rune in pixels. If the rune is not supported by the typeface, this will raise an exception.
    ::pix::font
  • getColor
    getColor image coordinates
    Gets a color at (x, y) or returns transparent black if outside of bounds.
    ::pix::img
  • getGlyphPath
    getGlyphPath typeface char
    The glyph path for the rune.
    ::pix::font
  • getKerningAdjustment
    getKerningAdjustment typeface char1 char2
    Retrieve the kerning adjustment for the pair of characters (c1, c2) from the typeface.
    ::pix::font
  • getKeys
    getKeys 
    Get all objects from the context and the image.
    ::pix
  • getLineDash
    getLineDash context
    Gets line dash for current context.
    ::pix::ctx
  • getPixel
    getPixel image coordinates
    Gets a pixel at (x, y) or returns transparent black if outside of bounds.
    ::pix::img
  • getTransform
    getTransform context
    Gets matrix for current context.
    ::pix::ctx
  • globalAlpha
    globalAlpha context alpha
    Sets color alpha.
    ::pix::ctx
  • hasGlyph
    hasGlyph typeface char
    Guess if the glyph exists for this rune.
    ::pix::font
  • hexHTML
    hexHTML hex
    Sets a new hex html color object.
    ::pix::color
  • inside
    inside image coordinates
    Returns true if (x, y) is inside the image, false otherwise.
    ::pix::img
  • invert
    invert image
    Inverts all of the colors and alpha.
    ::pix::img
  • isOneColor
    isOneColor image
    Checks if the entire image is the same color.
    ::pix::img
  • isOpaque
    isOpaque image
    Checks if the entire image is opaque (alpha values are all 255).
    ::pix::img
  • isPointInPath
    isPointInPath context coordinates ?path? ?windingRule?
    Checks whether or not the specified point is contained in the current path.
    ::pix::ctx
  • isPointInStroke
    isPointInStroke context coordinates ?path?
    Checks whether or not the specified point is inside the area contained by the stroking of a path.
    ::pix::ctx
  • isTransparent
    isTransparent image
    Checks if this image is fully transparent or not.
    ::pix::img
  • layoutBounds
    layoutBounds object text
    Computes the width and height in pixels.
    ::pix::font
  • lighten
    lighten color amount
    Lightens the color by amount 0-1.
    ::pix::color
  • lineGap
    lineGap typeface
    Gets the font line gap value in font units.
    ::pix::font
  • lineHeight
    lineHeight typeface
    The default line height in font units.
    ::pix::font
  • lineJoin
    lineJoin context lineJoin
    Parse the string as an enum value of type LineJoin and assign it to the lineJoin property of the context.
    ::pix::ctx
  • lineTo
    lineTo context coordinates
    Adds a straight line to the current sub-path by connecting the sub-path's last point to the specified (x, y) coordinates.
    ::pix::ctx
  • lineTo
    lineTo path coordinates
    Adds a straight line to the current sub-path by connecting the sub-path's last point to the specified (x, y) coordinates.
    ::pix::path
  • lineWidth
    lineWidth context width
    Sets line width for current context.
    ::pix::ctx
  • magnifyBy2
    magnifyBy2 image ?power?
    Scales image up by 2 ^ power.
    ::pix::img
  • measureText
    measureText context text
    Information about the measured text.
    ::pix::ctx
  • minifyBy2
    minifyBy2 image ?power?
    Scales the image down by an integer scale.
    ::pix::img
  • miterLimitToAngle
    miterLimitToAngle angle
    Converts miter-limit-ratio to miter-limit-angle.
    ::pix::path
  • mix
    mix color1 color2 ?lerp?
    Mixes two colours using simple averaging or simple lerp if the “lerp” argument is specified.
    ::pix::color
  • moveTo
    moveTo context coordinates
    Begins a new sub-path at the point (x, y).
    ::pix::ctx
  • moveTo
    moveTo path coordinates
    Begins a new sub-path at the point (x, y).
    ::pix::path
  • mulMatrix
    mulMatrix ?args?
    Multiplies matrices.
    ::pix
  • name
    name name
    Sets a new name color object.
    ::pix::color
  • name
    name typeface
    This procedure retrieves the name of a given typeface object.
    ::pix::font
  • new
    new size ?value?
    Sets a new context.
    ::pix::ctx
  • new
    new size
    Sets a new image.
    ::pix::img
  • new
    new paintKind
    Sets a new paint.
    ::pix::paint
  • new
    new 
    Sets a new path.
    ::pix::path
  • newFont
    newFont typeface
    Create a new pixie.Font from the given TypeFace object.
    ::pix::font
  • newImage
    newImage svg
    Render SVG and return the image.
    ::pix::svg
  • newSpan
    newSpan font text
    Sets new Span.
    ::pix::font
  • opaqueBounds
    opaqueBounds image
    Checks the bounds of opaque pixels.
    ::pix::img
  • paint
    paint font ?paint?
    Sets font Paint if paint optional argument is set, otherwise gets the font paint.
    ::pix::font
  • parse
    parse svg ?size?
    Parse SVG XML. Defaults to the SVG's view box size.
    ::pix::svg
  • parseOtf
    parseOtf buffer
    Parse Otf string.
    ::pix::font
  • parseSvgFont
    parseSvgFont buffer
    Parse Svg Font string.
    ::pix::font
  • parseTtf
    parseTtf buffer
    Parse Ttf string.
    ::pix::font
  • pathObjToString
    pathObjToString path
    Parse path object.
    ::pix
  • polygon
    polygon context coordinates size sides
    Adds an n-sided regular polygon at (x, y) of size to the current path.
    ::pix::ctx
  • polygon
    polygon path coordinates size sides
    Adds an n-sided regular polygon at (x, y) with the parameter size. Polygons "face" north.
    ::pix::path
  • quadraticCurveTo
    quadraticCurveTo context coordinates1 coordinates2
    Adds a quadratic Bézier curve to the current sub-path. It requires two points: the first one is a control point and the second one is the end point. The starting point is the latest point in the current path, which can be changed using moveTo() before creating the quadratic Bézier curve.
    ::pix::ctx
  • quadraticCurveTo
    quadraticCurveTo path coordinates1 coordinates2
    Adds a quadratic Bézier curve to the current sub-path. It requires two points: the first one is a control point and the second one is the end point. The starting point is the latest point in the current path, which can be changed using moveTo() before creating the quadratic Bézier curve.
    ::pix::path
  • readFont
    readFont filePath
    Try to read the font from the file located at the given path.
    ::pix::font
  • readImage
    readImage filePath
    Read image file.
    ::pix::img
  • readTypeface
    readTypeface filePath
    Loads a typeface from a file.
    ::pix::font
  • readTypefaces
    readTypefaces filePath
    Loads a OpenType Collection (.ttc).
    ::pix::font
  • rect
    rect context coordinates size
    Adds a rectangle to the current path.
    ::pix::ctx
  • rect
    rect path coordinates size ?ccw?
    Adds a rectangle. Clockwise parameter can be used to subtract a rect from a path when using even-odd winding rule.
    ::pix::path
  • resetTransform
    resetTransform context
    Resets the current transform to the identity matrix.
    ::pix::ctx
  • resize
    resize image size
    Resize an image to a given height and width
    ::pix::img
  • restore
    restore context
    Restores the most recently saved context state by popping the top entry in the drawing state stack. If there is no saved state, this method does nothing.
    ::pix::ctx
  • rgb
    rgb r g b
    Sets a new rgb color object.
    ::pix::color
  • rgba
    rgba r g b a
    Sets a new rgba color object.
    ::pix::color
  • rotate
    rotate context angle
    Adds a rotation to the transformation matrix.
    ::pix::ctx
  • rotate90
    rotate90 image
    Rotates the image 90 degrees clockwise.
    ::pix::img
  • rotMatrix
    rotMatrix angle ?matrix?
    Create rotation matrix.
    ::pix
  • roundedRect
    roundedRect context coordinates size radius
    Draws a rectangle with rounded corners that is filled according to the current fillStyle.
    ::pix::ctx
  • roundedRect
    roundedRect path coordinates size radius ?ccw?
    Adds a rectangle. Clockwise parameter can be used to subtract a rect from a path when using even-odd winding rule.
    ::pix::path
  • saturate
    saturate color amount
    Saturates (makes brighter) the color by amount 0-1.
    ::pix::color
  • save
    save context
    Saves the entire state of the context by pushing the current state onto a stack.
    ::pix::ctx
  • saveLayer
    saveLayer context
    Saves the entire state of the context by pushing the current state onto a stack and allocates a new image layer for subsequent drawing. Calling restore blends the current layer image onto the prior layer or root image.
    ::pix::ctx
  • scale
    scale context coordinates
    Adds a scaling transformation to the context units horizontally and/or vertically.
    ::pix::ctx
  • scale
    scale object
    The scale factor to transform font units into pixels.
    ::pix::font
  • scaleMatrix
    scaleMatrix scale ?matrix?
    Create scale matrix.
    ::pix
  • selectionRects
    selectionRects arrangement
    Gets coordinates rectangle for font::typeset.
    ::pix::font
  • setLineDash
    setLineDash context dashes
    Sets line dash for current context.
    ::pix::ctx
  • setPixel
    setPixel image coordinates color
    Sets a pixel at (x, y) or does nothing if outside of bounds.
    ::pix::img
  • setTransform
    setTransform context matrix3x3
    Overrides the transform matrix being applied to the context.
    ::pix::ctx
  • shadow
    shadow image options
    Create a shadow of the image with the offset, spread and blur.
    ::pix::img
  • size
    size font size
    Sets font Size (Same as pix::font::configure procedure).
    ::pix::font
  • stroke
    stroke context ?path?
    Strokes (outlines) the current or given path with the current strokeStyle.
    ::pix::ctx
  • strokeCircle
    strokeCircle context coordinates radius
    Draws a circle that is stroked (outlined) according to the current strokeStyle and other context settings.
    ::pix::ctx
  • strokeEllipse
    strokeEllipse context coordinates radiusx radiusy
    Draws an ellipse that is stroked (outlined) according to the current strokeStyle and other context settings.
    ::pix::ctx
  • strokeOverlaps
    strokeOverlaps path coordinates ?options?
    Checks if a point is inside the stroking of a path.
    ::pix::path
  • strokePath
    strokePath 
    See img::strokePath procedure.
    ::pix::ctx
  • strokePath
    strokePath image value color options
    Strokes a path with a color or a paint object and optional stroke and line join options.
    ::pix::img
  • strokePolygon
    strokePolygon context coordinates size sides
    Draws an n-sided regular polygon at (x, y) of size that is stroked (outlined) according to the current strokeStyle and other context settings.
    ::pix::ctx
  • strokeRect
    strokeRect context coordinates size
    Draws a rectangle that is stroked (outlined) according to the current strokeStyle and other context settings.
    ::pix::ctx
  • strokeRoundedRect
    strokeRoundedRect context coordinates size radius
    Draws a rounded rectangle that is stroked (outlined) according to the current strokeStyle and other context settings.
    ::pix::ctx
  • strokeSegment
    strokeSegment context coordinates1 coordinates2
    Strokes a segment (draws a line from ax, ay to bx, by) according to the current strokeStyle and other context settings.
    ::pix::ctx
  • strokeStyle
    strokeStyle context color
    Sets color style current context.
    ::pix::ctx
  • strokeText
    strokeText context text coordinates
    Draws the outlines of the characters of a text string at the specified coordinates.
    ::pix::ctx
  • strokeText
    strokeText image object text options
    This procedure is responsible for rendering text onto an image with various styling options.
    ::pix::img
  • subImage
    subImage image coordinates size
    Gets a sub image from this image.
    ::pix::img
  • superImage
    superImage image coordinates size
    Either cuts a sub image or returns a super image with padded transparency.
    ::pix::img
  • svgStyleToPathObj
    svgStyleToPathObj path
    Transforms a SVG style path (string) to a path::new object.
    ::pix
  • textAlign
    textAlign context horizontalAlignment
    Sets text alignment.
    ::pix::ctx
  • textBaseline
    textBaseline context baselineAlignment
    Set the base line alignment for the current context.
    ::pix::ctx
  • toB64
    toB64 object
    Convert an img object to base 64.
    ::pix
  • toBinary
    toBinary object ?format?
    Convert an img object to binary.
    ::pix
  • transform
    transform context matrix3x3
    Multiplies the current transform with the matrix described by the arguments of this method.
    ::pix::ctx
  • transform
    transform path matrix
    Apply a matrix transform to a path.
    ::pix::path
  • translate
    translate context coordinates
    Adds a translation transformation to the current matrix.
    ::pix::ctx
  • transMatrix
    transMatrix trans ?matrix?
    Create translation matrix.
    ::pix
  • typeset
    typeset object ?options?
    Lays out the character glyphs and returns the arrangement.
    ::pix::font
  • writeFile
    writeFile context filePath
    Save context to image file.
    ::pix::ctx
  • writeFile
    writeFile image filePath
    Save image file.
    ::pix::img