pix 0.9: 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.
  • addCopies
    addCopies path1 path2 coordinates
    Appends one copy of another path per position to the current path. Each copy of path2 is translated by its {x y} (e.g. a marker drawn around {0 0}).
    ::pix::path
  • addPath
    addPath path1 path2
    Appends the geometry of another 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 the alpha channel of the entire image by a given factor.
    ::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.
    ::pix::path
  • ascent
    ascent typeface
    Gets 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.
    ::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 a Gaussian blur to the image.
    ::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?
    Sets the current path as the 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.
    ::pix::path
  • color
    color font color
    Sets the font color (Equivalent to pix::font::configure).
    ::pix::font
  • colorHTMLtoRGBA
    colorHTMLtoRGBA HTMLcolor
    Converts an HTML color string into an RGBA value and returns it as a Tcl list.
    ::pix
  • computeBounds
    computeBounds arrangement ?transform?
    Computes the bounding box of a text arrangement.
    ::pix::font
  • computeBounds
    computeBounds path ?transform?
    Computes the bounding box enclosing the path.
    ::pix::path
  • configure
    configure font options
    Configure font::readFont parameters.
    ::pix::font
  • configure
    configure paint options
    Configures the parameters of a paint object.
    ::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
    Creates a copy of the specified paint object.
    ::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
  • degToRad
    degToRad angle
    Converts degrees to radians.
    ::pix
  • desaturate
    desaturate color amount
    Desaturate (makes grayer) the color by amount 0-1.
    ::pix::color
  • descent
    descent typeface
    Gets the font descender value in font units.
    ::pix::font
  • destroy
    destroy value
    Destroy the ctx or all contexts if special word all is specified.
    ::pix::ctx
  • destroy
    destroy value
    Destroy the font or all fonts if special word all is specified.
    ::pix::font
  • destroy
    destroy value
    Destroy the img or all images if special word all is specified.
    ::pix::img
  • destroy
    destroy value
    Destroy the paint or all paints if special word all is specified.
    ::pix::paint
  • destroy
    destroy value
    Destroy the path or all paths if special word all is specified.
    ::pix::path
  • destroy
    destroy value
    Destroy the svg or all svgs if special word all is specified.
    ::pix::svg
  • destroyTface
    destroyTface value
    Destroy the font::readTypeface or all typefaces if special word all is specified.
    ::pix::font
  • determinantMatrix
    determinantMatrix matrix
    Computes the determinant of a 3x3 matrix.
    ::pix
  • diff
    diff masterimage image
    Compares two images and calculates their difference.
    ::pix::img
  • distance
    distance color1 color2
    A distance function based on CIEDE2000 color difference formula.
    ::pix::color
  • draw
    draw image1 image2 ?matrix3? ?blendMode?
    Draws a source image onto a destination image using an optional transformation matrix and blend mode.
    ::pix::img
  • drawCopies
    drawCopies image path coordinates fillColor strokeColor ?options?
    Draws a path at many positions: filled, then stroked, like one shape drawn after the other.
    ::pix::img
  • drawImage
    drawImage context image options
    Draws a source image onto the destination image.
    ::pix::ctx
  • drawPixSurface
    drawPixSurface object ?photo?
    Draws object to Tk photo.
    ::pix
  • drawSurface
    drawSurface object photo
    Draws object to Tk photo.
    ::pix
  • 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 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
    Searches through fallback typefaces to find one containing the specified character.
    ::pix::font
  • fill
    fill context ?path? ?windingRule?
    Fills the path with the current fillStyle.
    ::pix::ctx
  • fill
    fill image color
    Fills the entire image with a solid color or a paint pattern.
    ::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 an entire image using the gradient settings of the paint object.
    ::pix::paint
  • fillOverlaps
    fillOverlaps path coordinates windingRule ?transform?
    Checks whether a given point is inside the filled region of the 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.
    ::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
  • fromB64
    fromB64 string
    Converts a base64-encoded string or data URL into an img object.
    ::pix
  • 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
  • get
    get paint
    Gets the parameters of a paint object.
    ::pix::paint
  • 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
  • getImage
    getImage context
    Gets the image associated with the context.
    ::pix::ctx
  • getInfoStruct
    getInfoStruct 
    See ctx::get procedure.
    ::pix::ctx
  • getKerningAdjustment
    getKerningAdjustment typeface char1 char2
    Retrieve the kerning adjustment for the pair of characters (c1, c2) from the typeface.
    ::pix::font
  • getKeys
    getKeys 
    Retrieves all registered object keys from both the context and image tables.
    ::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
  • getSize
    getSize context
    Gets the size of the image associated with the context.
    ::pix::ctx
  • getSize
    getSize 
    See img::get procedure.
    ::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
    Creates and returns a new hex HTML color object.
    ::pix::color
  • hsl
    hsl h s l
    Sets a new hsl color object.
    ::pix::color
  • identityMatrix
    identityMatrix 
    Creates a 3x3 identity matrix.
    ::pix
  • 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
  • invMatrix
    invMatrix ?matrix?
    Inverts the specified 3x3 transformation matrix.
    ::pix
  • 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 logical width and height (in pixels) of the given object.
    ::pix::font
  • lighten
    lighten color amount
    Lightens the color by amount 0-1.
    ::pix::color
  • lineCap
    lineCap context enum
    Sets the style of the end caps for lines.
    ::pix::ctx
  • 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 segment to the current sub-path from the current pen position to the specified 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
  • miterLimit
    miterLimit context miterlimit
    Sets the miter limit.
    ::pix::ctx
  • 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 specified coordinate.
    ::pix::ctx
  • moveTo
    moveTo path coordinates
    Begins a new sub-path at the point {x y}.
    ::pix::path
  • mulMatrix
    mulMatrix ?args?
    Multiplies a sequence of 3x3 matrices together.
    ::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
  • nearlyEqualMatrix
    nearlyEqualMatrix matrix1 matrix2
    Checks whether two matrices are approximately equal.
    ::pix
  • new
    new size ?value?
    Creates and sets a new drawing context.
    ::pix::ctx
  • new
    new size
    Creates and returns a new image object.
    ::pix::img
  • new
    new paintKind
    Creates and returns a new paint object.
    ::pix::paint
  • new
    new 
    Creates and returns a new path object.
    ::pix::path
  • newFont
    newFont typeface
    Creates a new font object from a given TypeFace.
    ::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? ?opts?
    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
    Parses a path object and returns its SVG path string representation.
    ::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.
    ::pix::path
  • polyLine
    polyLine path coordinates
    Adds an open polyline sub-path from a list of {x y} points. The first point opens a new sub-path (moveTo), each following point is connected with a straight line (lineTo). The sub-path is NOT closed.
    ::pix::path
  • polyPath
    polyPath path coordinates
    Adds a closed polygon sub-path from a list of {x y} points. The first point opens a new sub-path (moveTo), each following point is connected with a straight line (lineTo), then the sub-path is closed.
    ::pix::path
  • quadraticCurveTo
    quadraticCurveTo context coordinates1 coordinates2
    Adds a quadratic Bézier curve to the current sub-path.
    ::pix::ctx
  • quadraticCurveTo
    quadraticCurveTo path coordinates1 coordinates2
    Adds a quadratic Bézier curve to the current sub-path.
    ::pix::path
  • readFont
    readFont filePath
    Attempts to read a font from the specified file path.
    ::pix::font
  • readImage
    readImage filePath
    Reads an image file from the disk and creates a new image object.
    ::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
    Creates and returns a new RGB color object (alpha defaults to 1.0).
    ::pix::color
  • rgba
    rgba r g b a
    Creates and returns a new RGBA color object.
    ::pix::color
  • rotate
    rotate context angle
    Applies a rotation to the transformation matrix.
    ::pix::ctx
  • rotate90
    rotate90 image
    Rotates the image 90 degrees clockwise.
    ::pix::img
  • rotMatrix
    rotMatrix angle ?matrix?
    Creates a transformation rotation matrix or multiplies an existing one.
    ::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?
    Creates a scaling matrix or multiplies an existing one.
    ::pix
  • selectionRects
    selectionRects arrangement
    Gets the selection rectangles for a text arrangement.
    ::pix::font
  • setColor
    setColor 
    See img::setPixel procedure.
    ::pix::img
  • 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 current transformation matrix.
    ::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 the font size (Equivalent to pix::font::configure).
    ::pix::font
  • spin
    spin color degrees
    Rotates the hue of the color by degrees (0-360).
    ::pix::color
  • 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 whether a given point intersects the stroked outline of the 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
    Draws a line segment from (x, y) to (x1, y1) using the current stroke style.
    ::pix::ctx
  • strokeStyle
    strokeStyle context color
    Sets the stroke style for the 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 an SVG-style path string into a path object.
    ::pix
  • textAlign
    textAlign context horizontalAlignment
    Sets text alignment.
    ::pix::ctx
  • textBaseline
    textBaseline context baselineAlignment
    Sets the text baseline alignment for the current context.
    ::pix::ctx
  • toB64
    toB64 object
    Converts an img or ctx object into a base64-encoded string.
    ::pix
  • toBinary
    toBinary object ?format?
    Converts an img or ctx object into raw binary image data.
    ::pix
  • toGrayScale
    toGrayScale img ?handleAlpha?
    Converts an image to grayscale.
    ::pix::img
  • transform
    transform context matrix3x3
    Multiplies the current transform with the matrix described by the arguments of this method.
    ::pix::ctx
  • transform
    transform path matrix3x3
    Applies an affine transformation matrix to the path.
    ::pix::path
  • transformMatrixPoint
    transformMatrixPoint point matrix
    Transforms a 2D point using a 3x3 transformation matrix.
    ::pix
  • translate
    translate context coordinates
    Adds a translation transformation to the current matrix.
    ::pix::ctx
  • transMatrix
    transMatrix trans ?matrix?
    Creates a translation matrix or multiplies an existing one.
    ::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