All graphical objects listed in Tk Canvas Objects can be animated. The object changes colour, or their image depending on the »state« property. Possible states are: »hidden«, »normal«, »active« and »disabled«. An image object thus may display three different icons, depending on its state.
The default palette for canvas objects is shown in Figure 6.1, “The Tk Canvas Palette”. The ellipsis (...) denotes that the item starts an »insert mode«. This insert mode is terminated either by turning it off –implemented through a checkbutton with on and off logic– or by selecting another object –auto off.
Tk Canvas Objects
rect, a plain rectangle.
oval, a ellipse or circle.
arc, either a choord or pieslice.
The »style« property defines, whether arc displays a »pieslice« or a »choord«.
line, better known as poly-line. line is convertible into a open spline curve.
A line may have arrows.
polygon, a closed poly-line also featuring spline curves.
text, an elaborated multi-line text object, with insert marks and edit capabilities.
text objects can be »center«, »left« and »right« aligned. This is defined through the »justify« property.
Always synchronize »anchor« and »justify«! Also use top-alignment (n) for any multi-line text.
Synchronizing alignment and anchor keeps the text position in Scalable Vector Graphics identical to the Tcl/Tk source; even when font substitution occurs in Scalable Vector Graphics.
image, a simple raster image object.
The chosen raster image is determined by the state property. For example »activeimage« is used when the cursor hovers over the object.
»smooth« (splines) polygons and lines are not directly convertible into Scalable Vector Graphics. Scalable Vector Graphics does not support splines, were the control points fall onto curve -spiro, B-splines and clothoid splines.
The tclspline 1.0 extension provides access to the Tk canvas Splines functionality. The Scalable Vector Graphics code generation detects and uses tclspline 1.0 when it´s available.
TkPath is a close counterpart to Scalable Vector Graphics, written for Tcl/Tk.
Many objects inside of TkPath, replace the before mentioned Tk canvas objects. Jeszra generates Scalable Vector Graphics for both Tk canvas and TkPath, mixing objects from both is possible and recommended. The TkPath objects are however the first choice.
TkPath uses CAIRO under the X Window System. Hence TkPath objects are very fast, slick and anti-aliased.
Key Features
Transparency: Any TkPath object may be semi-transparent. Transparency is controlled by the »-fillopacity«, »-strokeopacity« properties and can be defined for gradients. too.
Transformations: translate, skew, zoom and rotation.
Transformations are applied through the »-matrix« property. Jeszra utilizes transformations for direct manipulation. The transformations are cumulatively applied by using tkpath::mmult. Likewise can a transformation be set from within the Inspector. The context menu, inside the hierarchy view and the design contains a couple of predefined transformations.
Every TkPath object is transformable, including »pimage«–the replacement for Tk »image«– and gradients. TkPath images are thus zoom able.
Jeszra directly supports (graphical) transformations for TkPath. Even gradient transformations are direct editable, starting with TkPath version 0.3.
The Tk canvas window features scale and move operations, these operations alter the coordinates of an graphical object. Transformations, in contrast to scale and move, do not modify the coordinates of a TkPath object.
The Tk style scale and move operations are preferred in Jeszra over transformations, for direct manipulations. Scale cannot be used for all TkPath objects. The path object for example can’t be scaled, a zoom transformation is seamlessly applied instead.
Gradients are direct modifiable within Jeszra.
Images: Transformations can be applied on each »pimage« object, making raster images zoom able.
The Palette
Path, the name-giving item of TkPath. Path is an unusual flexible graphical object. It supports points, lines, arcs, closed, open shapes, cubic and quadratic bézier segments. Every other graphical object, including ptext, can be replaced through a path object.
Polyline is the equivalent to a Tk canvas line.
The »Polyline« item contains predefined points, whereas »Polyline...« starts an insert mode, to interactively define its coordinates.
prect is the counterpart to canvas rectangle.
A prect rectangle may feature rounded corners.
»Linear LR Gradient« to »Linear TLBR Gradient«.
A collection of predefined linear gradients.
All gradients are direct editable within Jeszra.
The TkPath 0.3 palette features two new items, as shown in Figure 6.3, “Editing the TkPath 0.3 Palette”. The first new item is »tkp::canvas«, the »pathCanvas« window. »group« is the second new item.
The Extended Palette
The pathCanvas window class replaces the Tk canvas window. pathCanvas is the foundation for using TkPath objects. Starting with version 0.3 TkPath objects are no longer injected into a ordinary Tk canvas window. pathCanvas is the successor to Tk´s own canvas window and TkPath version 0.2.
»tkp« in »tkp::canvas« stands for the new TkPath namespace(tkp). That is: a pathCanvas window takes the place of a Tk canvas window whenever importing the canvas command, from the tkp namespace, in the target namespace.
Group is a container object. Groups are themselves invisible. Groups are very important for structured transformations. Different transformations cannot be combined commutative onto a single graphical object. A group shall be used in order to separate multiple transformation types and to apply additional tramsformations –through a group– on the same object.
groups do not have coordinates! The coordinates originate from the grouped objects.
As the noun group implies: a group may contain multiple objects. Any transformation applied on a group is also applied onto each contained objects.
Only objects originating from TkPath (ptext, group, polyline, path, pimage, pline, ppolygon, prect, circle, ellipse) are group-able.
Groups are displayed with their parent child dependency inside of Jeszra’s hierarchy view. Groups and their visual representation inside the hierarchy view are roughly equivalent to container windows. Likewise do Drag'n'Drop operations work for groups. Of course moving, copying and dragging groups is restricted to »pathCanvas« windows and contained groups.
TkZinc 3.3.4 is the third supported vector graphics window; again TkZinc 3.3.4 is a dedicated visualization system. TkZinc 3.3.4 contains a series of air traffic control specific objects. Such as »track«, »map«, »recticle«, »waypoint« and »tabular«. These objects are only briefly mentioned herein. Neither is Scalable Vector Graphics generated for specific air traffic objects.
The common objects are however of general interest. Quit often are TkZinc 3.3.4 objects almost identical to their Tk canvas counterparts.
Key Features
Transparency: Any colour or gradient can be
semi-transparent.
red;40
, a 60% transparent colour red.
Transformations: translate, skew, zoom and rotation. In contrast to TkPath transformations are not implemented as properties. Transformations are separately stored from an object and can be reused for another object.
Jeszra does not yet have a visual interface for storing and reapplying transformations onto other objects. Most likely this functionality is application specific in its usage. The »Shell« from the »Extra« menu provides access to this functionality.
Any object has its own viewport, which allows for fully commutative transformations. That is: multiple transformations types can be combined on a single object.
In Scalable Vector Graphics a viewport is generated through the <svg>-element . In Scalable Vector Graphics multiple transformation must be disassembled before it is possible to convert TkZinc 3.3.4 objects to Scalable Vector Graphics.
Best practice: avoid combined transformations on the same object, in order to keep the conversion into Scalable Vector Graphics simple. Use groups and apply additional transformations on the »group«.
Gradients: Four gradient types exist. Gradients are specified inside the Inspector as a series of colour definitions, preceded by the gradient type.
There is no direct manipulation possible for TkZinc 3.3.4 gradients. The Inspector alone has access to the gradient definition.
Gradients vary greatly between Scalable Vector Graphics and TkZinc 3.3.4 (OpenGL®). Radial and axial gradients are currently converted into their Scalable Vector Graphics counterparts <linearGradient> and <radialGradient>, but not every variation is supported.
Clipping: clipping can be used for every group and also for the TkZinc 3.3.4 window itself.
The »tile« property expects an raster bitmap, which is used to texture the given object.
Image pattern are included in the Scalable Vector Graphics generation. Today few Scalable Vector Graphics viewers are able to correctly display such pattern, if they are displayed at all.
Groups: With groups a hierarchy of graphical objects and transformations is possible.
Jeszra displays the child and parent group relationship inside the hierarchy view. The usual Drag'n'Drop operations work for groups as-well.
The Palette
The »zinc« window creates the TkZinc 3.3.4 drawing area. An instance of the »zinc« window is required to use any TkZinc 3.3.4 object.
Group is a container object.
Every object must be part of a group, even groups themselves. The TkZinc 3.3.4 window auto creates an initial, permanent group with ID »0«, also known as the rroot group. Only use temporal transformations on the root group, because all transformation of the root group get lost. No code will be generated for the root group.
The arc object is similar to the Tk canvas arc object. It also substitutes the Tk canvas oval.
Arc, may also resemble a rounded line. It can display individual arrows for both ends, specified through the »lastend« and »firstend« properties.
A curve is similar to the path object from TkPath, but less complex. Only straight lines and cubic bézier segments are possible for a curve object.
In addition, a open curve object may have arrows.
The icon object is used for displaying bitmaps.
Icon objects are transformable, similar to pimage from TkPath.
The rectangle object.
A multi-line text object, similar to Tk canvas text. Please follow the same anchor and justify rules as described in: SVG Text Generation Rules .
Items dedicated to air traffic control, hence omitted.