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

#include <IMG_TileDevice.h>

+ Inheritance diagram for IMG_TileDevice:

Public Types

enum  IMG_TILE_ORDER { IMG_TILE_BOTTOM_FIRST = 0, IMG_TILE_RANDOM_ORDER = 1, IMG_TILE_TOP_FIRST = 2, IMG_TILE_HILBERT = 3 }
 
typedef IMG_TileDevice *(* IMG_TileDeviceCreator )(const char *filename, const UT_Options *options)
 

Public Member Functions

 IMG_TileDevice ()
 
virtual ~IMG_TileDevice ()
 
void setVisibleRegion (int l, int r, int b, int t)
 
void setRenderSize (int rwidth, int rheight)
 
void setDeviceDataWindow (const UT_DimRect &w)
 Set the data window. More...
 
void setDeviceRenderWindow (const UT_DimRect &w)
 
virtual int open (const IMG_TileOptions &info, int xres, int yres, int tile_device, int tile_height, fpreal aspect)=0
 Open the device. More...
 
virtual int openMulti (IMG_TileOptionList &flist, int xres, int yres, int tile_width, int tile_height, fpreal aspect)
 
virtual void setWhitePoint (fpreal white)
 
virtual void checkpoint ()
 
void setRenderSourceName (const char *name)
 
const char * getRenderSourceName () const
 
int getFileCount () const
 
IMG_DataType getDataType (int idx=0) const
 
bool isRandomAccess () const
 
int getTileWidth () const
 Query tile width parameters. More...
 
int getTileHeight () const
 
int getTileCountX () const
 
int getTileCountY () const
 
IMG_ColorModel getColorModel (int idx=0) const
 
IMG_DataTypegetDataTypes ()
 
IMG_ColorModelgetColorModels ()
 
virtual void writeCustomTag (const char *tagname, int size, const char *const *values)
 
void writeKnownTag (IMG_TagType tag_id, int size, const char *const *values)
 
virtual int writeTile (const void *data, unsigned x0, unsigned x1, unsigned y0, unsigned y1)=0
 
virtual bool writeSamples (int nsamples, int floats_per_sample, const UT_Vector3T< int > *samples, const float *data)
 
virtual void flush ()
 
virtual int close (bool keep_alive=false)=0
 
virtual int unsafeFlush ()
 
virtual bool getNextTile (int &xl, int &xr, int &yb, int &yt, int &tx, int &ty)
 
virtual bool getClickedTile (int &tx, int &ty, float &radius) const
 
virtual void resetTileRequestor ()
 
virtual int getTileMode () const
 
virtual void terminateOnConnectionLost (bool)
 
virtual bool wantsHoudiniPort () const
 
virtual bool isInteractive () const
 
virtual void setStyleSheets (UT_StringArray &)
 
virtual bool getMouseClickPosition (int &x, int &y) const
 
virtual float getMouseClickRadius () const
 
virtual const char * className () const =0
 
virtual void getDescription (UT_WorkBuffer &wbuf) const
 
int xres () const
 
int yres () const
 

Static Public Member Functions

static IMG_TileDevicenewDevice (const char *filename, const UT_Options *options=NULL)
 
static bool isSpecialFileName (const char *filename)
 
static bool isNullDeviceName (const char *filename)
 
static void registerDevice (IMG_TileDeviceCreator creator, const char *label)
 
static void unregisterDevice (const char *label)
 Unregister a custom device. More...
 
static IMG_TileDevicenewFileDevice ()
 
static IMG_TileDevicenewNullDevice ()
 
static IMG_TileDevicenewMPlayDevice (int from_middle=1)
 
static IMG_TileDeviceimdisplayFileDevice (const char *filename)
 
static IMG_TileDevicenewSocketDevice (const char *host)
 
static void setFileDevCreator (IMG_TileDevice *(*creator)())
 
static void setMPlayDevCreator (IMG_TileDevice *(*creator)(int))
 

Protected Member Functions

void setResolution (int xres, int yres, int tilewidth, int tileheight, int tile_order=IMG_TILE_BOTTOM_FIRST)
 
void setModel (const IMG_TileOptions &finfo)
 
void setModel (IMG_TileOptionList &flist)
 
void setModel (const IMG_DataType *dt, const IMG_ColorModel *cm)
 
void mapImageToTile (int ix, int iy, int &tx, int &ty)
 
void getTileBounds (int tx, int ty, int &xl, int &xr, int &yb, int &yt)
 
bool hasDataWindow (int full_xres, int full_yres) const
 
int getDataX () const
 
int getDataY () const
 
int getDataWidth () const
 
int getDataHeight () const
 
void setTileOrder (IMG_TILE_ORDER tile_order)
 Specify the desired tile order. More...
 
void setFileCount (int count)
 In the open method, the sub-class should set the file count. More...
 
void setTileSize (int width, int height)
 Set the tile width. More...
 
UT_InclusiveRect getDataWindow () const
 
const UT_DimRectdataWindow () const
 
const UT_DimRectdisplayWindow () const
 
const UT_DimRectrenderWindow () const
 

Detailed Description

Examples:
standalone/tiledevice.C.

Definition at line 34 of file IMG_TileDevice.h.

Member Typedef Documentation

typedef IMG_TileDevice*(* IMG_TileDevice::IMG_TileDeviceCreator)(const char *filename, const UT_Options *options)

Definition at line 47 of file IMG_TileDevice.h.

Member Enumeration Documentation

Enumerator
IMG_TILE_BOTTOM_FIRST 
IMG_TILE_RANDOM_ORDER 
IMG_TILE_TOP_FIRST 
IMG_TILE_HILBERT 

Definition at line 39 of file IMG_TileDevice.h.

Constructor & Destructor Documentation

IMG_TileDevice::IMG_TileDevice ( )
virtual IMG_TileDevice::~IMG_TileDevice ( )
virtual

Member Function Documentation

virtual void IMG_TileDevice::checkpoint ( )
virtual

Allow the device to perform any "checkpointing" needed. This is equivalent to "flushing" the device.

Reimplemented in IMG_TileFile.

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

Query information about the tile device

Implemented in IMG_TileFile, TIL_TileMPlay, and IMG_TileSocket.

virtual int IMG_TileDevice::close ( bool  keep_alive = false)
pure virtual

Implemented in IMG_TileFile, TIL_TileMPlay, and IMG_TileSocket.

const UT_DimRect& IMG_TileDevice::dataWindow ( ) const
inlineprotected

Accessors to data, display render windows

Definition at line 332 of file IMG_TileDevice.h.

const UT_DimRect& IMG_TileDevice::displayWindow ( ) const
inlineprotected

Accessors to data, display render windows

Definition at line 333 of file IMG_TileDevice.h.

virtual void IMG_TileDevice::flush ( )
virtual

Reimplemented in TIL_TileMPlay.

Examples:
standalone/tiledevice.C.
virtual bool IMG_TileDevice::getClickedTile ( int tx,
int ty,
float &  radius 
) const
virtual
IMG_ColorModel IMG_TileDevice::getColorModel ( int  idx = 0) const
IMG_ColorModel* IMG_TileDevice::getColorModels ( )
inline

Definition at line 172 of file IMG_TileDevice.h.

int IMG_TileDevice::getDataHeight ( ) const
inlineprotected

Definition at line 314 of file IMG_TileDevice.h.

IMG_DataType IMG_TileDevice::getDataType ( int  idx = 0) const
IMG_DataType* IMG_TileDevice::getDataTypes ( )
inline

Definition at line 171 of file IMG_TileDevice.h.

int IMG_TileDevice::getDataWidth ( ) const
inlineprotected

Definition at line 313 of file IMG_TileDevice.h.

UT_InclusiveRect IMG_TileDevice::getDataWindow ( ) const
protected
int IMG_TileDevice::getDataX ( ) const
inlineprotected

Definition at line 311 of file IMG_TileDevice.h.

int IMG_TileDevice::getDataY ( ) const
inlineprotected

Definition at line 312 of file IMG_TileDevice.h.

virtual void IMG_TileDevice::getDescription ( UT_WorkBuffer wbuf) const
virtual

Query information about the tile device

Reimplemented in IMG_TileFile, TIL_TileMPlay, and IMG_TileSocket.

int IMG_TileDevice::getFileCount ( ) const
inline

After the open() is called, then it's possible to query the data type that the device expects.

Definition at line 158 of file IMG_TileDevice.h.

virtual bool IMG_TileDevice::getMouseClickPosition ( int x,
int y 
) const
inlinevirtual

Subclasses can override this method if they respond to mouse clicks. x and y should be set to the mouse position (in pixels) if the mouse has been clicked. The method returns true if the mouse has been clicked; otherwise, false. If the method returns false then the values of x and y are undefined.

Reimplemented in TIL_TileMPlay.

Definition at line 284 of file IMG_TileDevice.h.

virtual float IMG_TileDevice::getMouseClickRadius ( ) const
inlinevirtual

Subclasses can override this method if they respond to mouse clicks and specify a radius for the click.

Reimplemented in TIL_TileMPlay.

Definition at line 289 of file IMG_TileDevice.h.

virtual bool IMG_TileDevice::getNextTile ( int xl,
int xr,
int yb,
int yt,
int tx,
int ty 
)
virtual

The renderer will ask us for the next tile location to be rendered. We give it the location (in renderable region coordinates). The function returns true if this is a valid tile, otherwise false. The tile mode maps to the enum of bottom/top first or random order. (tx,ty) will be the unique tile index tuple, between (0,0) inclusive and (myTileCountX,myTileCountY) exclusive.

NOTE: xl, xr, yb, and yt, are all inclusive! Also, xl <= yr and yb <= yt if the return value is true, i.e. at least one pixel.

const char* IMG_TileDevice::getRenderSourceName ( ) const
inline

Definition at line 153 of file IMG_TileDevice.h.

void IMG_TileDevice::getTileBounds ( int  tx,
int  ty,
int xl,
int xr,
int yb,
int yt 
)
protected
int IMG_TileDevice::getTileCountX ( ) const
inline

Definition at line 165 of file IMG_TileDevice.h.

int IMG_TileDevice::getTileCountY ( ) const
inline

Definition at line 166 of file IMG_TileDevice.h.

int IMG_TileDevice::getTileHeight ( ) const
inline

Definition at line 164 of file IMG_TileDevice.h.

virtual int IMG_TileDevice::getTileMode ( ) const
virtual
int IMG_TileDevice::getTileWidth ( ) const
inline

Query tile width parameters.

Definition at line 163 of file IMG_TileDevice.h.

bool IMG_TileDevice::hasDataWindow ( int  full_xres,
int  full_yres 
) const
protected
static IMG_TileDevice* IMG_TileDevice::imdisplayFileDevice ( const char *  filename)
static

Static methods to allocate new devices of built-in device types

virtual bool IMG_TileDevice::isInteractive ( ) const
inlinevirtual

If this tile device is interactive (i.e. a flipbook), this method should return true. When mantra runs in batch-mode, opening an interactive device will fail.

Reimplemented in TIL_TileMPlay.

Definition at line 267 of file IMG_TileDevice.h.

static bool IMG_TileDevice::isNullDeviceName ( const char *  filename)
static

Returns true if filename represents a null device, i.e. it will ignore everything sent to it. This is useful for avoiding work that will be ignored.

bool IMG_TileDevice::isRandomAccess ( ) const
inline

Definition at line 160 of file IMG_TileDevice.h.

static bool IMG_TileDevice::isSpecialFileName ( const char *  filename)
static

Returns true if filename represents a special device, not a regular file, i.e. everything that newDevice has a special case for.

void IMG_TileDevice::mapImageToTile ( int  ix,
int  iy,
int tx,
int ty 
)
protected
static IMG_TileDevice* IMG_TileDevice::newDevice ( const char *  filename,
const UT_Options options = NULL 
)
static

Create a new device based on the filename. This checks:

  • "null:" - Null device
  • "imdisplay:" - MPlay device
  • etc. If no devices match exactly, the file device will be opened.
Examples:
standalone/tiledevice.C.
static IMG_TileDevice* IMG_TileDevice::newFileDevice ( )
static

Static methods to allocate new devices of built-in device types

static IMG_TileDevice* IMG_TileDevice::newMPlayDevice ( int  from_middle = 1)
static

Static methods to allocate new devices of built-in device types

static IMG_TileDevice* IMG_TileDevice::newNullDevice ( )
static

Static methods to allocate new devices of built-in device types

static IMG_TileDevice* IMG_TileDevice::newSocketDevice ( const char *  host)
static

Static methods to allocate new devices of built-in device types

virtual int IMG_TileDevice::open ( const IMG_TileOptions info,
int  xres,
int  yres,
int  tile_device,
int  tile_height,
fpreal  aspect 
)
pure virtual

Open the device.

Implemented in IMG_TileFile, TIL_TileMPlay, and IMG_TileSocket.

virtual int IMG_TileDevice::openMulti ( IMG_TileOptionList flist,
int  xres,
int  yres,
int  tile_width,
int  tile_height,
fpreal  aspect 
)
virtual

The default implementation will just open the first entry of the flist by calling open().

Reimplemented in IMG_TileFile, and TIL_TileMPlay.

Examples:
standalone/tiledevice.C.
static void IMG_TileDevice::registerDevice ( IMG_TileDeviceCreator  creator,
const char *  label 
)
static

Register a custom image device. The label should be specified without the colon (':'). For example:

registerDevice(createSocket, "socket");

The creator function will be called from newDevice() with the filename/options passed. newDevice() will invoke the creator if the filename begins with the label. For example, the following would invoke the socket device registered above:

newDevice("socket:{'port':43}", NULL);
Note
This will replace any existing device
const UT_DimRect& IMG_TileDevice::renderWindow ( ) const
inlineprotected

Accessors to data, display render windows

Definition at line 334 of file IMG_TileDevice.h.

virtual void IMG_TileDevice::resetTileRequestor ( )
virtual
void IMG_TileDevice::setDeviceDataWindow ( const UT_DimRect w)
inline

Set the data window.

Definition at line 118 of file IMG_TileDevice.h.

void IMG_TileDevice::setDeviceRenderWindow ( const UT_DimRect w)
inline

Set the window of pixels that need to be rendered The render window is always bigger or equal to the data window. It might be larger due to pixel filters (i.e. samples outside the data window might need to be computed for filtering). The difference between the data window and the render window size is used to determine filter width.

Definition at line 127 of file IMG_TileDevice.h.

void IMG_TileDevice::setFileCount ( int  count)
inlineprotected

In the open method, the sub-class should set the file count.

Definition at line 321 of file IMG_TileDevice.h.

static void IMG_TileDevice::setFileDevCreator ( IMG_TileDevice *(*)()  creator)
static

Replace the creators for the file or mplay devices.

Note
The signatures for the constructors are different than the callbacks uses in registerDevice().
void IMG_TileDevice::setModel ( const IMG_TileOptions finfo)
protected
void IMG_TileDevice::setModel ( IMG_TileOptionList flist)
protected
void IMG_TileDevice::setModel ( const IMG_DataType dt,
const IMG_ColorModel cm 
)
protected
static void IMG_TileDevice::setMPlayDevCreator ( IMG_TileDevice *(*)(int creator)
static

Replace the creators for the file or mplay devices.

Note
The signatures for the constructors are different than the callbacks uses in registerDevice().
Examples:
standalone/tiledevice.C.
void IMG_TileDevice::setRenderSize ( int  rwidth,
int  rheight 
)
void IMG_TileDevice::setRenderSourceName ( const char *  name)
inline

Definition at line 151 of file IMG_TileDevice.h.

void IMG_TileDevice::setResolution ( int  xres,
int  yres,
int  tilewidth,
int  tileheight,
int  tile_order = IMG_TILE_BOTTOM_FIRST 
)
protected
virtual void IMG_TileDevice::setStyleSheets ( UT_StringArray )
inlinevirtual

Reimplemented in TIL_TileMPlay.

Definition at line 277 of file IMG_TileDevice.h.

void IMG_TileDevice::setTileOrder ( IMG_TILE_ORDER  tile_order)
inlineprotected

Specify the desired tile order.

Definition at line 317 of file IMG_TileDevice.h.

void IMG_TileDevice::setTileSize ( int  width,
int  height 
)
protected

Set the tile width.

void IMG_TileDevice::setVisibleRegion ( int  l,
int  r,
int  b,
int  t 
)
virtual void IMG_TileDevice::setWhitePoint ( fpreal  white)
virtual

Reimplemented in TIL_TileMPlay.

virtual void IMG_TileDevice::terminateOnConnectionLost ( bool  )
inlinevirtual

Reimplemented in TIL_TileMPlay.

Definition at line 258 of file IMG_TileDevice.h.

static void IMG_TileDevice::unregisterDevice ( const char *  label)
static

Unregister a custom device.

virtual int IMG_TileDevice::unsafeFlush ( )
virtual
virtual bool IMG_TileDevice::wantsHoudiniPort ( ) const
inlinevirtual

Reimplemented in TIL_TileMPlay.

Definition at line 262 of file IMG_TileDevice.h.

virtual void IMG_TileDevice::writeCustomTag ( const char *  tagname,
int  size,
const char *const values 
)
virtual

Reimplemented in IMG_TileFile, and TIL_TileMPlay.

void IMG_TileDevice::writeKnownTag ( IMG_TagType  tag_id,
int  size,
const char *const values 
)
inline

Definition at line 180 of file IMG_TileDevice.h.

virtual bool IMG_TileDevice::writeSamples ( int  nsamples,
int  floats_per_sample,
const UT_Vector3T< int > *  samples,
const float *  data 
)
inlinevirtual

This is just for sending sample data from Mantra to Houdini via TIL_TileMPlay. data contains nsamples tuples of floats_per_sample floats samples contains nsamples (x,y,pixel_sample) tuples

Reimplemented in TIL_TileMPlay.

Definition at line 218 of file IMG_TileDevice.h.

virtual int IMG_TileDevice::writeTile ( const void data,
unsigned  x0,
unsigned  x1,
unsigned  y0,
unsigned  y1 
)
pure virtual

The data written is in the format specified by the IMG_ColorModel and IMG_DataType parameters in the open. The size of the tile is smaller or equal to the sizes specified in the open. If the device was opened using openMulti(), the data is provided as a sequence of planes - first all pixels for plane 0, then all pixels for plane 1, etc.

The rectangle spectified by x0, x1, y0 and y1 is an inclusive rectangle. That is, the number of pixels in data is: (x1-x0+1)*(y1-y0+1).

The first pixel in the data buffer is the bottom left corner of the tile (i.e. (x0,y0)).

The rectangle specified is also relative to the data window. So, to offset to get the absolute pixel location you need to take the data window (getDataWindow()) into account. You can also use the convenience methods getDataX() and getDataY(). For example:

unsigned pixel_x0 = x0 + getDataX();
unsigned pixel_x1 = x1 + getDataX();
unsigned pixel_y0 = y0 + getDataY();
unsigned pixel_y1 = y1 + getDataY();

Implemented in IMG_TileFile, TIL_TileMPlay, and IMG_TileSocket.

Examples:
standalone/tiledevice.C.
int IMG_TileDevice::xres ( ) const
inline

Accessor

Definition at line 271 of file IMG_TileDevice.h.

int IMG_TileDevice::yres ( ) const
inline

Accessor

Definition at line 272 of file IMG_TileDevice.h.


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