HDK
 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:

Classes

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 getFilters (UT_Array< const Factory * > &filters)
 Get a list of all the filters. More...
 
static TIL_RasterFilterPtr allocFilter (const UT_StringRef &name)
 

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.

Examples:
IMG/TIL_RadeonFilter.h.

Definition at line 52 of file TIL_RasterFilter.h.

Member Typedef Documentation

Constructor & Destructor Documentation

TIL_RasterFilter::TIL_RasterFilter ( )
inline

Constructor/Destructor

Definition at line 68 of file TIL_RasterFilter.h.

virtual TIL_RasterFilter::~TIL_RasterFilter ( )
inlinevirtual

Constructor/Destructor

Definition at line 69 of file TIL_RasterFilter.h.

Member Function Documentation

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

Returns false if fail.

Implemented in TIL_RadeonFilter.

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

For debugging.

Implemented in TIL_RadeonFilter.

const UT_StringArray& TIL_RasterFilter::getAuxPlaneNames ( ) const
inline

Get the list of aux plane names.

Definition at line 118 of file TIL_RasterFilter.h.

const UT_StringHolder& TIL_RasterFilter::getErrorString ( ) const
inline

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

Definition at line 123 of file TIL_RasterFilter.h.

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

Get a list of all the filters.

virtual bool TIL_RasterFilter::isInteractive ( ) const
inlinevirtual

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

Reimplemented in TIL_RadeonFilter.

Definition at line 128 of file TIL_RasterFilter.h.

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

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

Examples:
IMG/TIL_RadeonFilter.C.
virtual void TIL_RasterFilter::reset ( void  )
inlinevirtual

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

Definition at line 112 of file TIL_RasterFilter.h.

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

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 101 of file TIL_RasterFilter.h.

virtual bool TIL_RasterFilter::setOptions ( const UT_Options options)
inlinevirtual

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_RadeonFilter.

Definition at line 94 of file TIL_RasterFilter.h.

Member Data Documentation

UT_StringArray TIL_RasterFilter::myAuxPlaneNames
protected
Examples:
IMG/TIL_RadeonFilter.C.

Definition at line 131 of file TIL_RasterFilter.h.

UT_StringMap<const PXL_Raster *> TIL_RasterFilter::myAuxPlanes
protected
Examples:
IMG/TIL_RadeonFilter.C.

Definition at line 132 of file TIL_RasterFilter.h.

UT_StringHolder TIL_RasterFilter::myErrorString
protected
Examples:
IMG/TIL_RadeonFilter.C.

Definition at line 133 of file TIL_RasterFilter.h.


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