Graphics Reference
In-Depth Information
Collecting WC and DC terms on either sides of the equation,
W dc
H dc =
W wc
H wc .
(10.16)
We define aspect ratio to be:
width
height .
Equation (10.16) says that to maintain proportional shapes when transforming
from WC to DC, the aspect ratio of the WC window must be the same as that of
the device drawing area.
aspect ratio
=
Tutorial 10.12. Experimenting with Aspect Ratios
Tutorial 10.12.
Project Name:
AspectRatio
Library Support:
UWB _ MFC _ Lib1
UWB _ D3D _ Lib10
Goal. Understand WC window and DC aspect ratios and verify the artifacts
when the ratios do not match.
Approach. Extend Tutorial 10.11 and allow interactive changing of UI
drawing dimension.
Figure 10.22 is a screenshot of running Tutorial 10.12. This tutorial extends Tu-
torial 10.11 by including two more slider bars at the lower right of the application
window. These two new slider bars control the device dimension of the small-
view UI drawing area, or W dc and H dc . Recall that the other four slider bars
control the small-view WC window location ( cx wc and cy wc ) and dimension ( W wc
and H wc sliders). From Equation (10.16) we understand that the image displayed
in the small view will be distorted if/when we adjust the sliders bars such that
W dc
W wc =
Figure 10.22.
Running
Tutorial 10.12.
H dc
H wc .
We note that in general these four numbers can be controlled by the following.
Our application. As the programmer of the application, we can design our
application to allow user control of these values. For example, our applica-
tion could allow the user to zoom in the world by allowing the WC window
to change size, or our application could allow the user to increase/descrease
the UI drawing area. In these cases, in order to maintain object proportions,
it is important that our application presents a coherent and meaningful user
interface. For example, we should implement zooming functionality by
providing the user with one single zoom factor.
The single zoom factor
would ensure that the ratio W dc
W wc remains constant and thus avoid the situa-
tion where WC and DC aspect ratios are different.
 
Search WWH ::




Custom Search