Thursday, March 25, 2010
gnocl::pixMap
This approach would leave the pixbuf module for the sole process of working with the buffer in terms of composting and input/output.
Whilst it would be nice to find some clear distinctions between graphics packages, the practicality of it isn't that simple. There are many package layers, some of whose compenent functions have counterparts elsewhere. The challenge then, lies in deciding which area of functionality is best included in which gnocl package.
Colour formatting on the Tcl Side
set color [format #%02x%02x%02x $r $g $b]
Ok, from the Gnocl view point the goal is also to allow decimal values to be passed as colours, but, of course its useful to have a Tcl way of solving the problem, especially when developing the bare bones of a new widget binding which hasn't yet had all the colour manipulation functions wired into place.
Tuesday, March 23, 2010
gnocl::curve and gnocl::gamma
Because I was feeling a little annoyed with myself after coming to a sleepy, unproductive halt over the weekend hacking away at the filters; I decided to have a look at extending the current support for the GtkCurve and GtkGamma widgets. Am I less annoyed? Not really, I’m at one of those times when the old mental agility is at a low. Got some code changes, added a few typos rather than bugs, but oh no! Keep hitting problems again. I think I’ll give Gnocl a rest for a few days, just to let the old brain recharge itself!
Sunday, March 21, 2010
New widget and pixbuf filters
Wednesday, March 17, 2010
Some more obscure Text widget commands
text-id getRect
NEW COMMANDS for gnocl::text - getIndex and lorem
set txt [gnocl::text -wrapMode word -baseFont {ILShakeFest 12} ]
$txt lorem
gnocl::window -child $txt -widthRequest 320 -heightRequest 200
$txt configure -onButtonPress {
puts "x = %x y = %y ; index = [%w getIndex %x %y]"
}
Tuesday, March 16, 2010
Save pixBufs with compression etc..
$pb2 save -fileName test3.jpg -fileType jpeg
$pb2 save -fileName test4.jpg -fileType jpeg -parameters [list quality=50]
Monday, March 15, 2010
Create pixBufs properly..
set pb1 [gnocl::pixBuf new {640 480 8 0} ]
I re-worked the buffer code the result of which alows the creation of this:
set pb1 [gnocl::pixBuf new \
-width 640 -height 480 \
-bitsPerSample 8 \
-alpha 1 \
-colorSpace RGB]
Much more Gnoclish! The former wasn’t wrong, there is only one command to create a buffer, and once set it cannot be re-configured like widgets. Ok, so now all is fine. Or is it? We now have an anachronistic info command, the one I blogged about this morning. Well, scrap that. Use cget instead! Ah, yes, its all coming together. Perhaps a bit of ‘weeding’ late this afternoon. In the garden? Nay, to the source code, I need to weed out all the unwanted bits of comments, debugging calls and redundant stuff.
NEW COMMAND: gnocl::inventory
Whilst putting a test script together I noticed that another simple function was missing, the ability to get details regarding any existing pixBuf. So, I added a pixBuf ‘info’ sub-command. This is what one gets when development is ‘evolutionary’ rather than ‘ planned’.
Here's an illustrative script sample:
for {set i 1} {$i <12} {incr i} {
gnocl::window -title "win $i"
gnocl::pixBuf new {100 100 8}
}
foreach item [gnocl::inventry widget] {
puts "$item is a [$item class]"
}
foreach item [gnocl::inventry pixBuf] {
puts "$item [$item info]"
}
Sunday, March 14, 2010
Command Deleted: gnocl::windowList
New command gnocl::widgetList
Looking at the resultant code, it looks as though a gnocl::pixBufList is a logical progression as both types of object are registered in their own hash-lists.
Builder -packing specific widgets -DONE!
There are other ways that this could be done within a script, builder created widgets should be given aliases and these can than be manipulated in the usual way. What is good here though, is the idea of creating widget instances. With the pure scripting route only one set of widgets are built. Using the builder route, multiple instances of widgets from a XML description file could be used. Keeping track of them, however, is a different matter!
Saturday, March 13, 2010
Gradient Fills and Other Pixbuf Drawing Funcs
Given it some thought and a decision made.
Loading object from a builder UI buffer
Wednesday, March 10, 2010
Applications Developer feedback coming in
Why was this left there?
After working quite intensely on Glade over the Yuletide I needed a change (hence the move onto the gnocl::pixbuf package). The point at which I left it was at this exact stage. So, the task for the next day or so is the implementation of a new set of options for the buffer load command. This will be along the lines:
Tuesday, March 09, 2010
Gradient Fills at Arbitrary Angles
A bit fiddly this one. Nested loops, checks and operations all that sort of thing! Had very little time to work on the project today, answered some group messages, did a little bit of tidying up on the website.
Monday, March 08, 2010
Gnocl on Windows -Working
Just installed all the necessary requirements to get Gnocl running on MS-Windows, and all works well. I would post a screen grab of the GnoclEditor script running but my laptop key mapping isn’t having any of it! Haven’t run the combination for long yet and so I think that are there might things to iron out but, it looks promising. This time, however, the tables are reversed for Tk/Gnocl. Gtk still retains something of its native look at the moment, whereas the Tk looks native on Windows. The fonts are larger and the Icons are the familiar Crystal icon set. Still, early days. I need to completely install a development environment on my laptop and attempt to recompile the code. After that, I’ll put the package up for adoption.
Sunday, March 07, 2010
Gradient fills
Saturday, March 06, 2010
Getting single pixel values -DONE!
Usage: pixBuf-id getPixel {x y}
Returns: RGBA
Setting single pixels values in a gnocl::pixBuf
Here's the screenshot,
Friday, March 05, 2010
PixBuf commands: saturations and pixelation
Added cget command to pixBuf objects
pixBuf-id cget [-option]
These being the options that can be queried.
-bitsPerSample
-colorSpace
-hasAlpha
-height
-nChannels
-pixels
-rowStride
-width
These correspond to the GdkPixBuf ‘ properties’ as described in the docs. A further option
-key
is taken from the library docs relating to the function that ‘get’ the values of these properties. Semantically, if there is a cget, then ought to be a configure equivalent. Also, a new buffer should also be created using the familiar syntax.
gnocl::pixBuf -width 100 -height 100 -bitsPerSample 8 -hasAlpha 1
Currently, this is initiated with:
gnocl::pixBuf new width height depth
This is clearly inconsistent with the required syntax. This needs to be recoded.Of the options, I’m still not certain in my min d what the options actually - pixels and -key do. But, I’m sure all will be clear, or at least less confusing with time.
Creating Circles and Arcs on the Gnocl Canvas
Here's a sample script that I've just puts together which does the job. Notice too, that the segments count for the arc is dependent upon the angle sweep. This could be modified to take into account the radius of the curve of the object if needed. Here's a screenshot:
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
package require Gnocl
package require GnoclCanvas
# r radius of the arc
# angle of start point
# angle of subtended by the arc # minium of step in the arc
# calculate the number of segments
set j [expr $a2 / 5]
if {$j >= $s } {set s $j}
# calculate angle increment
set delta [expr $a2 / $s]
# create coordinates for the polyline
for {set da $a1} {$da <= [expr $a1+ $a2] } {incr da $delta} {
set x2 [expr $x + cos( [rads $da] ) * $r]
set y2 [expr $y - sin( [rads $da] ) * $r]
lappend coords $x2
lappend coords $y2
}
return $coords
}
set canv [gnocl::canvas -background white]
-width 250 \
-height 250 \
-child $canv \
-title concentrics \
-onDelete exit
foreach {ang clr} {0 red 120 green 240 blue} {
for {set i 100} {$i >= 5} {incr i -5} {
# draw the line
$canv create line \
-coords [poly_arc 125 125 $i $ang 120] \
-fill $clr \
-width 1 \
-tags "concentric"
}
}
Gnocl Web Resources Gaining Support
The GSOC announcement came via the Tcl Wiki and newgroup today which was kindly forwarded by Bob, proposed Gnocl as a possible focus for some coding over the summer. There's lots to choose from. The completion of the GtkPrint bindings or some work on the Abiwidget would be my own personal choice, but then there are some many interesting packages to work with.
Didn't make any Blog posts yesterday, I was spent the extra minutes studying the GdkPixbuf docs for features to support.
One item to add to the todo list is are more options for the gnocl::canvas. Parametrically, an ellipse in a squashed circle, but interactively there are some differences. Indeed, many CAD systems have different ways of defining a circle. It might be useful to add include some of these options as new a new 'circle' command for the canvas.
Tuesday, March 02, 2010
Getting a copy of a GdkDrawable window
set win1gnocl::window -child $but1]
$but1 configure \
-onClicked {
set pb1 [gnocl::pixBuf get drawable $win1]
$pb1 save fileName.png}
-
Given this module some attention today. Added some of the more package wide options to the module and created customised handler for settin...
-
Spent some time today creating some simple howto-tutorials on creating standalone Tcl/Gnocl applications using freewrap. The process is almo...
-
Linux distros have heaps of pre-installed icons ready for use. I recently needed to create a toolbar menu which needed to access a set of un...





