CS488 PA6
Rasterizer2D.h
1 #ifndef edu_jmu_cs_Rasterizer2D_h
2 #define edu_jmu_cs_Rasterizer2D_h
3 
4 #include "Color.h"
5 #include "FrameBuffer.h"
6 #include "Geometry.hpp"
7 #include <math.h>
8 #include "../pa5/Matrix.hpp"
9 #include "../pa5/Vector.hpp"
10 
20 class Rasterizer2D {
21  public:
25  static const int SCAN_LINE = 0;
26 
30  static const int POINTWISE = 1;
31 
37  explicit Rasterizer2D(FrameBuffer* fb);
38 
44  void clear(const Color& color);
45 
53  void drawLine(const Matrix<2, 1>& p, const Matrix<2, 1>& q,
54  const Color& color);
55 
63  void drawPoint(int x, int y, const Color& color);
64 
71  void drawPoint(const Matrix<2, 1>& point, const Color& color);
72 
79  void drawQuadrilateral(const Matrix<2, 4>& quad,
80  const Color& color);
81 
88  void drawTriangle(const Matrix<2, 3>& triangle,
89  const Color& color);
90 
97  void fillQuadrilateral(const Matrix<2, 4>& quad,
98  const Color& color);
99 
106  void fillTriangle(const Matrix<2, 3>& triangle, const Color& color);
107 
115  void pointwiseFillQuadrilateral(const Matrix<2, 4>& quad,
116  const Color& color);
117 
125  void pointwiseFillTriangle(const Matrix<2, 3>& triangle, const Color& color);
126 
127 
128  private:
133 
138 };
139 
140 #endif
Definition: FrameBuffer.h:13
void drawQuadrilateral(const Matrix< 2, 4 > &quad, const Color &color)
Definition: Rasterizer2D.cpp:86
static const int SCAN_LINE
Definition: Rasterizer2D.h:25
Definition: Rasterizer2D.h:20
void clear(const Color &color)
Definition: Rasterizer2D.cpp:13
Definition: Color.h:7
Rasterizer2D(FrameBuffer *fb)
Definition: Rasterizer2D.cpp:7
static const int POINTWISE
Definition: Rasterizer2D.h:30
void drawLine(const Matrix< 2, 1 > &p, const Matrix< 2, 1 > &q, const Color &color)
Definition: Rasterizer2D.cpp:17
void fillQuadrilateral(const Matrix< 2, 4 > &quad, const Color &color)
Definition: Rasterizer2D.cpp:102
void fillTriangle(const Matrix< 2, 3 > &triangle, const Color &color)
Definition: Rasterizer2D.cpp:108
FrameBuffer * fb
Definition: Rasterizer2D.h:132
void pointwiseFillTriangle(const Matrix< 2, 3 > &triangle, const Color &color)
Definition: Rasterizer2D.cpp:167
void pointwiseFillQuadrilateral(const Matrix< 2, 4 > &quad, const Color &color)
Definition: Rasterizer2D.cpp:114
void drawTriangle(const Matrix< 2, 3 > &triangle, const Color &color)
Definition: Rasterizer2D.cpp:94
void drawPoint(int x, int y, const Color &color)
Definition: Rasterizer2D.cpp:76
int fillTechnique
Definition: Rasterizer2D.h:137