OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tk/] [doc/] [CanvTkwin.3] - Blame information for rev 1770

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
3
'\"
4
'\" See the file "license.terms" for information on usage and redistribution
5
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6
'\"
7
'\" RCS: @(#) $Id: CanvTkwin.3,v 1.1.1.1 2002-01-16 10:25:47 markom Exp $
8
'\"
9
.so man.macros
10
.TH Tk_CanvasTkwin 3 4.1 Tk "Tk Library Procedures"
11
.BS
12
.SH NAME
13
Tk_CanvasTkwin, Tk_CanvasGetCoord, Tk_CanvasDrawableCoords, Tk_CanvasSetStippleOrigin, Tk_CanvasWindowCoords, Tk_CanvasEventuallyRedraw, Tk_CanvasTagsOption \- utility procedures for canvas type managers
14
.SH SYNOPSIS
15
.nf
16
\fB#include \fR
17
.sp
18
Tk_Window
19
\fBTk_CanvasTkwin\fR(\fIcanvas\fR)
20
.sp
21
int
22
\fBTk_CanvasGetCoord\fR(\fIinterp, canvas, string, doublePtr\fR)
23
.sp
24
\fBTk_CanvasDrawableCoords\fR(\fIcanvas, x, y, drawableXPtr, drawableYPtr\fR)
25
.sp
26
\fBTk_CanvasSetStippleOrigin\fR(\fIcanvas, gc\fR)
27
.sp
28
\fBTk_CanvasWindowCoords\fR(\fIcanvas, x, y, screenXPtr, screenYPtr\fR)
29
.sp
30
\fBTk_CanvasEventuallyRedraw\fR(\fIcanvas, x1, y1, x2, y2\fR)
31
.sp
32
Tk_OptionParseProc *\fBTk_CanvasTagsParseProc\fR;
33
.sp
34
Tk_OptionPrintProc *\fBTk_CanvasTagsPrintProc\fR;
35
.SH ARGUMENTS
36
.AS Tk_ItemType *drawableXPtr
37
.AP Tk_Canvas canvas in
38
A token that identifies a canvas widget.
39
.AP Tcl_Interp *interp in/out
40
Interpreter to use for error reporting.
41
.AP char *string in
42
Textual description of a canvas coordinate.
43
.AP double *doublePtr out
44
Points to place to store a converted coordinate.
45
.AP double x in
46
An x coordinate in the space of the canvas.
47
.AP double y in
48
A y coordinate in the space of the canvas.
49
.AP short *drawableXPtr out
50
Pointer to a location in which to store an x coordinate in the space
51
of the drawable currently being used to redisplay the canvas.
52
.AP short *drawableYPtr out
53
Pointer to a location in which to store a y coordinate in the space
54
of the drawable currently being used to redisplay the canvas.
55
.AP GC gc out
56
Graphics context to modify.
57
.AP short *screenXPtr out
58
Points to a location in which to store the screen coordinate in the
59
canvas window that corresponds to \fIx\fR.
60
.AP short *screenYPtr out
61
Points to a location in which to store the screen coordinate in the
62
canvas window that corresponds to \fIy\fR.
63
.AP int x1 in
64
Left edge of the region that needs redisplay.  Only pixels at or to
65
the right of this coordinate need to be redisplayed.
66
.AP int y1 in
67
Top edge of the region that needs redisplay.  Only pixels at or below
68
this coordinate need to be redisplayed.
69
.AP int x2 in
70
Right edge of the region that needs redisplay.  Only pixels to
71
the left of this coordinate need to be redisplayed.
72
.AP int y2 in
73
Bottom edge of the region that needs redisplay.  Only pixels above
74
this coordinate need to be redisplayed.
75
.BE
76
 
77
.SH DESCRIPTION
78
.PP
79
These procedures are called by canvas type managers to perform various
80
utility functions.
81
.PP
82
\fBTk_CanvasTkwin\fR returns the Tk_Window associated with a particular
83
canvas.
84
.PP
85
\fBTk_CanvasGetCoord\fR translates a string specification of a
86
coordinate (such as \fB2p\fR or \fB1.6c\fR) into a double-precision
87
canvas coordinate.
88
If \fIstring\fR is a valid coordinate description then \fBTk_CanvasGetCoord\fR
89
stores the corresponding canvas coordinate at *\fIdoublePtr\fR
90
and returns TCL_OK.
91
Otherwise it stores an error message in \fIinterp->result\fR and
92
returns TCL_ERROR.
93
.PP
94
\fBTk_CanvasDrawableCoords\fR is called by type managers during
95
redisplay to compute where to draw things.
96
Given \fIx\fR and \fIy\fR coordinates in the space of the
97
canvas, \fBTk_CanvasDrawableCoords\fR computes the corresponding
98
pixel in the drawable that is currently being used for redisplay;
99
it returns those coordinates in *\fIdrawableXPtr\fR and *\fIdrawableYPtr\fR.
100
This procedure should not be invoked except during redisplay.
101
.PP
102
\fBTk_CanvasSetStippleOrigin\fR is also used during redisplay.
103
It sets the stipple origin in \fIgc\fR so that stipples drawn
104
with \fIgc\fR in the current offscreen pixmap will line up
105
with stipples drawn with origin (0,0) in the canvas's actual
106
window.
107
\fBTk_CanvasSetStippleOrigin\fR is needed in order to guarantee
108
that stipple patterns line up properly when the canvas is
109
redisplayed in small pieces.
110
Redisplays are carried out in double-buffered fashion where a
111
piece of the canvas is redrawn in an offscreen pixmap and then
112
copied back onto the screen.
113
In this approach the stipple origins in graphics contexts need to
114
be adjusted during each redisplay to compensate for the position
115
of the off-screen pixmap relative to the window.
116
If an item is being drawn with stipples, its type manager typically
117
calls \fBTk_CanvasSetStippleOrigin\fR just before using \fIgc\fR
118
to draw something;  after it is finished drawing, the type manager
119
calls \fBXSetTSOrigin\fR to restore the origin in \fIgc\fR back to (0,0)
120
(the restore is needed because graphics contexts are shared, so
121
they cannot be modified permanently).
122
.PP
123
\fBTk_CanvasWindowCoords\fR is similar to \fBTk_CanvasDrawableCoords\fR
124
except that it returns coordinates in the canvas's window on the
125
screen, instead of coordinates in an off-screen pixmap.
126
.PP
127
\fBTk_CanvasEventuallyRedraw\fR may be invoked by a type manager
128
to inform Tk that a portion of a canvas needs to be redrawn.
129
The \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR arguments
130
specify the region that needs to be redrawn, in canvas coordinates.
131
Type managers rarely need to invoke \fBTk_CanvasEventuallyRedraw\fR,
132
since Tk can normally figure out when an item has changed and make
133
the redisplay request on its behalf (this happens, for example
134
whenever Tk calls a \fIconfigureProc\fR or \fIscaleProc\fR).
135
The only time that a type manager needs to call
136
\fBTk_CanvasEventuallyRedraw\fR is if an item has changed on its own
137
without being invoked through one of the procedures in its Tk_ItemType;
138
this could happen, for example, in an image item if the image is
139
modified using image commands.
140
.PP
141
\fBTk_CanvasTagsParseProc\fR and \fBTk_CanvasTagsPrintProc\fR are
142
procedures that handle the \fB\-tags\fR option for canvas items.
143
The code of a canvas type manager won't call these procedures
144
directly, but will use their addresses to create a \fBTk_CustomOption\fR
145
structure for the \fB\-tags\fR option.   The code typically looks
146
like this:
147
.CS
148
static Tk_CustomOption tagsOption = {Tk_CanvasTagsParseProc,
149
        Tk_CanvasTagsPrintProc, (ClientData) NULL
150
};
151
 
152
static Tk_ConfigSpec configSpecs[] = {
153
        ...
154
        {TK_CONFIG_CUSTOM, "\-tags", (char *) NULL, (char *) NULL,
155
                (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
156
        ...
157
};
158
.CE
159
 
160
.SH KEYWORDS
161
canvas, focus, item type, redisplay, selection, type manager

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.