Documentation‎ > ‎Pixbuf and Images‎ > ‎

    gnocl::pixBuf

    Load images into offscreen buffers and manipulate their contents.

    Synopsis

    gnocl::pixBuf [subcommand] [-option value...]

    Subcommands

    gnocl::pixBuf description imageType

    Type: String

    Returns a brief description of the specfied image type. An empty string will be returned if the image type is not supported by the current installation.

    gnocl::pixBuf license imageType

    Type: String

    Returns a brief description of the licence under whose terms the specified imagetType is released.

    gnocl::pixBuf licence imageType

    Synonym for license for the purposed of internationalization.

    gnocl::pixBuf extensions imageType

    Type: String

    Returns a list of the file type extensions recognised by the current system installation for the specified imageType.

    gnocl::pixBuf scalable imageType

    Type: String

    Returns 1 if the specified imageType is scalable (eg svg) otherwise 0 for pixel based images.

    gnocl::pixBuf writable imageType

    Type: String

    Return 1 if the current system installation can support the writing to disk of the specified image type.

    gnocl::pixBuf fileInfo [file-name]

    Type: String

    After parsing the file, this command returns a list containing the details of the width, height and format of the specified file.

    gnocl::pixBuf new [options]

    Options

    -width int  (default = 640)

    Width of the buffer in pixels.

     -height int  (default = 480)

    Height of the buffer in pixels. 

    -bitsPerSample int  (default = 8)

    Colour depth of the buffer. 

    -colorSpace string  (default = "RGB")

    Currently only RGB options supported.

    -nChannels string  (default = 3)

    Number of channels.

     -alpha boolean  (default = 0)

    Whether or not to include an alpha channel.

    -name string  (default = "")

    Name of the widget, can be used to set options in an rc file. 

    -data string  (default = "")

    User defined data which can be retrieved via the cget subcommand.

    gnocl::pixBuf load [options]

    Load and scale an image based upon specified options with optional preservation of the image aspect ratio.

    -file [string]

    -width [int]

    -height [int]

    -aspectRatio [int]

    The image will be scaled to fit in the requested size, optionally preserving the image's aspect ratio.

    The Gdk says the following on the loading of images: 

    "When preserving the aspect ratio, a width of -1 will cause the image to be scaled to the exact given height, and a height of -1 will cause the image to be scaled to the exact given width. When not preserving aspect ratio, a width or height of -1 means to not scale the image at all in that dimension. Negative values for width and height are allowed since 2.8."

    gnocl::pixBuf get drawable [widget-id]

    Type: String

    Creates  a copy of the region of the screen associated widget-id, returns a string containing the name of the created pixBuf.

    NOTE:  The call will only succeed if widget-id is rendered and displayed to screen.

    Commands

    copy {x y width height}

    Returns a new pixBuf object corresponding the specified region of the specified pixBuf. The list of arguments pass indicate a region beginning at co-ordinates x,y of size width and height is to be obtained. Use the object command duplicate to obtain a copy of the entire buffer.

    delete

    Description -yet to be documented.

    duplicate

    Return an exact copy of the current pixbuf. [STILL UNDER DEVELOPMENT]


    configure

    Description -yet to be documented.


    cget

    Description -yet to be documented.

    getPixel {x y}

    Return colour value of pixel at specified location.

    setPixel {x y} color

    Set buffer to specified colour at position x, y.

    info

    Returns a list containing information regarding the calling buffer in the following format:

    int width  in pixels

    int height  in pixels    

    boolean alpha whether or not the buffer has an alpha channel

    int bps the number of bits per sample

    int nchannels the number of colour channels

    class

    Returns the class of this object, i.e. pixbuf.

    composite <source-buffer-id>[options]

    Composite the contents of the pixBuf  specified by <source-buffer-id>. The default action is the same as a simple copy operateion. Various graphics effects can be achieved by using the following options.

    Options
    -destX int [default: 0]
    -destY int [default: 0]
    -destWidth int [default: 0]
    -destHeight int [default: 0]
    -offsetX int [default: 0]
    -offsetY int [default: 0]
    -scaleX int [default: 1]
    -scaleY int [default: 1]
    -interpType int [default: 0]
    -alpha int [default: 255]

    fill color

      Clears a pixbuf to the given RGBA value. The alpha will be ignored if the pixbuf  does not have an alpha channel.


    save [options]

    Save the contents of the specified widget to the named file.

    -fileName [string]

    -fileType [int]

    -parameters [int]


    turn

    Description -yet to be documented.


    flip

    Description -yet to be documented.


    resize 
    [options]

    Returns a resized copy of the pixbuf based upon the value of passed arguments. If the -height or -width alone are specified then the unspecified dimension will be calculated based upon the aspect ratio of the pixbuf. If both values are specidied, then the aspect ratio of the pixbuf will be ignored and a copy at the specified dimensions returned. If no options are set, then a duplicate of the pixbuf will be retuned.

    Options:

    -height [int]

    Width of the returned bixbuf in pixels.

    -width [int]

    Width of the returned bixbuf in pixels.

    parameters [int]

    rotate angle

    Type: Double

    Returns name of a new buffer corresponding to the pixBuf-id rotated an arbitrary number of degrees. The alpha map of pixBuf-id will also be copied to the new buffer. The height and width of the new buffer will be automatically adjusted to accomodate changes occuring throught the rotation process.

    Options

    -aColor int [default: 0]

    NOTE: The effect of this switch is yet to be documented.

    scale factor [default: 1.0]

    Returns a resized copy of the pixbuf based upon the value of passed arguments. If the -height or -width alone are specified then the unspecified dimension will be calculated based upon the aspect ratio of the pixbuf. If both values are specidied, then the aspect ratio of the pixbuf will be ignored and a copy at the specified dimensions returned. If no options are set, then a duplicate of the pixbuf will be retuned.

    Options:

    -height [double]

    Scale factor of the height of the returned pixbuf.

    -width [double]

    Scale factor of the width of the returned pixbuf.

    Sections