Graphics Reference
In-Depth Information
Application coordinate system
Hand template in its original shape/size
x
Figure 2.16: Minute hand subjected to the display-transform sequence (1 of 3).
Application coordinate system
Hand template in its original shape/size
Application coordinate system
Hand template in i ts original shape/size
x
Scale transform
by 4.8 on both axes
Figure 2.17: Minute hand subjected to the display-transform sequence (2 of 3).
Application coordinate system
Hand template in its original shape/size
Applicati on coo rdinat e s yst em
Hand template in its original shape/size
x
Scale transform
by 4.8 on both axes
Scale tra nsf orm
by 4.8 on both axe s
Translate transform
x :
y
1
48
y :
1
48
WPF canvas coordinate system
Figure 2.18: Minute hand subjected to the display-transform sequence (3 of 3).
Thus far, it may seem that our use of a template did nothing but make the
XAML more complicated. After all, we could have simply specified a Polygon
after specifying the Ellipse . But now, as we build the hour hand—and later, when
you perform the suggested exercises—you will appreciate this template strategy.
We will now construct the hour hand via the same approach—instantiating the
template—but we are going to make two adjustments.
First, we want to adjust its shape to distinguish it from the minute hand. To
do so, we attach a scale transformation to the instance. Although we used scale
transforms earlier in this chapter, here we pursue a different goal. Whereas our
previous use of a transform sequence was to control our scene's size and place-
ment on the output device—a display transformation—here we are using scaling
to construct a component of the scene—what we call a modeling transformation.
This distinction between two uses of transformations has meaning to us as devel-
opers, but is unknown to the underlying platform since the same mechanism—
RenderTransform —is used for both. (It's a “what-for” distinction, not a “how-to”
distinction.)
Second, to make it easy to distinguish between the two clock hands when the
full scene is composed, we want to adjust the scene so that they don't both lie on
 
Search WWH ::




Custom Search