Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::Bitmap Class Reference

General-purpose bitmap class with read and write support for several common file formats. More...

#include <mitsuba/core/bitmap.h>

+ Inheritance diagram for mitsuba::Bitmap:

Classes

struct  Layer
 Describes a sub-layer of a multilayer bitmap (e.g. OpenEXR) More...
 

Public Member Functions

std::string toString () const
 Return some human-readable information about this bitmap. More...
 
virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
Access to metadata associated with the bitmap
Float getGamma () const
 Return the bitmap's gamma identifier (-1: sRGB) More...
 
void setGamma (Float gamma)
 Set the bitmap's gamma identifier (-1: sRGB) More...
 
void setMetadataString (const std::string &key, const std::string &value)
 Set a string-valued metadata field. More...
 
std::string getMetadataString (const std::string &key) const
 Return a string-valued metadata field. More...
 
PropertiesgetMetadata ()
 Return a Properties object containing the image metadata. More...
 
const PropertiesgetMetadata () const
 Return a Properties object containing the image metadata (const version) More...
 
void setMetadata (const Properties &metadata)
 Set the a Properties object containing the image metadata. More...
 
void setChannelNames (const std::vector< std::string > &names)
 Explicitly set the names of the image channels. More...
 
std::vector< std::string > & getChannelNames ()
 Return the names of the image channels if explicitly specified (empty by default) More...
 
const std::vector< std::string > & getChannelNames () const
 Return the names of the image channels if explicitly specified (empty by default) More...
 
Bitmap raster data accessors
void * getData ()
 Access the underlying raster. More...
 
const void * getData () const
 Access the underlying bit raster (const version) More...
 
uint8_tgetUInt8Data ()
 Access the underlying raster (for uint8 bitmaps) More...
 
const uint8_tgetUInt8Data () const
 Access the underlying bit raster (for uint8 bitmaps, const version) More...
 
uint16_t * getUInt16Data ()
 Access the underlying raster data (for uint16 bitmaps) More...
 
const uint16_t * getUInt16Data () const
 Access the underlying raster data (for uint16 bitmaps, const version) More...
 
uint32_tgetUInt32Data ()
 Access the underlying raster data (for uint32 bitmaps) More...
 
const uint32_tgetUInt32Data () const
 Access the underlying raster data (for uint32 bitmaps, const version) More...
 
halfgetFloat16Data ()
 Access the underlying raster data (for float16 bitmaps) More...
 
const halfgetFloat16Data () const
 Access the underlying raster data (for float16 bitmaps, const version) More...
 
float * getFloat32Data ()
 Access the underlying raster data (for float32 bitmaps) More...
 
const float * getFloat32Data () const
 Access the underlying raster data (for float32 bitmaps, const version) More...
 
double * getFloat64Data ()
 Access the underlying raster data (for float64 bitmaps) More...
 
const double * getFloat64Data () const
 Access the underlying raster data (for float64 bitmaps, const version) More...
 
FloatgetFloatData ()
 Access the underlying raster data (for float32/float64 bitmaps) More...
 
const FloatgetFloatData () const
 Access the underlying raster data (for float/float64 bitmaps, const version) More...
 
- Public Member Functions inherited from Object
 Object ()
 Construct a new object. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the reference count of the object by one. More...
 
void decRef (bool autoDeallocate=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 

Static Public Member Functions

static void staticInitialization ()
 Run static initialization code (sets up OpenEXR for multithreading) More...
 
static void staticShutdown ()
 Release any resources allocated in staticInitialization. More...
 
- Static Public Member Functions inherited from Object
static void staticInitialization ()
 Initializes the built-in reference count debugger (if enabled) More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 

Static Public Attributes

static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_theClass
 Pointer to the object's class descriptor. More...
 

Protected Member Functions

virtual ~Bitmap ()
 Virtual destructor. More...
 
void readPNG (Stream *stream)
 Read a file stored using the PNG file format. More...
 
void writePNG (Stream *stream, int compression) const
 Write a file using the PNG file format. More...
 
void readJPEG (Stream *stream)
 Read a file stored using the JPEG file format. More...
 
void writeJPEG (Stream *stream, int quality=100) const
 Save a file using the JPEG file format. More...
 
void readRGBE (Stream *stream)
 Read a file stored using the RGBE file format. More...
 
void writeRGBE (Stream *stream) const
 Write a file using the RGBE file format. More...
 
void readOpenEXR (Stream *stream, const std::string &prefix)
 Read a file stored using the OpenEXR file format. More...
 
void writeOpenEXR (Stream *stream) const
 Write a file using the OpenEXR file format. More...
 
void readPFM (Stream *stream)
 Read a file stored using the PFM file format. More...
 
void writePFM (Stream *stream) const
 Write a file using the PFM file format. More...
 
void readPPM (Stream *stream)
 Read a file stored using the PPM file format. More...
 
void writePPM (Stream *stream) const
 Write a file using the PPM file format. More...
 
void readTGA (Stream *stream)
 Read a file stored using the TGA file format. More...
 
void readBMP (Stream *stream)
 Read a file stored using the BMP file format. More...
 
void updateChannelCount ()
 Update the internally cached channel count. More...
 
void readStream (EFileFormat format, Stream *stream, const std::string &prefix)
 Delegate for stream loading operations. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Protected Attributes

EPixelFormat m_pixelFormat
 
EComponentFormat m_componentFormat
 
Vector2i m_size
 
uint8_tm_data
 
Float m_gamma
 
uint8_t m_channelCount
 
bool m_ownsData
 
Properties m_metadata
 
std::vector< std::string > m_channelNames
 

Constructors and Enumerations

enum  EPixelFormat {
  ELuminance = 0x00, ELuminanceAlpha = 0x01, ERGB = 0x02, ERGBA = 0x03,
  EXYZ = 0x04, EXYZA = 0x05, ESpectrum = 0x06, ESpectrumAlpha = 0x07,
  ESpectrumAlphaWeight = 0x08, EMultiSpectrumAlphaWeight = 0x09, EMultiChannel = 0x10
}
 
enum  EComponentFormat {
  EBitmask = 0, EUInt8, EUInt16, EUInt32,
  EFloat16, EFloat32, EFloat64, EInvalid,
  EFloat = EFloat64
}
 Supported per-component data formats. More...
 
enum  EFileFormat {
  EPNG = 0, EOpenEXR, ERGBE, EPFM,
  EPPM, EJPEG, ETGA, EBMP,
  EAuto
}
 Supported file formats. More...
 
enum  ERotateFlipType {
  ERotateNoneFlipNone = 0, ERotate180FlipXY = ERotateNoneFlipNone, ERotate90FlipNone = 1, ERotate270FlipXY = ERotate90FlipNone,
  ERotate180FlipNone = 2, ERotateNoneFlipXY = ERotate180FlipNone, ERotate270FlipNone = 3, ERotate90FlipXY = ERotate270FlipNone,
  ERotateNoneFlipX = 4, ERotate180FlipY = ERotateNoneFlipX, ERotate90FlipX = 5, ERotate270FlipY = ERotate90FlipX,
  ERotate180FlipX = 6, ERotateNoneFlipY = ERotate180FlipX, ERotate270FlipX = 7, ERotate90FlipY = ERotate270FlipX
}
 List of different rotation/flip types that can be passed to rotateFlip() More...
 
enum  EArithmeticOperation { EAddition = 0, ESubtraction, EMultiplication, EDivision }
 The four basic arithmetic operations for use with arithmeticOperation() More...
 
 Bitmap (EPixelFormat pFmt, EComponentFormat cFmt, const Vector2i &size, uint8_t channelCount=0, uint8_t *data=NULL)
 Create a bitmap of the specified type and allocate the necessary amount of memory. More...
 
 Bitmap (EFileFormat format, Stream *stream, const std::string &prefix="")
 Load a bitmap from an arbitrary stream data source. More...
 
 Bitmap (const fs::path &path, const std::string &prefix="")
 Load a bitmap from a file on disk. More...
 

Miscellaneous

EPixelFormat getPixelFormat () const
 Return the pixel format of this bitmap. More...
 
EComponentFormat getComponentFormat () const
 Return the component format of this bitmap. More...
 
const Vector2igetSize () const
 Return the bitmap's resolution in pixels. More...
 
size_t getPixelCount () const
 Return the total number of pixels. More...
 
int getWidth () const
 Return the bitmap's width in pixels. More...
 
int getHeight () const
 Return the bitmap's height in pixels. More...
 
int getChannelCount () const
 Return the number of channels used by this bitmap. More...
 
bool isSquare () const
 Return whether this image has matching width and height. More...
 
std::string getChannelName (int channelIndex) const
 Return a string representation of the name of a channel. More...
 
bool hasAlpha () const
 Return whether this image has an alpha channel. More...
 
bool hasWeight () const
 Return whether this image has a weight channel. More...
 
bool isMultiChannel () const
 Return whether this is a generic multi-channel image. More...
 
int getBitsPerComponent () const
 Return the number bits per component. More...
 
int getBytesPerComponent () const
 Return the number bytes per component. More...
 
int getBytesPerPixel () const
 Return the number of bytes per pixel. More...
 
size_t getBufferSize () const
 Return the bitmap size in bytes. More...
 
Spectrum getPixel (const Point2i &pos) const
 Return the spectral color value associated with a given pixel. More...
 
void setPixel (const Point2i &pos, const Spectrum &value)
 Set the spectral color value associated with a given pixel. More...
 
void drawHLine (int y, int x1, int x2, const Spectrum &value)
 Draw a horizontal line at the specified position. More...
 
void drawVLine (int x, int y1, int y2, const Spectrum &value)
 Draw a vertical line at the specified position. More...
 
void drawRect (const Point2i &offset, const Vector2i &size, const Spectrum &value)
 Draw a rectangle with the specified position and size. More...
 
void fillRect (Point2i offset, Vector2i size, const Spectrum &value)
 Draw a filled rectangle with the specified position and size. More...
 
void drawWorkUnit (const Point2i &offset, const Vector2i &size, int worker)
 Convenience function to visually indicate that a thread is working on a certain part of an image. More...
 
bool operator== (const Bitmap &bitmap) const
 Bitmap equality operator (useful for unit-tests etc.) More...
 
bool operator!= (const Bitmap &bitmap) const
 Bitmap inequality operator (useful for unit-tests etc.) More...
 
ref< Bitmapclone () const
 Create an identical copy. More...
 
void clear ()
 Clear the bitmap to zero. More...
 
void write (EFileFormat format, Stream *stream, int compression=-1) const
 
void write (EFileFormat format, const fs::path &filename, int compression=-1) const
 
void write (const fs::path &filename, int compression=-1) const
 
template<typename T >
static EComponentFormat componentFormat ()
 Return the bitmap component format for a specified type. More...
 

Conversions and transformations

void convert (Bitmap *target, Float multiplier=1.0f, Spectrum::EConversionIntent intent=Spectrum::EReflectance) const
 Convert the bitmap into another pixel and/or component format. More...
 
ref< Bitmapconvert (EPixelFormat pixelFormat, EComponentFormat componentFormat, Float gamma=1.0f, Float multiplier=1.0f, Spectrum::EConversionIntent intent=Spectrum::EReflectance)
 Convert the bitmap into another pixel and/or component format. More...
 
void convert (void *target, EPixelFormat pixelFormat, EComponentFormat componentFormat, Float gamma=1.0f, Float multiplier=1.0f, Spectrum::EConversionIntent intent=Spectrum::EReflectance) const
 Convert the bitmap into another pixel and/or component format. More...
 
ref< BitmapconvertMultiSpectrumAlphaWeight (const std::vector< EPixelFormat > &pixelFormats, EComponentFormat componentFormat, const std::vector< std::string > &channelNames) const
 Specialized conversion method for multi-channel HDR images. More...
 
void tonemapReinhard (Float &logAvgLuminance, Float &maxLuminance, Float key, Float burn)
 Apply Reinhard et al's tonemapper in chromaticity space. More...
 
ref< Bitmapexpand ()
 Expand bitmask images. More...
 
ref< BitmapextractChannel (int channelIndex) const
 Extract one of the color channels in the bitmap and return it as a separate luminance bitmap. More...
 
ref< BitmapextractChannels (Bitmap::EPixelFormat fmt, const std::vector< int > &channels) const
 Extract several color channels of a multi-channel bitmap and return them as a bitmap with the given pixel format. More...
 
std::vector< LayergetLayers () const
 Extracts layer information from the bitmap. More...
 
std::map< std::string, Bitmap * > split () const
 Split an multi-channel image buffer (e.g. from an OpenEXR image with lots of AOVs) into its constituent layers. More...
 
ref< Bitmapcrop (const Point2i &offset, const Vector2i &size) const
 Crop the bitmap to the specified rectangle. More...
 
void flipVertically ()
 Vertically flip the image contents. More...
 
Spectrum average () const
 Compute the average value of the bitmap. More...
 
ref< BitmaprotateFlip (ERotateFlipType type) const
 Perform the specified rotatation & flip operation. More...
 
void scale (Float value)
 Scale the entire image by a certain value. More...
 
void pow (Float value)
 Raise the entire image to a certain value. More...
 
void colorBalance (Float r, Float g, Float b)
 Color balancing: apply the given scale factors to the red, green, and blue channels of the image. More...
 
void applyMatrix (Float matrix[3][3])
 
void copyFrom (const Bitmap *bitmap, Point2i sourceOffset, Point2i targetOffset, Vector2i size)
 Copy the contents of another bitmap into the region with the specified offset. More...
 
void copyFrom (const Bitmap *bitmap, Point2i targetOffset)
 Copy the contents of another bitmap into the region with the specified offset. More...
 
void copyFrom (const Bitmap *bitmap)
 Copy the contents of another bitmap into the region with the specified offset. More...
 
void accumulate (const Bitmap *bitmap, Point2i sourceOffset, Point2i targetOffset, Vector2i size)
 Accumulate the contents of another bitmap into the region with the specified offset. More...
 
void accumulate (const Bitmap *bitmap, Point2i targetOffset)
 Accumulate the contents of another bitmap into the region with the specified offset. More...
 
void accumulate (const Bitmap *bitmap)
 Accumulate the contents of another bitmap into the region with the specified offset. More...
 
void convolve (const Bitmap *kernel)
 Convolve the image with a (centered) convolution kernel. More...
 
void resample (const ReconstructionFilter *rfilter, ReconstructionFilter::EBoundaryCondition bch, ReconstructionFilter::EBoundaryCondition bcv, Bitmap *target, Bitmap *temp=NULL, Float minValue=0.0f, Float maxValue=1.0f) const
 Up- or down-sample this image to a different resolution. More...
 
ref< Bitmapresample (const ReconstructionFilter *rfilter, ReconstructionFilter::EBoundaryCondition bch, ReconstructionFilter::EBoundaryCondition bcv, const Vector2i &size, Float minValue=0.0f, Float maxValue=1.0f) const
 Up- or down-sample this image to a different resolution. More...
 
void filter (const ReconstructionFilter *rfilter, ReconstructionFilter::EBoundaryCondition bch, ReconstructionFilter::EBoundaryCondition bcv, Bitmap *target, Bitmap *temp=NULL, Float minValue=0.0f, Float maxValue=1.0f) const
 Apply a separable convolution filter to the image. More...
 
ref< Bitmapfilter (const ReconstructionFilter *rfilter, ReconstructionFilter::EBoundaryCondition bch, ReconstructionFilter::EBoundaryCondition bcv, Float minValue=0.0f, Float maxValue=1.0f) const
 Apply a separable convolution filter to the image. More...
 
static void convertMultiSpectrumAlphaWeight (const Bitmap *source, const uint8_t *sourcePtr, const Bitmap *target, uint8_t *targetPtr, const std::vector< EPixelFormat > &pixelFormats, EComponentFormat componentFormat, size_t count)
 Similar to the above, but writes to an already existing image. More...
 
static ref< Bitmapjoin (EPixelFormat fmt, const std::vector< Bitmap * > &sourceBitmaps)
 Merges multiple bitmaps of the same type and resolution into one with a larger number of channels. More...
 
static ref< BitmaparithmeticOperation (EArithmeticOperation operation, const Bitmap *bitmap1, const Bitmap *bitmap2)
 Perform an arithmetic operation using two images. More...
 

Detailed Description

General-purpose bitmap class with read and write support for several common file formats.

This class handles loading of PNG, JPEG, BMP, TGA, as well as OpenEXR files, and it supports writing of PNG, JPEG and OpenEXR files.

PNG and OpenEXR files are optionally annotated with string-valued metadata, and the gamma setting can be stored as well. Please see the class methods and enumerations for further detail.

The Python version of this API contains thee additional member functions: fromByteArray and toByteArray copy image data between the Bitmap instance and a Python bytearray. The function buffer returns a memoryview-compatible buffer object that can also interoperate with numpy's ndarray.

Member Enumeration Documentation

The four basic arithmetic operations for use with arithmeticOperation()

Enumerator
EAddition 
ESubtraction 
EMultiplication 
EDivision 

Supported per-component data formats.

Enumerator
EBitmask 

1-bit (mask) component encoding.

Note that you can use this class to load, save, and access bitmasks – however, many of the manipulation operations (i.e. crop(), accumulate(), etc.) do not currently handle them.

Default gamma value: linear (1.0)

EUInt8 

8-bit unsigned integer (uint8_t) component encoding

Default gamma value: sRGB (approx. 2.2)

EUInt16 

16-bit unsigned integer (uint16_t) component encoding

Default gamma value: linear (1.0)

EUInt32 

32-bit unsigned integer (uint32_t) component encoding

Default gamma value: linear (1.0)

EFloat16 

16-bit floating point (half) HDR component encoding

Default gamma value: linear (1.0)

EFloat32 

32-bit floating point (float) HDR component encoding

Default gamma value: linear (1.0)

EFloat64 

64-bit floating point (double) HDR component encoding

Default gamma value: linear (1.0)

EInvalid 

Invalid component format (used to report error conditions)

EFloat 

Floating point (float or double depending on the compilation settings) HDR component encoding.

Default gamma value: linear (1.0)

Supported file formats.

Enumerator
EPNG 

Portable network graphics.

The following is supported:

  • Loading and saving of 8/16-bit per component bitmaps for all pixel formats (ELuminance, ELuminanceAlpha, ERGB, ERGBA)
  • Loading and saving of 1-bit per component mask bitmaps
  • Loading and saving of string-valued metadata fields
EOpenEXR 

OpenEXR high dynamic range file format developed by Industrial Light & Magic (ILM)

The following is supported:

  • Loading and saving of Eloat16 / EFloat32/ EUInt32 bitmaps with all supported RGB/Luminance/Alpha combinations
  • Loading and saving of spectral bitmaps
  • Loading and saving of XYZ tristimulus bitmaps
  • Loading and saving of string-valued metadata fields

The following is not supported:

  • Saving of tiled images, tile-based read access
  • Display windows that are different than the data window
  • Loading of spectrum-valued bitmaps
ERGBE 

RGBE image format by Greg Ward.

The following is supported

  • Loading and saving of EFloat32 - based RGB bitmaps
EPFM 

PFM (Portable Float Map) image format.

The following is supported

  • Loading and saving of EFloat32 - based Luminance or RGB bitmaps
EPPM 

PPM (Portable Pixel Map) image format.

The following is supported

EJPEG 

Joint Photographic Experts Group file format.

The following is supported:

  • Loading and saving of 8 bit per component RGB and luminance bitmaps
ETGA 

Truevision Advanced Raster Graphics Array file format.

The following is supported:

  • Loading of uncompressed 8-bit RGB/RGBA files
EBMP 

Windows Bitmap file format.

The following is supported:

  • Loading of uncompressed 8-bit luminance and RGBA bitmaps
EAuto 

Automatically detect the file format.

Note: this flag only applies when loading a file. In this case, the source stream must support the seek() operation.

This enumeration lists all pixel format types supported by the Bitmap class. This both determines the number of channels, and how they should be interpreted

Enumerator
ELuminance 

Single-channel luminance bitmap.

ELuminanceAlpha 

Two-channel luminance + alpha bitmap.

ERGB 

RGB bitmap.

ERGBA 

RGB bitmap + alpha channel.

EXYZ 

XYZ tristimulus bitmap.

EXYZA 

XYZ tristimulus + alpha channel.

ESpectrum 

Spectrum bitmap.

ESpectrumAlpha 

Spectrum bitmap + alpha channel.

ESpectrumAlphaWeight 

Spectrum bitmap + alpha + weight channel (Mitsuba's internal render bucket representation)

EMultiSpectrumAlphaWeight 

Bitmap with multiple spectra + alpha + weight channel (render buckets used by the 'multichannel' plugin)

EMultiChannel 

Arbitrary multi-channel bitmap without a fixed interpretation.

List of different rotation/flip types that can be passed to rotateFlip()

Enumerator
ERotateNoneFlipNone 
ERotate180FlipXY 
ERotate90FlipNone 
ERotate270FlipXY 
ERotate180FlipNone 
ERotateNoneFlipXY 
ERotate270FlipNone 
ERotate90FlipXY 
ERotateNoneFlipX 
ERotate180FlipY 
ERotate90FlipX 
ERotate270FlipY 
ERotate180FlipX 
ERotateNoneFlipY 
ERotate270FlipX 
ERotate90FlipY 

Constructor & Destructor Documentation

mitsuba::Bitmap::Bitmap ( EPixelFormat  pFmt,
EComponentFormat  cFmt,
const Vector2i size,
uint8_t  channelCount = 0,
uint8_t data = NULL 
)

Create a bitmap of the specified type and allocate the necessary amount of memory.

Parameters
pFmtSpecifies the pixel format (e.g. RGBA or Luminance-only)
cFmtSpecifies how the per-pixel components are encoded (e.g. unsigned 8 bit integers or 32-bit floating point values)
sizeSpecifies the horizontal and vertical bitmap size in pixels
channelCountChannel count of the image. This parameter is only required when pFmt = EMultiChannel or EMultiSpectrumAlphaWeight
dataExternal pointer to the image data. If set to NULL, the implementation will allocate memory itself.
mitsuba::Bitmap::Bitmap ( EFileFormat  format,
Stream stream,
const std::string &  prefix = "" 
)

Load a bitmap from an arbitrary stream data source.

Parameters
formatFile format to be read (PNG/EXR/Auto-detect ...)
streamPointer to an arbitrary stream data source
prefixOnly consider image layers whose identifier begins with prefix. This is currently only supported by the OpenEXR format loader.
mitsuba::Bitmap::Bitmap ( const fs::path &  path,
const std::string &  prefix = "" 
)

Load a bitmap from a file on disk.

Parameters
pathPath to a bitmap file (format will be auto-detected)
prefixOnly consider image layers whose identifier begins with prefix. This is currently only supported by the OpenEXR format loader.
virtual mitsuba::Bitmap::~Bitmap ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

void mitsuba::Bitmap::accumulate ( const Bitmap bitmap,
Point2i  sourceOffset,
Point2i  targetOffset,
Vector2i  size 
)

Accumulate the contents of another bitmap into the region with the specified offset.

Out-of-bounds regions are ignored. It is assumed that bitmap != this.

Remarks
This function throws an exception when the bitmaps use different component formats or channels, or when the component format is EBitmask.
void mitsuba::Bitmap::accumulate ( const Bitmap bitmap,
Point2i  targetOffset 
)
inline

Accumulate the contents of another bitmap into the region with the specified offset.

This convenience function calls the main accumulate() implementation with size set to bitmap->getSize() and sourceOffset set to zero. Out-of-bounds regions are ignored. It is assumed that bitmap != this.

Remarks
This function throws an exception when the bitmaps use different component formats or channels, or when the component format is EBitmask.
void mitsuba::Bitmap::accumulate ( const Bitmap bitmap)
inline

Accumulate the contents of another bitmap into the region with the specified offset.

This convenience function calls the main accumulate() implementation with size set to bitmap->getSize() and sourceOffset and targetOffsettt> set to zero. Out-of-bounds regions are ignored. It is assumed that bitmap != this.

Remarks
This function throws an exception when the bitmaps use different component formats or channels, or when the component format is EBitmask.
void mitsuba::Bitmap::applyMatrix ( Float  matrix[3][3])

Apply a color transformation matrix to the contents of the bitmap

The implementation assumes that the contents have the RGB, RGBA, XYZ, or XYZA pixel format and a floating point component format.

static ref<Bitmap> mitsuba::Bitmap::arithmeticOperation ( EArithmeticOperation  operation,
const Bitmap bitmap1,
const Bitmap bitmap2 
)
static

Perform an arithmetic operation using two images.

This function can add, subtract, multiply, or divide arbitrary images. If the input images have different sizes or component and pixel formats, the implementation first resamples and converts them into the most "expressive" format that subsumes both input images (at the cost of some temporary dynamic memory allocations).

To keep the implementation simple, there is currently no special treatment of integer over/underflows if the component format is EUInt8, EUInt16, or EUInt32.

Spectrum mitsuba::Bitmap::average ( ) const

Compute the average value of the bitmap.

void mitsuba::Bitmap::clear ( )

Clear the bitmap to zero.

ref<Bitmap> mitsuba::Bitmap::clone ( ) const

Create an identical copy.

void mitsuba::Bitmap::colorBalance ( Float  r,
Float  g,
Float  b 
)

Color balancing: apply the given scale factors to the red, green, and blue channels of the image.

When the image is not an EFloat16, EFloat32, or EFloat64-based RGB/RGBA image, the function throws an exception

template<typename T >
static EComponentFormat mitsuba::Bitmap::componentFormat ( )
inlinestatic

Return the bitmap component format for a specified type.

void mitsuba::Bitmap::convert ( Bitmap target,
Float  multiplier = 1.0f,
Spectrum::EConversionIntent  intent = Spectrum::EReflectance 
) const

Convert the bitmap into another pixel and/or component format.

This helper function can be used to efficiently convert a bitmap between different underlying representations. For instance, it can translate a 24-bit sRGB bitmap to a linear spectrum-valued representation based on half-, single- or double-precision floating point-backed storage.

This function roughly does the following:

  • For each pixel and channel, it converts the associated value into a normalized linear-space form (any gamma of the source bitmap is removed)
  • The multiplier and gamma correction specified in targetGamma is applied
  • The corrected value is clamped against the representable range of the desired component format.
  • The clamped gamma-corrected value is then written to the new bitmap

    If the pixel formats differ, this function will also perform basic conversions (e.g. spectrum to rgb, luminance to uniform spectrum values, etc.)

    Note that the alpha channel is assumed to be linear in both the source and target bitmap, hence it won't be affected by any gamma-related transformations.

    Remarks
    This convert() variant takes a pointer to an existing bitmap, which must have a matching size. It then copies all data, while performing the necessary pixel/component format and gamma conversions.

    target Pointer to the target bitmap, which should be of the same size. multiplier An optional multiplicative factor that can be applied to all color/luminance values in linear space (alpha will not be affected). intent When converting from RGB to spectral color values, this flag specifies how ambiguities in this highly under-constrained problem should be resolved.

ref<Bitmap> mitsuba::Bitmap::convert ( EPixelFormat  pixelFormat,
EComponentFormat  componentFormat,
Float  gamma = 1.0f,
Float  multiplier = 1.0f,
Spectrum::EConversionIntent  intent = Spectrum::EReflectance 
)

Convert the bitmap into another pixel and/or component format.

This helper function can be used to efficiently convert a bitmap between different underlying representations. For instance, it can translate a 24-bit sRGB bitmap to a linear spectrum-valued representation based on half-, single- or double-precision floating point-backed storage.

This function roughly does the following:

  • For each pixel and channel, it converts the associated value into a normalized linear-space form (any gamma of the source bitmap is removed)
  • The multiplier and gamma correction specified in targetGamma is applied
  • The corrected value is clamped against the representable range of the desired component format.
  • The clamped gamma-corrected value is then written to the new bitmap

    If the pixel formats differ, this function will also perform basic conversions (e.g. spectrum to rgb, luminance to uniform spectrum values, etc.)

    Note that the alpha channel is assumed to be linear in both the source and target bitmap, hence it won't be affected by any gamma-related transformations.

    Remarks
    This convert() variant usually returns a new bitmap instance. When the conversion would just involve copying the original bitmap, the function becomes a no-op and returns the current instance.

    pixelFormat Specifies the desired pixel format componentFormat Specifies the desired component format gamma Specifies the desired gamma value. Special values: 1.0 denotes a linear space, and -1.0 corresponds to sRGB. multiplier An optional multiplicative factor that can be applied to all color/luminance values in linear space (alpha will not be affected). intent When converting from RGB to spectral color values, this flag specifies how ambiguities in this highly under-constrained problem should be resolved.

void mitsuba::Bitmap::convert ( void *  target,
EPixelFormat  pixelFormat,
EComponentFormat  componentFormat,
Float  gamma = 1.0f,
Float  multiplier = 1.0f,
Spectrum::EConversionIntent  intent = Spectrum::EReflectance 
) const

Convert the bitmap into another pixel and/or component format.

This helper function can be used to efficiently convert a bitmap between different underlying representations. For instance, it can translate a 24-bit sRGB bitmap to a linear spectrum-valued representation based on half-, single- or double-precision floating point-backed storage.

This function roughly does the following:

  • For each pixel and channel, it converts the associated value into a normalized linear-space form (any gamma of the source bitmap is removed)
  • The multiplier and gamma correction specified in targetGamma is applied
  • The corrected value is clamped against the representable range of the desired component format.
  • The clamped gamma-corrected value is then written to the new bitmap

    If the pixel formats differ, this function will also perform basic conversions (e.g. spectrum to rgb, luminance to uniform spectrum values, etc.)

    Note that the alpha channel is assumed to be linear in both the source and target bitmap, hence it won't be affected by any gamma-related transformations.

    Remarks
    This convert() variant writes to a raw bitmap buffer provided as a pointer.

    target A pointer to a "raw" image pixel buffer pixelFormat Specifies the desired pixel format componentFormat Specifies the desired component format gamma Specifies the desired gamma value. Special values: 1.0 denotes a linear space, and -1.0 corresponds to sRGB. multiplier An optional multiplicative factor that can be applied to all color/luminance values in linear space (alpha will not be affected). intent When converting from RGB to spectral color values, this flag specifies how ambiguities in this highly under-constrained problem should be resolved.

ref<Bitmap> mitsuba::Bitmap::convertMultiSpectrumAlphaWeight ( const std::vector< EPixelFormat > &  pixelFormats,
EComponentFormat  componentFormat,
const std::vector< std::string > &  channelNames 
) const

Specialized conversion method for multi-channel HDR images.

The bitmap class pixel format EMultiSpectrumAlphaWeight is used by the 'multichannel' plugin to render multiple related images at the same time. This function implements a conversion function analogous to convert() that adjusts each of the sub-images so that it has a desired pixel format. The returned bitmap has the combined pixel format EMultiChannel and the specified component format. Names for each of the resulting channels should be provided via the channelNames parameters.

This feature is currently used by the hdrfilm and tiledhdrfilm plugins.

static void mitsuba::Bitmap::convertMultiSpectrumAlphaWeight ( const Bitmap source,
const uint8_t sourcePtr,
const Bitmap target,
uint8_t targetPtr,
const std::vector< EPixelFormat > &  pixelFormats,
EComponentFormat  componentFormat,
size_t  count 
)
static

Similar to the above, but writes to an already existing image.

void mitsuba::Bitmap::convolve ( const Bitmap kernel)

Convolve the image with a (centered) convolution kernel.

When compiled with FFTW, Mitsuba will do the convolution in frequency space using three FFT operations. Otherwise, it falls back to a brute force method with quadratic complexity.

The image can have any resolution; the kernel should be square and of odd resolution. Both images must be of the same floating point-valued component format. The kernel can either have one color channel or as many color channels as the image to be convolved.

The convolution is always performed in double precision. irrespective of the precision of the underlying data.

void mitsuba::Bitmap::copyFrom ( const Bitmap bitmap,
Point2i  sourceOffset,
Point2i  targetOffset,
Vector2i  size 
)

Copy the contents of another bitmap into the region with the specified offset.

Out-of-bounds regions are ignored. It is assumed that bitmap != this.

Remarks
This function throws an exception when the bitmaps use different component formats or channels, or when the component format is EBitmask.
void mitsuba::Bitmap::copyFrom ( const Bitmap bitmap,
Point2i  targetOffset 
)
inline

Copy the contents of another bitmap into the region with the specified offset.

This convenience function calls the main copyFrom() implementation with size set to bitmap->getSize() and sourceOffset set to zero. Out-of-bounds regions are ignored. It is assumed that bitmap != this.

Remarks
This function throws an exception when the bitmaps use different component formats or channels, or when the component format is EBitmask.
void mitsuba::Bitmap::copyFrom ( const Bitmap bitmap)
inline

Copy the contents of another bitmap into the region with the specified offset.

This convenience function calls the main copyFrom() implementation with size set to bitmap->getSize() and sourceOffset and targetOffsettt> set to zero. Out-of-bounds regions are ignored. It is assumed that bitmap != this.

Remarks
This function throws an exception when the bitmaps use different component formats or channels, or when the component format is EBitmask.
ref<Bitmap> mitsuba::Bitmap::crop ( const Point2i offset,
const Vector2i size 
) const

Crop the bitmap to the specified rectangle.

void mitsuba::Bitmap::drawHLine ( int  y,
int  x1,
int  x2,
const Spectrum value 
)

Draw a horizontal line at the specified position.

Draws from x1<x2 up to and including x2.

void mitsuba::Bitmap::drawRect ( const Point2i offset,
const Vector2i size,
const Spectrum value 
)

Draw a rectangle with the specified position and size.

void mitsuba::Bitmap::drawVLine ( int  x,
int  y1,
int  y2,
const Spectrum value 
)

Draw a vertical line at the specified position.

Draws from y1<y2 up to and including y2.

void mitsuba::Bitmap::drawWorkUnit ( const Point2i offset,
const Vector2i size,
int  worker 
)

Convenience function to visually indicate that a thread is working on a certain part of an image.

ref<Bitmap> mitsuba::Bitmap::expand ( )

Expand bitmask images.

When this image is a bitmask, the implementation returns an expanded version in EUInt8 format. Otherwise, it returns a pointer to the current instance.

ref<Bitmap> mitsuba::Bitmap::extractChannel ( int  channelIndex) const

Extract one of the color channels in the bitmap and return it as a separate luminance bitmap.

When this is already a single-channel bitmap, the function returns a pointer to the current instance.

ref<Bitmap> mitsuba::Bitmap::extractChannels ( Bitmap::EPixelFormat  fmt,
const std::vector< int > &  channels 
) const

Extract several color channels of a multi-channel bitmap and return them as a bitmap with the given pixel format.

void mitsuba::Bitmap::fillRect ( Point2i  offset,
Vector2i  size,
const Spectrum value 
)

Draw a filled rectangle with the specified position and size.

void mitsuba::Bitmap::filter ( const ReconstructionFilter rfilter,
ReconstructionFilter::EBoundaryCondition  bch,
ReconstructionFilter::EBoundaryCondition  bcv,
Bitmap target,
Bitmap temp = NULL,
Float  minValue = 0.0f,
Float  maxValue = 1.0f 
) const

Apply a separable convolution filter to the image.

Applies the provided filter while observing the specified horizontal and vertical boundary conditions when looking up data outside of the input domain.

In comparison to convolve(), this function operates in the primal domain.

A maximum and maximum image value can be specified to prevent to prevent out-of-range values that are created by the filtering process.

The optional 'temp' parameter can be used to pass an image of the same dimensions as the source and target image.

ref<Bitmap> mitsuba::Bitmap::filter ( const ReconstructionFilter rfilter,
ReconstructionFilter::EBoundaryCondition  bch,
ReconstructionFilter::EBoundaryCondition  bcv,
Float  minValue = 0.0f,
Float  maxValue = 1.0f 
) const

Apply a separable convolution filter to the image.

Applies the provided filter while observing the specified horizontal and vertical boundary conditions when looking up data outside of the input domain.

In comparison to convolve(), this function operates in the primal domain.

A maximum and maximum image value can be specified to prevent to prevent out-of-range values that are created by the filtering process.

This function allocates a new output image and returns it.

void mitsuba::Bitmap::flipVertically ( )

Vertically flip the image contents.

int mitsuba::Bitmap::getBitsPerComponent ( ) const

Return the number bits per component.

When the component format is set to EBitmask, this function returns 1; EUInt8 maps to 8, etc.

size_t mitsuba::Bitmap::getBufferSize ( ) const

Return the bitmap size in bytes.

int mitsuba::Bitmap::getBytesPerComponent ( ) const

Return the number bytes per component.

When the component format is set to EBitmask, this function throws an exception.

int mitsuba::Bitmap::getBytesPerPixel ( ) const
inline

Return the number of bytes per pixel.

When the component format is set to EBitmask, this function throws an exception.

int mitsuba::Bitmap::getChannelCount ( ) const
inline

Return the number of channels used by this bitmap.

std::string mitsuba::Bitmap::getChannelName ( int  channelIndex) const

Return a string representation of the name of a channel.

std::vector<std::string>& mitsuba::Bitmap::getChannelNames ( )
inline

Return the names of the image channels if explicitly specified (empty by default)

const std::vector<std::string>& mitsuba::Bitmap::getChannelNames ( ) const
inline

Return the names of the image channels if explicitly specified (empty by default)

virtual const Class* mitsuba::Bitmap::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from Object.

EComponentFormat mitsuba::Bitmap::getComponentFormat ( ) const
inline

Return the component format of this bitmap.

void* mitsuba::Bitmap::getData ( )
inline

Access the underlying raster.

const void* mitsuba::Bitmap::getData ( ) const
inline

Access the underlying bit raster (const version)

half* mitsuba::Bitmap::getFloat16Data ( )
inline

Access the underlying raster data (for float16 bitmaps)

const half* mitsuba::Bitmap::getFloat16Data ( ) const
inline

Access the underlying raster data (for float16 bitmaps, const version)

float* mitsuba::Bitmap::getFloat32Data ( )
inline

Access the underlying raster data (for float32 bitmaps)

const float* mitsuba::Bitmap::getFloat32Data ( ) const
inline

Access the underlying raster data (for float32 bitmaps, const version)

double* mitsuba::Bitmap::getFloat64Data ( )
inline

Access the underlying raster data (for float64 bitmaps)

const double* mitsuba::Bitmap::getFloat64Data ( ) const
inline

Access the underlying raster data (for float64 bitmaps, const version)

Float* mitsuba::Bitmap::getFloatData ( )
inline

Access the underlying raster data (for float32/float64 bitmaps)

const Float* mitsuba::Bitmap::getFloatData ( ) const
inline

Access the underlying raster data (for float/float64 bitmaps, const version)

Float mitsuba::Bitmap::getGamma ( ) const
inline

Return the bitmap's gamma identifier (-1: sRGB)

int mitsuba::Bitmap::getHeight ( ) const
inline

Return the bitmap's height in pixels.

std::vector<Layer> mitsuba::Bitmap::getLayers ( ) const

Extracts layer information from the bitmap.

This is a convenience function which analyzes the bitmap's channel names and extracts groups matching a name convention specified by the OpenEXR standard.

A series of channel names referred to as 'diffuse.R', 'diffuse.B', and 'diffuse.G' will be identified as a single layer. This works for RGB[A]/XYZ[A], and Luminance[A] images

Properties& mitsuba::Bitmap::getMetadata ( )
inline

Return a Properties object containing the image metadata.

const Properties& mitsuba::Bitmap::getMetadata ( ) const
inline

Return a Properties object containing the image metadata (const version)

std::string mitsuba::Bitmap::getMetadataString ( const std::string &  key) const
inline

Return a string-valued metadata field.

Spectrum mitsuba::Bitmap::getPixel ( const Point2i pos) const

Return the spectral color value associated with a given pixel.

When this is not a spectrum image, conversions are applied as appropriate.

Remarks
This function is provided here for convenience and debugging purposes. Its use is discouraged, particularly for performance critical code (direct buffer access will be faster by at least an order of magnitude)
size_t mitsuba::Bitmap::getPixelCount ( ) const
inline

Return the total number of pixels.

EPixelFormat mitsuba::Bitmap::getPixelFormat ( ) const
inline

Return the pixel format of this bitmap.

const Vector2i& mitsuba::Bitmap::getSize ( ) const
inline

Return the bitmap's resolution in pixels.

uint16_t* mitsuba::Bitmap::getUInt16Data ( )
inline

Access the underlying raster data (for uint16 bitmaps)

const uint16_t* mitsuba::Bitmap::getUInt16Data ( ) const
inline

Access the underlying raster data (for uint16 bitmaps, const version)

uint32_t* mitsuba::Bitmap::getUInt32Data ( )
inline

Access the underlying raster data (for uint32 bitmaps)

const uint32_t* mitsuba::Bitmap::getUInt32Data ( ) const
inline

Access the underlying raster data (for uint32 bitmaps, const version)

uint8_t* mitsuba::Bitmap::getUInt8Data ( )
inline

Access the underlying raster (for uint8 bitmaps)

const uint8_t* mitsuba::Bitmap::getUInt8Data ( ) const
inline

Access the underlying bit raster (for uint8 bitmaps, const version)

int mitsuba::Bitmap::getWidth ( ) const
inline

Return the bitmap's width in pixels.

bool mitsuba::Bitmap::hasAlpha ( ) const
inline

Return whether this image has an alpha channel.

bool mitsuba::Bitmap::hasWeight ( ) const
inline

Return whether this image has a weight channel.

bool mitsuba::Bitmap::isMultiChannel ( ) const
inline

Return whether this is a generic multi-channel image.

bool mitsuba::Bitmap::isSquare ( ) const
inline

Return whether this image has matching width and height.

static ref<Bitmap> mitsuba::Bitmap::join ( EPixelFormat  fmt,
const std::vector< Bitmap * > &  sourceBitmaps 
)
static

Merges multiple bitmaps of the same type and resolution into one with a larger number of channels.

Parameters
fmtThe desired pixel format of the combined bitmap
sourceBitmapsAn array containing the input bitmaps They must all be of the same size and component format.
Returns
A newly created bitmap containing all input images as color channels
bool mitsuba::Bitmap::operator!= ( const Bitmap bitmap) const
inline

Bitmap inequality operator (useful for unit-tests etc.)

bool mitsuba::Bitmap::operator== ( const Bitmap bitmap) const

Bitmap equality operator (useful for unit-tests etc.)

void mitsuba::Bitmap::pow ( Float  value)

Raise the entire image to a certain value.

Skips the image's alpha channel, if it has one. When the image uses a fixed point representation and a pixel value overflows during the scale operation, it is clamped to the representable range.

void mitsuba::Bitmap::readBMP ( Stream stream)
protected

Read a file stored using the BMP file format.

void mitsuba::Bitmap::readJPEG ( Stream stream)
protected

Read a file stored using the JPEG file format.

void mitsuba::Bitmap::readOpenEXR ( Stream stream,
const std::string &  prefix 
)
protected

Read a file stored using the OpenEXR file format.

void mitsuba::Bitmap::readPFM ( Stream stream)
protected

Read a file stored using the PFM file format.

void mitsuba::Bitmap::readPNG ( Stream stream)
protected

Read a file stored using the PNG file format.

void mitsuba::Bitmap::readPPM ( Stream stream)
protected

Read a file stored using the PPM file format.

void mitsuba::Bitmap::readRGBE ( Stream stream)
protected

Read a file stored using the RGBE file format.

void mitsuba::Bitmap::readStream ( EFileFormat  format,
Stream stream,
const std::string &  prefix 
)
protected

Delegate for stream loading operations.

void mitsuba::Bitmap::readTGA ( Stream stream)
protected

Read a file stored using the TGA file format.

void mitsuba::Bitmap::resample ( const ReconstructionFilter rfilter,
ReconstructionFilter::EBoundaryCondition  bch,
ReconstructionFilter::EBoundaryCondition  bcv,
Bitmap target,
Bitmap temp = NULL,
Float  minValue = 0.0f,
Float  maxValue = 1.0f 
) const

Up- or down-sample this image to a different resolution.

Uses the provided reconstruction filter and observes the specified horizontal and vertical boundary conditions when looking up data outside of the input domain.

A maximum and maximum image value can be specified to prevent to prevent out-of-range values that are created by the resampling process.

The optional 'temp' parameter can be used to pass an image of resolution Vector2i(target->getWidth(), this->getHeight()) to avoid intermediate memory allocations.

ref<Bitmap> mitsuba::Bitmap::resample ( const ReconstructionFilter rfilter,
ReconstructionFilter::EBoundaryCondition  bch,
ReconstructionFilter::EBoundaryCondition  bcv,
const Vector2i size,
Float  minValue = 0.0f,
Float  maxValue = 1.0f 
) const

Up- or down-sample this image to a different resolution.

Uses the provided reconstruction filter and observes the specified horizontal and vertical boundary conditions when looking up data outside of the input domain.

A maximum and maximum image value can be specified to prevent to prevent out-of-range values that are created by the resampling process.

This function allocates a new output image and returns it.

ref<Bitmap> mitsuba::Bitmap::rotateFlip ( ERotateFlipType  type) const

Perform the specified rotatation & flip operation.

void mitsuba::Bitmap::scale ( Float  value)

Scale the entire image by a certain value.

Skips the image's alpha channel, if it has one. When the image uses a fixed point representation and a pixel value overflows during the scale operation, it is clamped to the representable range.

void mitsuba::Bitmap::setChannelNames ( const std::vector< std::string > &  names)

Explicitly set the names of the image channels.

The main use of this feature is when writing EMultiChannel images to OpenEXR files. In other cases, the names are ignored.

void mitsuba::Bitmap::setGamma ( Float  gamma)
inline

Set the bitmap's gamma identifier (-1: sRGB)

void mitsuba::Bitmap::setMetadata ( const Properties metadata)
inline

Set the a Properties object containing the image metadata.

void mitsuba::Bitmap::setMetadataString ( const std::string &  key,
const std::string &  value 
)
inline

Set a string-valued metadata field.

void mitsuba::Bitmap::setPixel ( const Point2i pos,
const Spectrum value 
)

Set the spectral color value associated with a given pixel.

When this is not a spectrum image, conversions are applied as appropriate.

Remarks
This function is provided here for convenience and debugging purposes. Its use is discouraged, particularly for performance critical code (direct buffer access will be faster by at least order of magnitude)
std::map<std::string, Bitmap *> mitsuba::Bitmap::split ( ) const

Split an multi-channel image buffer (e.g. from an OpenEXR image with lots of AOVs) into its constituent layers.

This operation internally calls getLayers() to extract bitmap layers followed by one or more calls to extractChannels()

static void mitsuba::Bitmap::staticInitialization ( )
static

Run static initialization code (sets up OpenEXR for multithreading)

static void mitsuba::Bitmap::staticShutdown ( )
static

Release any resources allocated in staticInitialization.

void mitsuba::Bitmap::tonemapReinhard ( Float logAvgLuminance,
Float maxLuminance,
Float  key,
Float  burn 
)

Apply Reinhard et al's tonemapper in chromaticity space.

This function

  1. Computes and stores the maximum and log-average luminance of the image If the logAvgLuminace and maxLuminance parameters are nonzero, it is assumed that these have already been computed, and this step is omitted. Explicitly specifying them can be useful to prevent flickering when tonemapping multiple frames of an animation.

  2. Converts the image to xyY, applies Reinhard's photographic tonemapper in this space, and then transforms the result back to its original representation (i.e. RGB or XYZ). The global version of the tonemapping algorithm is used (i.e. the one without automatic dodging and burning).

The key parameter specifies whether a low-key or high-key image is desired. The value must be in the interval [0,1]. A good starting point is a middle-grey, i.e. key=0.18.

When burn=0, the entire image is re-mapped into the displayable range. This may not always be desireable – for instance, one might choose to let a highlight burn out, and this is achieved by choosing burn in (0, 1].

For reference, see "Photographic Tone Reproduction for Digital Images" by Erik Reinhard, Michael Stark, Peter Shirley, and James Fewerda, in ACM Transactions on Graphics 2002, Vol. 21, 3

Remarks
The implementation assumes that the image has a RGB(A), XYZ(A), or Luminance(Alpha) pixel format, that gamma=1, and that it uses a EFloat16/EFloat32/EFloat64 component format. The conversion process is destructive in the sense that it overwrites the original image.
In the Python bindings, the signature of this function is: (logAvgLuminance, maxLuminance) = tonemapReinhard(logAvgLuminance, maxLuminance, key, burn)
std::string mitsuba::Bitmap::toString ( ) const
virtual

Return some human-readable information about this bitmap.

Reimplemented from Object.

void mitsuba::Bitmap::updateChannelCount ( )
protected

Update the internally cached channel count.

void mitsuba::Bitmap::write ( EFileFormat  format,
Stream stream,
int  compression = -1 
) const

Write an encoded form of the bitmap to a stream using the specified file format

Parameters
formatTarget file format (EOpenEXR, EPNG, or EOpenEXR)
streamTarget stream that will receive the encoded output
compressionFor PNG images, this parameter can be used to control how strongly libpng will try to compress the output (with 1 being the lowest and 9 denoting the highest compression). Note that saving files with the highest compression will be very slow. For JPEG files, this denotes the desired quality (between 0 and 100, the latter being best). The default argument (-1) uses compression 5 for PNG and 100 for JPEG files.
void mitsuba::Bitmap::write ( EFileFormat  format,
const fs::path &  filename,
int  compression = -1 
) const

Write an encoded form of the bitmap to a file using the specified file format

Parameters
formatTarget file format (EOpenEXR, EPNG, or EOpenEXR)
streamTarget stream that will receive the encoded output
compressionFor PNG images, this parameter can be used to control how strongly libpng will try to compress the output (with 1 being the lowest and 9 denoting the highest compression). Note that saving files with the highest compression will be very slow. For JPEG files, this denotes the desired quality (between 0 and 100, the latter being best). The default argument (-1) uses compression 5 for PNG and 100 for JPEG files.
void mitsuba::Bitmap::write ( const fs::path &  filename,
int  compression = -1 
) const

Write an encoded form of the bitmap to a file (auto-detecting the file format)

Parameters
streamTarget stream that will receive the encoded output
compressionFor PNG images, this parameter can be used to control how strongly libpng will try to compress the output (with 1 being the lowest and 9 denoting the highest compression). Note that saving files with the highest compression will be very slow. For JPEG files, this denotes the desired quality (between 0 and 100, the latter being best). The default argument (-1) uses compression 5 for PNG and 100 for JPEG files.
void mitsuba::Bitmap::writeJPEG ( Stream stream,
int  quality = 100 
) const
protected

Save a file using the JPEG file format.

void mitsuba::Bitmap::writeOpenEXR ( Stream stream) const
protected

Write a file using the OpenEXR file format.

void mitsuba::Bitmap::writePFM ( Stream stream) const
protected

Write a file using the PFM file format.

void mitsuba::Bitmap::writePNG ( Stream stream,
int  compression 
) const
protected

Write a file using the PNG file format.

void mitsuba::Bitmap::writePPM ( Stream stream) const
protected

Write a file using the PPM file format.

void mitsuba::Bitmap::writeRGBE ( Stream stream) const
protected

Write a file using the RGBE file format.

Member Data Documentation

uint8_t mitsuba::Bitmap::m_channelCount
protected
std::vector<std::string> mitsuba::Bitmap::m_channelNames
protected
EComponentFormat mitsuba::Bitmap::m_componentFormat
protected
uint8_t* mitsuba::Bitmap::m_data
protected
Float mitsuba::Bitmap::m_gamma
protected
Properties mitsuba::Bitmap::m_metadata
protected
bool mitsuba::Bitmap::m_ownsData
protected
EPixelFormat mitsuba::Bitmap::m_pixelFormat
protected
Vector2i mitsuba::Bitmap::m_size
protected
Class* mitsuba::Bitmap::m_theClass
static

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