canvas image
Draws the canvas into a photo image.
PATHNAME image IMAGENAME ?SUBSAMPLE? ?ZOOM?
Description
Draws the items into the photo IMAGENAME, as in Tk 9. With a -scrollregion, the photo covers that region, both ends counted; else it covers the widget from 0,0. The background of the canvas fills the rest. A SUBSAMPLE keeps each Nth pixel, and a ZOOM repeats each pixel N times. The canvas draws at one pixel for each point, with no scale of the screen.
Returns
An empty string.
Examples
% canvas .ci -background #c0c0c0 -scrollregion {0 0 9 9}
> .ci create rectangle 0 0 0 9 -fill #000080 -outline #000080
> image create photo ci_shot
> .ci image ci_shot
> list [image width ci_shot] [image height ci_shot] [ci_shot get 0 0] [ci_shot get 5 5]
10 10 {0 0 128} {192 192 192}
# A subsample of 2 halves each side.
% canvas .ci2 -background #c0c0c0 -scrollregion {0 0 9 9}
> image create photo ci_small
> .ci2 image ci_small 2
> list [image width ci_small] [image height ci_small]
5 5
Errors
% canvas .ci3; .ci3 image
wrong # args: should be ".ci3 image imagename ?subsample? ?zoom?"
-errorcode NONE
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.10