SlideServe
Menu
Préférences
© SlideServe · v2026

Basic Raster Graphics Algorithms for Drawing 2D Primitives

coral avatar
23 diapositives · 845 Views · Oct 16, 2014

Basic Raster Graphics Algorithms for Drawing 2D Primitives. Prof. Lizhuang Ma Shanghai Jiao Tong University. Contents. Architecture of a Raster Display Scan Converting Lines Filling Rectangles Filling Polygons Clipping Lines Clipping Polygons Antialiasing.

Basic Raster Graphics Algorithms for Drawing 2D Primitives - slide 1
01 / 23Basic Raster Graphics Algorithms for Drawing 2D Primitives
1 / 17

Télécharger la présentation

Basic Raster Graphics Algorithms for Drawing 2D Primitives
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Basic Raster Graphics Algorithms for Drawing 2D Primitives Prof. Lizhuang Ma Shanghai Jiao Tong University

  2. Contents • Architecture of a Raster Display • Scan Converting Lines • Filling Rectangles • Filling Polygons • Clipping Lines • Clipping Polygons • Antialiasing

  3. Architecture of a Raster Display Video

  4. Definitions • Pixel: a screen consists of N x M pixels • Bilevel = monochrome, 1 bit / pixel • Color: RGB/CYK/LUV… • Bitmap / pixmap • Frame buffer: an array of data in memory mapped to screen

  5. Scan Converting Line • A scan-converted line showing intensified pixels as black circles

  6. The Basic Incremental Algorithm • A scan-converted line showing intensified pixels as black circles

  7. The Basic Incremental Algorithm void Line (intx0, inty0, intx1, inty1, value) { intx; floatdy, dx, y, m; dy=y1-y0; dx=x1-x0; m=dy/dx; y=y0; for(x=x0; x<=x1; x++) { WritePixel(x, (int)floor(y+0.5), value); y+=m; } }

  8. Midpoint Line Algorithm

  9. Midpoint Line Algorithm

  10. Midpoint Line Algorithm void MidpointLine(intx0, inty0, intx1, inty1, value) { int dx, dy, incrE, incrNE, d, x, y; dy=y1-y0;dx=x1-x0;d=dy*2-dx; incrE=dy*2;incrNE=(dy-dx)*2; x=x0;y=y0; WritePixel(x, y, value); while(x<x1) { if(d<=0) {d+=incrE;x++; } else {d+=incrNE;x++;y++; } WritePixel(x, y, value); } }

  11. Filling Rectangles for(y from yminto ymaxof the rectangle) { for(x from xminto xmax) { WritePixel(x, y, value); } }

  12. Filling Polygons

  13. Filling Polygons

  14. Filling Polygons • Find the intersections of the scan line with all edges of the polygon • Sort the intersections by increasing x coordinate • Fill in all pixels between pairs of intersections that lie interior to the polygon

  15. Special Cases Slivers Horizontal Edges

  16. Clipping Lines

  17. The Cohen-Sutherland Algorithm

  18. The Cohen-Sutherland Algorithm

  19. Clipping Polygons

  20. The Sutherland-HodgmanPolygon-Clipping Algorithm

  21. Antialiasing