The DejaVU Framework -- hush 3.1
[.] Papers Tutorials Examples Manuals Interfaces Sources Packages Resources ?

Manual: CANVAS 5 1996


[.] [man] man1 man2 man3 man4 man5 man6 man7 man8 man9 manl mann ?

NAME

canvas - to create a canvas widget

SYNOPSIS


The canvas class is by far the most general (and powerful) widget class, since it allows you to depict (almost) anything. Apart from the two standard constructors, it offers the functions tag, tags and move that merely repeat the functions offered by the item class, except that move may also be given a tag to identify the items to be moved.


slide: SYNOPSIS

INTERFACE


  interface canvas: widget {                  
<widgets/canvas.h>

<widgets/canvas.idl>

sources/java/hush.dv.widgets.canvas

canvas(); canvas(const char *p, const char* options = ""); canvas(const widget* w, const char *p, const char* options = ""); virtual ~canvas() {} void region(int x1, int y1, int x2, int y2 ); enum { window_coords, canvas_coords }; // window_coords is default void coordsystem(int); int coordsystem() const; int canvasx(int screenx) const; int canvasy(int screeny) const; void tag(int id, const char* tag); char* tags(int id); char* coords(int id) const; // returns all coords of item id char* coords(char* tag) const; // idem for all items with tag char* bbox(int id) const; // returns bounding box of item id char* bbox(char* tag) const; // idem for all items with tag void del(int id); void del(const char* id); void move(int id, int x, int y); void move(const char* id, int x, int y); item* bitmap(int x1, int y1, const char* bitmap, const char* options=""); void image(const char*) { } // to silence the compiler item* image(int x1, int y1, const char* bitmap, const char* options=""); item* photo(int x1, int y1, int x2, int y2, const char* options =""); void readppm(int id, const char* file =""); item* line(int x1, int y1, int x2, int y2, const char* options =""); item* line(const char* linespec, const char* options =""); item* arc(int x1, int y1, int x2, int y2, const char* options =""); item* oval(int x1, int y1, int x2, int y2, const char* options =""); item* circle(int x1, int y1, int r, const char* options =""); item* polygon(const char* linespec, const char* options =""); item* rectangle(int x1, int y1, int x2, int y2, const char* options =""); item* text(int x1, int y1, const char* txt, const char* options=""); item* window(int x1, int y1, const char* win, const char* options=""); item* window(int x1, int y1, widget* win, const char* options=""); void raise(const char* tag, const char* abovethis=""); void lower(const char* tag, const char* belowthis="");
item* methods

item* current(); item* overlapping(int x, int y, const char* options); // returns 1st item item* overlapping(int x, int y); // returns 1st item char* items(int x, int y); char* items(int x1, int y1, int x2, int y2); // like overlapping void itemconfigure(int it, const char* options); void itemconfigure(const char* tag, const char* options); virtual itembind(int i, const char* s, dvbinding* a, const char* args = "" ); virtual itembind(const char *i, const char* s, dvbinding* a, const char* args = "" ); void fontmap(const char *xfont, const char *printerfont, int ptsize); void postscript(const char* file, const char* options=""); void install(dvbinding* ac, const char* args = ""); }; #endif };

slide: INTERFACE

OPTIONS


  -closeenough <float>
  -confine <true|false>
  -height <coord>
  -scrollincrement <coord>
  -scrollregion <coord>
  -width <coord>
  

slide: OPTIONS

DESCRIPTION


Currently, the graphic items bitmap, line, oval, polygon and rectangle may created and, in addition, text items and window items consisting of a widget. The function overlapping may be used to retrieve the item overlapping a particular position. In addition, the canvas class auxiliary functions needed to support the functionality provided by the item class. The canvas may be written as Postscript to a file with the function canvas::postscript.


slide: DESCRIPTION

USAGE


Consult the Tcl/Tk canvas(n) manpage for a detailed description of the graphical items and how they are manipulated.


slide: USAGE

COORDINATES


You can switch between two coordinate systems by calling canvas::coordsystem(window_coords) or canvas::coordsystem(canvas_coords). The window coordinate system's origin is at the upper left corner of the visible part of the canvas. As a result this origin moves when you scroll the canvas. In contrast, the canvas coordinate system's origin is always at the upper left corner of the canvas. Note that coordinates of window events use the window coordinate system which is therefore the default. You can convert a window coordinate to a canvas coordinate by calling canvasx or canvasy.


slide: COORDINATES

EXAMPLES


See examples:widgets/canvas.c and examples:graphics/items.c


slide: EXAMPLES

LIBRARY


widget - file <widgets/canvas.h>


slide: LIBRARY

KEYWORDS

widget(4), item(4)

SEE ALSO

canvas(n)
[.] Papers Tutorials Examples Manuals Interfaces Sources Packages Resources ?
Hush Online Technology
hush@cs.vu.nl
09/24/99