Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graphics Output Primitives Pixel Addressing and Fill Area Dr. M. Al-Mulhem Feb. 1, 2008.

Similar presentations


Presentation on theme: "Graphics Output Primitives Pixel Addressing and Fill Area Dr. M. Al-Mulhem Feb. 1, 2008."— Presentation transcript:

1 Graphics Output Primitives Pixel Addressing and Fill Area Dr. M. Al-Mulhem Feb. 1, 2008

2 Pixel Addressing and Object Geometry To preserve the specified geometry of world objects, we need to compensate for the mapping of mathematical input points to finite pixel area, we use one of the two ways: 1.Adjust the dimensions of displayed objects to account for the amount of overlap of pixel areas with the object boundaries. 2.Map world coordinates onto screen positions between pixels, so that we align objects boundaries with pixel boundaries instead of pixel centers (Grid coordinates).

3 Pixel Addressing and Object Geometry Grid Coordinates: The Figure shows grid lines marking pixel boundaries, one unit apart. A screen position is given as the pair of integer values identifying a grid intersection position between two pixels.

4 Pixel Addressing and Object Geometry The address for any pixel is now at its lower-left corner, as illustrated in the Figure.

5 Pixel Addressing and Object Geometry Using screen grid coordinates, we now identify the area occupied by a pixel with screen coordinates (x, y) as the unit square with diagonally opposite corners at (x, y) and (x + 1, y + 1).

6 Pixel Addressing and Object Geometry A straight line path is now envisioned as between grid intersections For example, the mathematical line path for a polyline with screen endpoints (0, 0), (5, 2), and (1,4) is shown beside.

7 Pixel Addressing and Object Geometry Notes: 1.The previous algorithms for drawing line, circle, …etc are still valid when applied to input positions expressed as screen grid coordinates. 2.The decision parameter P k is a measure of screen grid separation differences rather than separation differences from pixel centers.

8 Maintaining Geometric Properties of Displayed Objects Conversion of geometric descriptions of objects into pixel representations means transforming mathematical points and lines into finite screen areas. To maintain the original geometric measurements specified by the input coordinates for an object, we need to account for the finite size of pixels when we transform the object definition to screen display.

9 Maintaining Geometric Properties of Displayed Objects The following example shows the line plotted in the Bresenham line algorithm example. Interpreting the line endpoints ( 20, 10) and ( 30, 18) as precise grid crossing positions, we see that the line should not extend past screen grid position (30,18). If we were to plot the pixel with screen coordinates (30, 18), we plot 11 horizontal units and 9 vertical units, where Δx= 10, and Δy = 8.

10 Maintaining Geometric Properties of Displayed Objects With screen coordinates as addressing pixel boundaries (Grid coordinates), we plot a line using only those pixels that are interior to the line path, i.e. only those pixels that are between line endpoints (20, 10) & (29, 17) For an enclosed area input geometric properties are maintained by displaying the area only with these pixels that are interior to the object boundaries

11 Maintaining Geometric Properties of Displayed Objects

12 The rectangle defined with the screen coordinate vertices for border shown in the next slide, for example, is larger when we display it filled with pixels up to and including the border pixel lines joining the specified vertices. As defined, the area of the rectangle is 12 units, but as displayed it has an area of 20 units in figure (b), it has an area of 12 units in figure (c)

13 Maintaining Geometric Properties of Displayed Objects

14 The original rectangle measurements are maintained by displaying only internal pixels. The right boundary of the input rectangle is at x = 4. To maintain this boundary in the display, we set the rightmost pixel grid coordinate at x=3. Similarly the mathematical top boundary of the rectangle is at y = 3, so we set the top pixel row for the displayed rectangle at y = 2.

15 Maintaining Geometric Properties of Displayed Objects These compensations for finite pixel width along object boundaries can be applied to other polygons and to curved figures so that the raster display maintains the input object specifications. A circle of radius 5 and center position (10, 10), for instance, would be displayed as shown in Figure 3-38 by the midpoint circle algorithm using pixel centers as screen coordinate positions. But the plotted circle has a diameter of 11. To plot the circle with the defined diameter of 10, we can modify the circle algorithm to shorten each pixel scan line and each pixel column, as shown in the Figure 3-39.

16 Maintaining Geometric Properties of Displayed Objects Figure 3-38

17 Maintaining Geometric Properties of Displayed Objects Figure 3-39


Download ppt "Graphics Output Primitives Pixel Addressing and Fill Area Dr. M. Al-Mulhem Feb. 1, 2008."

Similar presentations


Ads by Google