Paved::canvas 1.1

an extension of the canvas widget

Table Of Contents

NAME

Paved::canvas - an extension of the canvas widget

SYNOPSIS

package require Paved::canvas

Paved::canvas pathName ?options?

INTRODUCTION

Paved::canvas is an extension of the canvas widget.

A Paved-canvas is simply a canvas with an image item acting as a paved (tiled) background.

The background image is dinamically sized in order to cover all the visible canvas.

This widget can handle huge scrollregions; actually image size is 'one tile' more the canvas size, and it is automatically panned when canvas scrolls.

STANDARD OPTIONS

.. all canvas options are supported.

PAVED-SPECIFIC OPTIONS

-tile image
Specifies an image to display as background, which must have been created with the "image create" command. If image is the empty string, the background is disabled.
-tile filename
filename can be also the name of a supported graphic file ( see [ image types ] )
-bgzoom n
n is an integer value (default 1). With this option, each pixel of the source image will be expanded into a block of n x n pixels.
-tileorigin tuple
tuple is a list with two coordinates describing where the top-left corner of the 'first' tile will be placed in the canvas. Default is { 0 0 }. Each of the coordinates may be specified in any of the valid forms for the 'canvas' COORDINATES. If you have a MxN tile and you want its center be on the point (0,0) of the canvas, specify -tileorigin { M/2 N/2 } (or, equivalently {-M/2 -N/2}, by virtue of coherence properties)

WIDGET COMMANDS

.. all canvas widget commands are supported.

EXTENDED COMMANDS

pathName clean
delete all items on canvas (leaving the background-image intact). This command is obsolete; now you can safely use the delete command.

ITEM IDS AND TAGS

the embedded background image is tagged as "bgimage" (this tag is reserved).

BINDINGS

A script is attached to the <Configure> event for the pseudo class PavedCanvas, so that each time the widget is resized, the background image is resized accordling.

EXAMPLE

   package require Paved::canvas
    # suppose xyz.gif is in current directory
   image create photo xyzImage -file xyz.gif 
    # create a tiled-canvas widget; use 'xyzImage' as background.
   Paved::canvas .c -tile xyzImage
    # display it.
   pack .c -expand true -fill both

or in a more compact form:

   package require Paved::canvas
   Paved::canvas .c -tile xyz.gif
   pack .c -expand true -fill both

NOTES

A Paved-canvas is simply a canvas with an image item. This image item is automatically created and it is tagged as "bgimage"

(Within the next paragraphs, we assume that $c is the paved-canvas widget).

Few things you should always remember:

HISTORY