Nori  23
ImageBlock Class Reference

Weighted pixel storage for a rectangular subregion of an image. More...

#include <block.h>

Inheritance diagram for ImageBlock:
Collaboration diagram for ImageBlock:

Public Member Functions

 ImageBlock (const Vector2i &size, const ReconstructionFilter *filter)
 
 ~ImageBlock ()
 Release all memory.
 
void init (const Vector2i &size, const ReconstructionFilter *filter)
 
void setOffset (const Point2i &offset)
 Configure the offset of the block within the main image.
 
const Point2igetOffset () const
 Return the offset of the block within the main image.
 
void setSize (const Point2i &size)
 Configure the size of the block within the main image.
 
const Vector2igetSize () const
 Return the size of the block within the main image.
 
int getBorderSize () const
 Return the border size in pixels.
 
uint32_t getBlockId () const
 
void setBlockId (uint32_t id)
 
BitmaptoBitmap () const
 Turn the block into a proper bitmap. More...
 
void fromBitmap (const Bitmap &bitmap)
 Convert a bitmap into an image block.
 
void clear ()
 Clear all contents.
 
void put (const Point2f &pos, const Color3f &value)
 Record a sample with the given position and radiance value.
 
void put (ImageBlock &b)
 Merge another image block into this one. More...
 
void lock () const
 Lock the image block (using an internal mutex)
 
void unlock () const
 Unlock the image block.
 
std::string toString () const
 Return a human-readable string summary.
 

Protected Attributes

Point2i m_offset
 
Vector2i m_size
 
int m_borderSize = 0
 
float * m_filter = nullptr
 
float m_filterRadius = 0
 
float * m_weightsX = nullptr
 
float * m_weightsY = nullptr
 
float m_lookupFactor = 0
 
uint32_t m_blockId
 
tbb::mutex m_mutex
 

Detailed Description

Weighted pixel storage for a rectangular subregion of an image.

This class implements storage for a rectangular subregion of a larger image that is being rendered. For each pixel, it records color values along with a weight that specifies the accumulated influence of nearby samples on the pixel (according to the used reconstruction filter).

When rendering with filters, the samples in a rectangular region will generally also contribute to pixels just outside of this region. For that reason, this class also stores information about a small border region around the rectangle, whose size depends on the properties of the reconstruction filter.

Definition at line 48 of file block.h.

Constructor & Destructor Documentation

◆ ImageBlock()

NORI_NAMESPACE_BEGIN ImageBlock::ImageBlock ( const Vector2i size,
const ReconstructionFilter filter 
)

Create a new image block of the specified maximum size

Parameters
sizeDesired maximum size of the block
filterSamples will be convolved with the image reconstruction filter provided here.

Definition at line 27 of file block.cpp.

Member Function Documentation

◆ put()

void ImageBlock::put ( ImageBlock b)

Merge another image block into this one.

During the merge operation, this function locks the destination block using a mutex.

Definition at line 124 of file block.cpp.

◆ toBitmap()

Bitmap * ImageBlock::toBitmap ( ) const

Turn the block into a proper bitmap.

This entails normalizing all pixels and discarding the border region.

Definition at line 76 of file block.cpp.


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