My Project
 All Classes Files Functions Variables Enumerations Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
Raster< T > Class Template Reference

Class for 2D raster images of a specified type. More...

#include <image.h>

Inheritance diagram for Raster< T >:
Image< T >

Classes

class  ConstRowIterator
 
class  RowIterator
 

Public Types

typedef PixelTraits< T >
::ComputeType 
ComputeType
 
typedef PixelTraits< T >
::ScalarType 
ScalarType
 

Public Member Functions

 Raster (uint w, uint h, uint p, T *d)
 
uint width () const
 
uint height () const
 
uint pitch () const
 
bool contiguous () const
 
uint contiguous_size () const
 
T * contiguous_begin ()
 
const T * contiguous_begin () const
 
T * contiguous_end ()
 
const T * contiguous_end () const
 
T * row (uint r)
 
const T * row (uint r) const
 
boost::iterator_range< T * > row_range (uint r)
 
boost::iterator_range< const T * > row_range (uint r) const
 
RowIterator row_begin ()
 
RowIterator row_end ()
 
ConstRowIterator row_begin () const
 
ConstRowIterator row_end () const
 
void fill (const T &v)
 Clear the image to a constant value.
 
const ScalarType maximum_scalar_pixel_value () const
 
void scan (uint y, float x0, const ComputeType &v0, float x1, const ComputeType &v1)
 Fill a line segment on the given half-open range [x0,x1), interpolating between the two given values. More...
 
template<typename V >
void scan (uint y, float x0, const V &v0, float x1, const V &v1, const boost::function< ComputeType(const V &)> &fn)
 Variant scan, interpolates between two values then process them through function before.
 
bool write_ppmfile (const std::string &, Progress *) const
 
bool write_pgmfile (const std::string &, Progress *) const
 
template<>
bool write_pgmfile (const std::string &filename, Progress *target) const
 
template<>
bool write_pgmfile (const std::string &filename, Progress *target) const
 
template<>
bool write_ppmfile (const std::string &filename, Progress *target) const
 

Static Public Member Functions

static const ScalarType scalar (const T &v)
 

Detailed Description

template<typename T>
class Raster< T >

Class for 2D raster images of a specified type.

Assumes explicit instantiation. NB The base type just refers to storage allocated elsewhere. Used to be gratuitously implemented using boost multiarray type, but that was too inefficient This is still pretty bad byt gcc 4.1 seems to do a very nice job with -O2.

Member Function Documentation

template<typename T >
void Raster< T >::scan ( uint  y,
float  x0,
const ComputeType &  v0,
float  x1,
const ComputeType &  v1 
)
inline

Fill a line segment on the given half-open range [x0,x1), interpolating between the two given values.

Scan x0 to x1 into image. Pixel centres are at 0.5 , so x0=0.75 goes to pixel 1. Rightmost pixel is at width()-0.5.


The documentation for this class was generated from the following files: