40 #ifndef H_OGF_IMAGE_IO_IMAGE_RASTERIZER_H
41 #define H_OGF_IMAGE_IO_IMAGE_RASTERIZER_H
128 segment(transform(p1), transform(p2), c);
154 int(radius*
double(image_->width())),
177 switch(component_encoding_) {
183 for(
index_t comp=0; comp<nb_components_; ++comp) {
187 case Image::FLOAT32: {
192 for(
index_t comp=0; comp<nb_components_; ++comp) {
196 case Image::FLOAT64: {
201 for(
index_t comp=0; comp<nb_components_; ++comp) {
224 for(
size_t c=0; c<image_->components_per_pixel(); ++c) {
225 result = result && (*p == 0);
252 double l1,
double l2,
double l3,
255 c[0] = l1*c1[0] + l2*c2[0] + l3*c3[0];
256 c[1] = l1*c1[1] + l2*c2[1] + l3*c3[1];
257 c[2] = l1*c1[2] + l2*c2[2] + l3*c3[2];
258 c[3] = l1*c1[3] + l2*c2[3] + l3*c3[3];
#define geo_assert_not_reached
Sets a non reachable point in the program.
#define geo_debug_assert(x)
Verifies that a condition is met.
Draws triangles in an image.
void fillcircle(const vec2 &C, double radius, const Color &c)
Fills a circle in the target image.
ImageRasterizer(Image *image)
ImageRasterizer constructor.
void triangle(const vec2i &P1, const Color &c1, const vec2i &P2, const Color &c2, const vec2i &P3, const Color &c3)
Draws a triangle in the target image.
vec2i transform(const vec2 &p) const
Transforms a 2d point from world space to pixel coordinates.
void fillcircle(const vec2i &C, int radius, const Color &c)
Fills a circle in the target image.
bool pixel_is_black(int x, int y) const
Tests whether a given pixel is black.
void segment(const vec2 &p1, const vec2 &p2, const Color &c)
Draws a segment in the target image.
void set_pixel(int x, int y, const Color &c)
Sets a pixel of the image.
void flood_fill(int x, int y, const Color &c)
Flood-fill from a given pixel.
void clear()
Clears the target image.
void segment(const vec2i &P1, const vec2i &P2, const Color &c)
Draws a segment in the target image.
void triangle(const vec2 &p1, const Color &c1, const vec2 &p2, const Color &c2, const vec2 &p3, const Color &c3)
Draws a triangle in the target image.
void interpolate_color(const Color &c1, const Color &c2, const Color &c3, double l1, double l2, double l3, Color &c) const
Computes the linear interpolation between three colors.
ComponentEncoding
Indicates the datatype used to encode each component of the colors.
Common include file, providing basic definitions. Should be included before anything else by all head...
unsigned char byte
Unsigned byte type.
Global Vorpaline namespace.
geo_index_t index_t
The type for storing and manipulating indices.
vecng< 2, Numeric::int32 > vec2i
Represents points and vectors in 2d with integer coordinates.