gnocl::pixBuf -using Gnocl to interact with off-screen drawable objects

WJG (06/02/10) In terms of implementing the core GTK+ widget set, Gnocl is pretty well complete but GTK+ as a whole, though, has much more to offer. Typical of this are the gdk graphics routines for off-screen image buffer manipulation and the graphic drawing module Cairo. Rather than charging into building the module myself, I thought perhaps the Tcl user community might be able to contribute to this one, if not in the implementation, then in the defining a specification. Here's what I have come up with so far. If you do want to add something to the functionality description please do so! Remember that Gnocl, unlike its fellow bindings such as PyGtk, is not merely a wrapper around the Gtk/Gdk library calls, but a toolkit for rapid application development where Gnocl command / option names are reflective of their related Gtk/Gdk objects and operations.

WJG (15/02/10) Read the blog pages to check out how progress is moving along... [1 ]



File and Buffer Operations

        gnocl::pixBuff info <file-name>

Returns a string in the format {w h}.

        gnocl::pixBuf new {w h d} 
                -foregroundColor {color} 
                -backgroundColor  {color}
                -baseFont  {Pango font Description}
                -name {string}
                -data {string}
        gnocl::pixBuf open <file-name> 
                -scale {w|-1 h|-1}
                -size {w h}        
        gnocl::pixBuf duplicate <buffer>
        gnocl::pixBuff stream <stream-id>  
                -scale {w|-1 h|-1}
                -cancel {boolean}
                -onError {string}
        gnocl::pixBuf drawable get <widget-name>

Returns as string containing a unique name for the buffer created based upon the arguments passed to it.

        gnocl::pixBuf types

Returns a list of file type currently supported by the pixBuf. The range of filetypes supported is not dependent upon the pixBuf code itself but upon the installed system libraries. A typical installation would support jpeg, png,ico and bmp.

Buffer Commands

        <buffer-name> save 
        <buffer-name> clear -background <clr>
        <buffer-name> info
        <buffer-name> delete
        <buffer-name> mask {buffer|file}
        <buffer-name> cget <option>
        <buffer-name> configure <option>        
        <buffer-name> put <widget-name>

Undo / Redo Operations

        <buffer-name> undo
        <buffer-name> redo


        <buffer-name> turn {clockwise|anticlockwise|upsidedown|90|180|270}
        <buffer-name> scale {factor}
        <buffer-name> hFlip
        <buffer-name> vFlip
        <buffer-name> turn {angle} 


        <buffer-name> cut -mask {buffer|file}
        <buffer-name> copy -mask {buffer|file}
        <buffer-name> paste -mask {buffer|file}


        <buffer-name> composite  {buffer|file} 
                -position {x y} 
                -scale {x t} 
                -rotation {a} 
                -mask {buffer|file}
                -alpha {double}


        <buffer-name> rectangle {x y w h} 
                -color {clr} 
                -fill {clr} 
                -penWidth {w}
        <buffer-name> circle {x y r a} 
                -color {clr} 
                -fill {clr} 
                -penWidth {w}
        <buffer-name> line {x1 y1 x2 y2} -color {clr} -penWidth {w}
        <buffer-name> polygon {x y x2 y2..} -color {clr} -penWidth {w}
        <buffer-name> text <string > -font {pango-description} -color {clr}


        <buffer-name> monochrome
        <buffer-name> colorize {bias}
        <buffer-name> invert
        <buffer-name> gamma {double}