Window and viewport relationship

Windows and Viewports

window and viewport relationship

Meaning: Total size of the browser window, including scrollbars. Measured in: CSS pixels; Browser errors: Not supported by IE. window. The window defines a rectangular area in the world coordinates. As well as window can be defined with the GWINDOW statement. Module III Window to viewport transformation Total Slide Ankit Garg Assistant Professor Amity University, Haryana.

window and viewport relationship

Use the following statements to draw the graph, shown in Figure Stock Data In this example, you perform several steps that you did not do with the previous graph: Understanding Viewports A viewport specifies a rectangular area on the display device where the graph appears. Note that both x and y must range between 0 and As with the GWINDOW specification, you can give the coordinates either as a matrix literal enclosed in braces or as the name of a numeric matrix containing the coordinates.

If you do not define a viewport, the default is to span the entire display device.

window and viewport relationship

In summary, a viewport specifies where the image appears on the display is a rectangular area is specified by an array of four numbers is defined in normalized coordinates scales the data relative to the shape of the viewport To display the stock price data in a smaller area on the display device, you must define a viewport.

While you are at it, add some text to the graph. The following statements create the graph shown in Figure Stock Data with Axes and Labels The statements that generated this graph are described below: GPOLY draws a box around the display area.

GPORT defines a viewport. It causes the graph to appear in the center of the display, with a border around it for text. The lower left corner has coordinates 15,15 and the upper right corner has coordinates 85, This saves you from having to plot points you have already created.

2D Window To Viewport Tranformation

It begins at the point 70, and is 17 units years long, divided with 18 tick marks. The axis tick marks are printed with the numeric 2. It also begins at 70, but is units dollars long, divided with 11 tick marks. GSET sets the text font to be Swiss and the height of the letters to be 2. The height of the characters has been increased because the viewport definition scales character sizes relative to the viewport.

A tale of two viewports — part one

GTEXT prints horizontal text. It prints the text string Year beginning at the world coordinate point 77, It prints the text string Price beginning at the world coordinate point 68, GSHOW displays the graph. Changing Windows and Viewports Windows and viewports can be changed for the graphics segment any time that the segment is active.

Using the stock price example, you can first define a window for the data during the years to and map this to the viewport defined on the upper half of the normalized device; then you can redefine the window to enclose the data for to and map this to an area in the lower half of the normalized device.

Notice how the shape of the viewport affects the shape of the curve. Changing the viewport can affect the height of any printed characters as well. The following statements generate the graph in Figure You can define the window to be larger than, the same size as, or smaller than the actual range of data values, depending on whether you want to show all of the data or only part of the data.

2D Window to Viewport Transformation

An area on a display device to which a window is mapped is called a viewport. A viewport is a polygon viewing region in computer graphics. The viewport is an area expressed in rendering-device-specific coordinates, e. A viewport defines in normalized coordinates a rectangular area on the display device where the image of the data appears.

You can have your graph take up the entire display device or show it in only a portion, say the upper-right part.

What is VIEWPORT? What does VIEWPORT mean? VIEWPORT meaning, definition & explanation

Window to viewport transformation: Window-to-Viewport transformation is the process of transforming a two-dimensional, world-coordinate scene to device coordinates. In particular, objects inside the world or clipping window are mapped to the viewport.

The viewport is displayed in the interface window on the screen. In other words, the clipping window is used to select the part of the scene that is to be displayed.

The viewport then positions the scene on the output device.