All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TIL_RasterFilter Class Referenceabstract

#include <TIL_RasterFilter.h>

+ Inheritance diagram for TIL_RasterFilter:


struct  Factory
 The factory to define a filter. More...

Public Types

using TIL_RasterFilterPtr = UT_UniquePtr< TIL_RasterFilter >

Public Member Functions

virtual const char * className () const =0
 For debugging. More...
virtual bool setOptions (const UT_Options &options)
void setAuxPlane (const UT_StringHolder &planename, const PXL_Raster *raster)
virtual bool apply (PXL_Raster *raster)=0
 Returns false if fail. More...
virtual void reset ()
const UT_StringArraygetAuxPlaneNames () const
 Get the list of aux plane names. More...
const UT_StringHoldergetErrorString () const
virtual bool isInteractive () const
 TIL_RasterFilter ()
virtual ~TIL_RasterFilter ()

Static Public Member Functions

static void registerFactory (UT_UniquePtr< Factory > factory)
static void removeFactory (const UT_StringRef &name)
 Remove a factory from the list. More...
static void getFilters (UT_Array< const Factory * > &filters)
 Get a list of all the filters. More...
static TIL_RasterFilterPtr allocFilter (const UT_StringRef &name)
static const UT_StringHolderalbedoToken ()
static const UT_StringHoldernormalToken ()
static const UT_StringHoldermvectorToken ()
static const UT_StringHolderprevfrToken ()

Protected Attributes

UT_StringArray myAuxPlaneNames
UT_StringMap< const PXL_Raster * > myAuxPlanes
UT_StringHolder myErrorString

Detailed Description

Apply arbitrary filters to PXL_Raster image(s).

The DSO must implement "newRasterFilter" function which should create new filters by calling TIL_RasterFilter::registerFactory(). Image filters will be searched for in $HOUDINI_DSO_PATH/img_filter.

When the filter is instantiated, the caller will initialize the filter calling setOptions. This is only called one time, though the filter may be invoked multiple times.

Prior to invoking the filter, the reset() method will be called. This lets the filter reset any information that changes from run to run.

The caller will then set up any optional read-only auxilliary rasters the filter may need for processing. That is, the caller will call setAuxPlane zero or more times.

After the filter is reset and auxilliary planes are added, the apply() method will finally be called. This should modify the raster passed in to create the resulting image. It's possible the apply() method may be called multiple times before reset() is called again.


Definition at line 53 of file TIL_RasterFilter.h.

Member Typedef Documentation

Constructor & Destructor Documentation

TIL_RasterFilter::TIL_RasterFilter ( )


Definition at line 71 of file TIL_RasterFilter.h.

virtual TIL_RasterFilter::~TIL_RasterFilter ( )


Definition at line 72 of file TIL_RasterFilter.h.

Member Function Documentation

static const UT_StringHolder& TIL_RasterFilter::albedoToken ( )

Get tokens that are used to store auxilliary planes

static TIL_RasterFilterPtr TIL_RasterFilter::allocFilter ( const UT_StringRef name)
virtual bool TIL_RasterFilter::apply ( PXL_Raster raster)
pure virtual

Returns false if fail.

Implemented in TIL_NullFilter.

virtual const char* TIL_RasterFilter::className ( ) const
pure virtual

For debugging.

Implemented in TIL_NullFilter.

const UT_StringArray& TIL_RasterFilter::getAuxPlaneNames ( ) const

Get the list of aux plane names.

Definition at line 134 of file TIL_RasterFilter.h.

const UT_StringHolder& TIL_RasterFilter::getErrorString ( ) const

Get stored error msg in case apply() fails. Sub-classes can set myErrorString to something meaningful for the caller.

Definition at line 139 of file TIL_RasterFilter.h.

static void TIL_RasterFilter::getFilters ( UT_Array< const Factory * > &  filters)

Get a list of all the filters.

virtual bool TIL_RasterFilter::isInteractive ( ) const

If the filter can run in a few milliseconds, you can try returning true.

Reimplemented in TIL_NullFilter.

Definition at line 144 of file TIL_RasterFilter.h.

static const UT_StringHolder& TIL_RasterFilter::mvectorToken ( )

Get tokens that are used to store auxilliary planes

static const UT_StringHolder& TIL_RasterFilter::normalToken ( )

Get tokens that are used to store auxilliary planes

static const UT_StringHolder& TIL_RasterFilter::prevfrToken ( )

Get tokens that are used to store auxilliary planes

static void TIL_RasterFilter::registerFactory ( UT_UniquePtr< Factory factory)

Register a new factory. Set HOUDINI_DSO_ERROR=1 to get information on why the filter might not be installed.

static void TIL_RasterFilter::removeFactory ( const UT_StringRef name)

Remove a factory from the list.

virtual void TIL_RasterFilter::reset ( void  )

Reset and get ready for a new filter. If you subclass this method, please make sure to call the base class method.

Reimplemented in TIL_NullFilter.


Definition at line 128 of file TIL_RasterFilter.h.

void TIL_RasterFilter::setAuxPlane ( const UT_StringHolder planename,
const PXL_Raster raster 

Set up an auxilliary plane. This is a raster which isn't actually modified, but is used in the filtering (for example a mask). The caller looks at the myAuxPlaneNames list to see which rasters you might require. If they are available, they will be stashed in this array.

Definition at line 117 of file TIL_RasterFilter.h.

virtual bool TIL_RasterFilter::setOptions ( const UT_Options options)

Initiaze the filter with user specified options. This method is only called once. If the filter isn't valid, the myErrorString member should be set to a meaningful error and the function should return false.

Aside from setting any specific options, this is also the time you should build myAuxPlaneNames. This lets the caller know which extra AOVs you can read from. Not all of them may exist, but this lets the caller know which planes you can look at.

Reimplemented in TIL_NullFilter.

Definition at line 110 of file TIL_RasterFilter.h.

Member Data Documentation

UT_StringArray TIL_RasterFilter::myAuxPlaneNames

Definition at line 147 of file TIL_RasterFilter.h.

UT_StringMap<const PXL_Raster *> TIL_RasterFilter::myAuxPlanes

Definition at line 148 of file TIL_RasterFilter.h.

UT_StringHolder TIL_RasterFilter::myErrorString

Definition at line 149 of file TIL_RasterFilter.h.

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