# Computer Graphics Window

The process of selecting and viewing an image with different views, called windowing.

All the objects in the real world have a size. We can measure the size and location of an object by the unit.

For Example-We use the meter unit to measure both size and the location of the object.

When we represent the image of an object on the screen, then we use the screen coordinate system. The screen coordinate system is used to define the location of the object. When we select the screen coordinate system, then the image can be displayed on the screen.

“The Capability to show some part of an object in a window is known as windowing.”

“The rectangular area describes in the world coordinate system is called the window.”

# Viewport:

“The viewport can be defined as an area on the screen which is used to display the object.” The window is an area space for the object. Viewport surrounds the object. We need the coordinate transformation to display the object on the screen. We can define many viewports on a different area of the screen and also see the same object from a different angle in the viewport.

# Window to Viewport transformation:

“Window to viewport transformation is a process of converting two-dimensional or world into a device coordinate.”

The object inside the clipping window is mapped to the viewport. The viewport is displayed inside the interface window on the screen. We can use the clipping window to select the part of an object, and the viewport is used to display the selected part of the object on the screen or output device.

• Steps for Window to Viewport Transformation: We can follow the following steps for transform window to viewport:

Step 1: Translation of the window towards the Origin– If we shift the window towards the origin, the upper left, and the lower-left corner of the window will be negative (-). The translation factor also should be negative (-).

Step 2: Resize the window to viewport size– To Convert the size of the window into the size of the viewport, we will use the following formulas:

Sx = XVmax XVmin / XWmax — XWmin

Sy = YVmax YVmin / YWmax — YWmin

Step 3: Translation of window (Position of window and viewport must be same)– If the lower-left corner of viewport is (0, 0), then the window lower-left corner is already shifted on origin after following step 1.

If the lower-left corner is not equal to (0, 0), then the translation factor should be positive (+).