]>
Dogcows Code - chaz/rasterize/blob - raster.hh
3 * CS5600 University of Utah
5 * mcgarvey@eng.utah.edu
16 * A pixel map for storing and manipulating a 2D grid of color values.
18 typedef struct raster raster_t
;
22 * Create a new raster on the heap.
24 raster_t
* raster_alloc(int width
, int height
, color_t fill
);
27 * Free up the memory associated with the raster.
29 void raster_destroy(raster_t
* p
);
33 * Get the color value at a particular point.
35 color_t
* raster_color(const raster_t
* p
, int x
, int y
);
38 * Get the width of the raster.
40 int raster_width(const raster_t
* p
);
43 * Get the height of the raster.
45 int raster_height(const raster_t
* p
);
48 * Get a copy of the raw RGBA pixel data of the raster. The returned
49 * buffer is indeed a copy and must be freed when no longer needed.
51 void* raster_data(const raster_t
* p
);
55 * Set the viewport rectangle. This effectively sets up a clipping rectangle
56 * where nothing is drawn outside of the rectangle. The default viewport is
57 * [0, 0, width, height], or the entire raster area.
59 void raster_viewport(raster_t
* p
, int x
, int y
, int width
, int height
);
63 * Save the raster to a PPM file.
65 int raster_export_ppm(const raster_t
* p
, const char* filename
);
68 * Save the raster to a BMP file.
70 int raster_export_bmp(const raster_t
* p
, const char* filename
);
74 * Load the raster from an image file. The file extension is used to
75 * determine which importer is actually called.
77 raster_t
* raster_import(const char* filename
);
80 * Load the raster from a PPM file.
82 raster_t
* raster_import_ppm(const char* filename
);
85 * Load the raster from a BMP file.
87 raster_t
* raster_import_bmp(const char* filename
);
91 * Fill the entire raster with a solid color and reset the raster statistics.
93 void raster_clear(raster_t
* p
, color_t fill
);
This page took 0.038922 seconds and 4 git commands to generate.