Public Member Functions

TexHandleMaker Class Reference

This reference page is linked to from the following overview topics: Porting Simple Material and Texture Map Plug-ins to Nitrous.


Search for all occurrences

Detailed Description

See also:
Class TexHandle, Class Bitmap, Class BitmapInfo.

Description:
This class provides several ways to create a texture handle. The handle may be created from a 3ds Max bitmap or a Windows Device Independent Bitmap. This class also provides methods to determine the desired size of the bitmap.

#include <imtl.h>

Inheritance diagram for TexHandleMaker:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual  ~TexHandleMaker ()
virtual TexHandle CreateHandle (Bitmap *bm, int symflags=0, int extraFlags=0)=0
virtual TexHandle CreateHandle (BITMAPINFO *bminf, int symflags=0, int extraFlags=0)=0
virtual BITMAPINFO *  BitmapToDIB (Bitmap *bm, int symflags, int extraFlags, BOOL forceW=0, BOOL forceH=0)=0
virtual TexHandle MakeHandle (BITMAPINFO *bminf)=0
virtual BOOL  UseClosestPowerOf2 ()=0
virtual int  Size ()=0

Constructor & Destructor Documentation

virtual ~TexHandleMaker ( ) [inline, virtual]
Remarks:
Destructor.
{;}

Member Function Documentation

virtual TexHandle* CreateHandle ( Bitmap bm,
int  symflags = 0,
int  extraFlags = 0 
) [pure virtual]
Remarks:
Implemented by the System

This method is called to create a texture handle from a 3ds Max bitmap.
Parameters:
Bitmap *bm

The bitmap to create a handle to.

int symflags=0

See Texture Symmetry Flags.

int extraFlags=0;

One of the following values:

EX_MULT_ALPHA

Set this flag if alpha is not premultiplied in the Bitmap.

EX_RGB_FROM_ALPHA

Set this flag to make the map using the alpha channel of the bitmap to define the gray level.

EX_OPAQUE_ALPHA

Specifies to make the map using opaque alpha.

EX_ALPHA_FROM_RGB

Specifies to make alpha from the intensity of the map.
Returns:
A pointer to the texture handle.
virtual TexHandle* CreateHandle ( BITMAPINFO *  bminf,
int  symflags = 0,
int  extraFlags = 0 
) [pure virtual]
Remarks:
Implemented by the System

This method is called to create a texture handle from a 32 bit Windows Device Independent Bitmap.
Parameters:
BITMAPINFO *bminf

The bitmap to create a handle to.

int symflags=0

See Texture Symmetry Flags.

int extraFlags=0;

One of the following values:

EX_MULT_ALPHA

Set this flag if alpha is not premultiplied in the Bitmap.

EX_RGB_FROM_ALPHA

Set this flag to make the map using the alpha channel of the bitmap to define the gray level.

EX_OPAQUE_ALPHA

Specifies to make the map using opaque alpha.

EX_ALPHA_FROM_RGB

Specifies to make alpha from the intensity of the map.
Returns:
A pointer to the texture handle.
virtual BITMAPINFO* BitmapToDIB ( Bitmap bm,
int  symflags,
int  extraFlags,
BOOL  forceW = 0,
BOOL  forceH = 0 
) [pure virtual]
Remarks:
This method creates a 32 bit Windows Device Independent Bitmap with the specified symflags and extraflags already incorporated and returns a pointer to the associated BitmapInfo.
Parameters:
Bitmap *bm

Points to the bitmap to create the handle to.

int symflags

See Texture Symmetry Flags.

int extraFlags

One of the following values:

EX_MULT_ALPHA

Set this flag if alpha is not premultiplied in the Bitmap.

EX_RGB_FROM_ALPHA

Set this flag to make the map using the alpha channel of the bitmap to define the gray level.

EX_OPAQUE_ALPHA

Specifies to make the map using opaque alpha.

EX_ALPHA_FROM_RGB

Specifies to make alpha from the intensity of the map.

BOOL forceW=0

If this parameter is non-zero it is used as the width of the final DIB.

BOOL forceH=0

If this parameter is non-zero it is used as the height of the final DIB
virtual TexHandle* MakeHandle ( BITMAPINFO *  bminf ) [pure virtual]
Remarks:
Returns a texture handle made from a 32 bit DIB that has the symflags, and extraflags already incorporated. This takes ownership of the BITMAPINFO*.
Parameters:
BITMAPINFO* bminf

Points to the BitmapInfo for the DIB.
virtual BOOL UseClosestPowerOf2 ( ) [pure virtual]
Remarks:
Returns TRUE if the bitmap does not need to be square and FALSE if it does need to be square.
virtual int Size ( ) [pure virtual]
Remarks:
Implemented by the System.

This method may be called to determine the desired size for the bitmap. The system ultimately needs a square bitmap that is a power of 2 in width and height. If you already have a bitmap around, just pass it in to CreateHandle() and it will be converted. If you are creating a bitmap from scratch (i.e. a procedural texture), then you should make it Size() in width in height, and save the system an extra step. In either case you own your bitmap, and are responsible for ultimately freeing it.
Returns:
The size of the desired bitmap.

TexHandleMaker TexHandleMaker TexHandleMaker TexHandleMaker TexHandleMaker TexHandleMaker TexHandleMaker TexHandleMaker TexHandleMaker TexHandleMaker
TexHandleMaker TexHandleMaker TexHandleMaker TexHandleMaker TexHandleMaker TexHandleMaker TexHandleMaker TexHandleMaker TexHandleMaker TexHandleMaker