Java Reference
In-Depth Information
The first of these effects, PerspectiveTransform , gives us a mechanism to ren-
der an artificial 3D effect to content that is otherwise two-dimensional. It is
accomplished by mapping the original content to an arbitrary four-sided polygon
to provide perspective. The instance variables that must be defined represent the
( x , y ) coordinates of the new polygon, namely the upper-left ( ulx , uly ), upper-
right ( urx , ury ), lower-left ( llx , lly ), and lower-right ( lrx , lry ) corners. Let's
begin with an image as shown in Figure 6.22.
Figure 6.22
Base Image Before PerspectiveTransform
Let's apply a PerspectiveTransform on it, using this code:
ImageView {
image: Image {
url: "{__DIR__}liberty.jpg"
}
effect: PerspectiveTransform {
ulx: 10 uly: 50
urx: 200 ury: 10
llx: 10 lly: 100
lrx: 200 lry: 160
}
}
The resulting image is transformed into the output displayed by Figure 6.23.
Figure 6.23
Base Image After PerspectiveTransform Has Been Applied
Search WWH ::




Custom Search