![]()  | 
  
    CS488 PA6
    
   | 
 
#include <Rasterizer2D.h>
Public Member Functions | |
| Rasterizer2D (FrameBuffer *fb) | |
| void | clear (const Color &color) | 
| void | drawLine (const Matrix< 2, 1 > &p, const Matrix< 2, 1 > &q, const Color &color) | 
| void | drawPoint (int x, int y, const Color &color) | 
| void | drawPoint (const Matrix< 2, 1 > &point, const Color &color) | 
| void | drawQuadrilateral (const Matrix< 2, 4 > &quad, const Color &color) | 
| void | drawTriangle (const Matrix< 2, 3 > &triangle, const Color &color) | 
| void | fillQuadrilateral (const Matrix< 2, 4 > &quad, const Color &color) | 
| void | fillTriangle (const Matrix< 2, 3 > &triangle, const Color &color) | 
| void | pointwiseFillQuadrilateral (const Matrix< 2, 4 > &quad, const Color &color) | 
| void | pointwiseFillTriangle (const Matrix< 2, 3 > &triangle, const Color &color) | 
Static Public Attributes | |
| static const int | SCAN_LINE = 0 | 
| static const int | POINTWISE = 1 | 
Private Attributes | |
| FrameBuffer * | fb | 
| int | fillTechnique | 
An encapsulation of objects that can render various 2-D shapes.
Note: Since we don't need to transform points, they are in Cartesian (rather than homogeneous) coordinates and stored in a Matrix<2, 1> (i.e., a 2-element column vector which is the same as a Vector<2>).
      
  | 
  explicit | 
Explicit Value Constructor.
| fb | A pointer to the FrameBuffer to use | 
| void Rasterizer2D::clear | ( | const Color & | color | ) | 
Fill the entire FrameBuffer with the given color.
| color | The Color to use | 
| void Rasterizer2D::drawLine | ( | const Matrix< 2, 1 > & | p, | 
| const Matrix< 2, 1 > & | q, | ||
| const Color & | color | ||
| ) | 
Draw a line using the (non-incremental) parametric approach.
| p | One end point | 
| q | The other end point | 
| color | The color to use | 
| void Rasterizer2D::drawPoint | ( | int | x, | 
| int | y, | ||
| const Color & | color | ||
| ) | 
Set the color of a single pixel.
| x | The horizontal coordinate | 
| y | The vertical coordinate | 
| color | The Color to use | 
| void Rasterizer2D::drawPoint | ( | const Matrix< 2, 1 > & | point, | 
| const Color & | color | ||
| ) | 
Set the color of a single pixel.
| point | The point | 
| color | The Color to use | 
| void Rasterizer2D::drawQuadrilateral | ( | const Matrix< 2, 4 > & | quad, | 
| const Color & | color | ||
| ) | 
Draw the edges of a quadrilateral.
| quad | The vertices of the quadrilateral | 
| color | The color to use | 
| void Rasterizer2D::drawTriangle | ( | const Matrix< 2, 3 > & | triangle, | 
| const Color & | color | ||
| ) | 
Draw the edges of a triangle.
| triangle | The vertices of the triangle | 
| color | The color to use | 
| void Rasterizer2D::fillQuadrilateral | ( | const Matrix< 2, 4 > & | quad, | 
| const Color & | color | ||
| ) | 
Fill a quadrilateral.
| quad | The vertices of the quadrilateral | 
| color | The color to use | 
| void Rasterizer2D::fillTriangle | ( | const Matrix< 2, 3 > & | triangle, | 
| const Color & | color | ||
| ) | 
Fill a triangle.
| triangle | The vertices of the triangle | 
| color | The color to use | 
| void Rasterizer2D::pointwiseFillQuadrilateral | ( | const Matrix< 2, 4 > & | quad, | 
| const Color & | color | ||
| ) | 
Fill a quadrilateral by testing all of the points in its bounding rectangle using the halfspace test.
| quad | The vertices of the quadrilateral | 
| color | The color to use | 
| void Rasterizer2D::pointwiseFillTriangle | ( | const Matrix< 2, 3 > & | triangle, | 
| const Color & | color | ||
| ) | 
Fill a triangle point-by-point in the given color using the signed-area algorithm.
| triangle | The vertices of the triangle | 
| color | The color to use | 
      
  | 
  private | 
The FrameBuffer to use.
      
  | 
  private | 
The fill alorithm to use (SCAN_LINE or POINTWISE)
      
  | 
  static | 
A constant indicating that a pointwise algorithm should be used.
      
  | 
  static | 
A constant indicating that a scan-line algorithm should be used.
 1.8.13