]>
Dogcows Code - chaz/rasterize/blob - pixmap.h
3 * CS5600 University of Utah
5 * mcgarvey@eng.utah.edu
17 * A pixel map for storing and manipulating a 2D grid of color values.
19 typedef struct pixmap pixmap_t
;
23 * Create a new pixmap on the heap.
25 pixmap_t
* pixmap_alloc(int width
, int height
, color_t fill
);
28 * Free up the memory associated with the pixmap.
30 void pixmap_destroy(pixmap_t
* p
);
34 * Fill the entire pixmap with a solid color.
36 void pixmap_clear(pixmap_t
* p
, color_t fill
);
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.
44 void pixmap_viewport(pixmap_t
* p
, int x
, int y
, int width
, int height
);
47 * Set the modelview matrix. This positions the model or camera.
49 void pixmap_modelview(pixmap_t
* p
, const mat_t
* transform
);
52 * Set the projection matrix. This provides the transformation matrix for
53 * converting to screen space.
55 void pixmap_projection(pixmap_t
* p
, const mat_t
* transform
);
59 * Save the pixmap to a PPM file.
61 int pixmap_export_ppm(const pixmap_t
* p
, const char* filename
);
64 * Save the pixmap to a BMP file.
66 int pixmap_export_bmp(const pixmap_t
* p
, const char* filename
);
70 * Draw a smooth gradient triangle to the pixmap.
72 void pixmap_draw_tri(pixmap_t
* p
, const tri_t
* triangle
);
75 #endif // __PIXMAP_H__
This page took 0.037458 seconds and 4 git commands to generate.