]> Dogcows Code - chaz/rasterize/blob - pixmap.h
add README for project one
[chaz/rasterize] / pixmap.h
1
2 /*
3 * CS5600 University of Utah
4 * Charles McGarvey
5 * mcgarvey@eng.utah.edu
6 */
7
8 #ifndef __PIXMAP_H__
9 #define __PIXMAP_H__
10
11 #include "color.h"
12 #include "common.h"
13 #include "tri.h"
14
15
16 /*
17 * A pixel map for storing and manipulating a 2D grid of color values.
18 */
19 typedef struct pixmap pixmap_t;
20
21
22 /*
23 * Create a new pixmap on the heap.
24 */
25 pixmap_t* pixmap_alloc(int width, int height, color_t fill);
26
27 /*
28 * Free up the memory associated with the pixmap.
29 */
30 void pixmap_destroy(pixmap_t* p);
31
32
33 /*
34 * Fill the entire pixmap with a solid color.
35 */
36 void pixmap_clear(pixmap_t* p, color_t fill);
37
38
39 /*
40 * Set the viewport rectangle. This effectively sets up a clipping rectangle
41 * where nothing is drawn outside of the rectangle. The default viewport is
42 * [0, 0, width, height], or the entire pixmap area.
43 */
44 void pixmap_viewport(pixmap_t* p, int x, int y, int width, int height);
45
46 /*
47 * Set the modelview matrix. This positions the model or camera.
48 */
49 void pixmap_modelview(pixmap_t* p, const mat_t* transform);
50
51 /*
52 * Set the projection matrix. This provides the transformation matrix for
53 * converting to screen space.
54 */
55 void pixmap_projection(pixmap_t* p, const mat_t* transform);
56
57
58 /*
59 * Save the pixmap to a PPM file.
60 */
61 int pixmap_export_ppm(const pixmap_t* p, const char* filename);
62
63 /*
64 * Save the pixmap to a BMP file.
65 */
66 int pixmap_export_bmp(const pixmap_t* p, const char* filename);
67
68
69 /*
70 * Draw a smooth gradient triangle to the pixmap.
71 */
72 void pixmap_draw_tri(pixmap_t* p, const tri_t* triangle);
73
74
75 #endif // __PIXMAP_H__
76
This page took 0.037458 seconds and 4 git commands to generate.