Scroll to navigation

canvas::gradient(3tk) Variations on a canvas canvas::gradient(3tk)


NAME

canvas::gradient - Canvas with a gradient background

SYNOPSIS

package require Tcl 8.5

package require Tk 8.5

package require canvas::gradient ?0.2?

::canvas::gradient pathName ?options?...


DESCRIPTION

This package provides a command to set background gradients on canvases.

NOTE! This package reserves the canvas tag canvas::gradient for its use.

API

::canvas::gradient pathName ?options?...
Creates a background gradient on the canvas pathName. An existing gradient is replaced by the new definition.

The set of available options is decribed below, in section Options.

OPTIONS

-direction direction
The value for this option specifies the direction of the gradient. If not specified the system defaults to x, a horizontal gradient. The package supports five directions:
x
for a horizontal gradient (default). Color changes along the x-axis, with the start color at the left.
y
for a vertical gradient. Color changes along the y-axis, with the start color at the top.
d1
for a diagonal gradient from left+top to bottom+right. Color changes along the diagonal. with the start color at left+top.
d2
for a diagonal gradient from left+bottom to top+right. Color changes along the diagonal. with the start color at left+bottom.
r
for a radial gradient around the center of the viewport Color changes from the center outward, with the start color at the center.
-color1 color
The value for this option specifies the starting color of the gradient. If not specified it defaults to red.
-color2 color
The value for this option specifies the ending color of the gradient. If not specified it defaults to green.
-type type
The value for this option specifies how the gradient is calculated. The package currently supports on ly one method, which is the default, naturally:
linear
for linear interpolation between the start and end colors (default).

EXAMPLE

	package require canvas::gradient
	canvas .c
	canvas::gradient .c -direction x -color1 yellow -color2 blue
	pack .c -fill both -expand 1

BUGS, IDEAS, FEEDBACK

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category canvas of the Tklib Trackers [http://core.tcl.tk/tklib/reportlist]. Please also report any ideas for enhancements you may have for either package and/or documentation.

KEYWORDS

background, canvas, color gradient, gradients, image, widget background

COPYRIGHT

Copyright (c) 2013 Jarek Lewandowski, MaxJarek
Copyright (c) Origin http://wiki.tcl.tk/6100
Copyright (c) Origin http://wiki.tcl.tk/37242
Copyright (c) Origin http://wiki.tcl.tk/9079
0.2 canvas