Class BitmapStorage

3DS Max Plug-In SDK

Class BitmapStorage

See Also: Class BitmapManager, Class BitmapInfo, Class Bitmap, Class BitmapIO, List of Bitmap Error Codes.

class BitmapStorage : public BaseInterfaceServer

Description:

When an image is loaded the buffer that will hold it is an instance of this class. This class provides methods that allow developers to access the image data in a uniform manner even though the underlying storage might be 1-bit, 8-bit, 16-bit, 32-bit or 64-bit. Standard methods are available for getting / putting pixels: Get/PutPixels(), Get/Put16Gray(), Get/Put64Pixels(), Get/PutTruePixels(), Get/PutIndexPixels(), etc.

Since a developer accesses the storage through this standard interface, certain plug-in types may not need to allocate memory for the storage. For example, an image loader that creates an image from scratch (such as a gradient generator). This plug-in would simply derive a new type of BitmapStorage and provide the pixels through the common methods, creating them as requested.

Note: The "Get/PutPixels()" methods of this class access the image a single scanline at a time.

Also note: The following global function may be used by image loader/saver plug-ins to create an instance of BitmapStorage:

Function:

BitmapStorage *BMMCreateStorage(BitmapManager *manager, UINT type);

Remarks:

This global function will create a new instance of the specified storage type and return a pointer to it.

Parameters:

BitmapManager *manager

The bitmap manager used for this storage.

UINT type

The type of storage to create. One of the following values:

BMM_LINE_ART

BMM_PALETTED

BMM_GRAY_8

BMM_GRAY_16

BMM_TRUE_16

BMM_TRUE_32

BMM_TRUE_64

Return Value:

The bitmap storage instance created or NULL if the specified type could not be created.

Data Members:

protected:

int openMode;

The mode the storage was opened in. See Bitmap Open Mode Types.

UINT usageCount;

The number of bitmaps using this storage.

BitmapManager *manager;

The bitmap manager associated with this storage.

int flags;

See List of Bitmap Flags.

int type;

See List of Bitmap Types.

BMM_Color_48 palette[256];

The palette entries (256 max). See Structure BMM_Color_48.

int paletteSlots;

The number of palette slots used.

UWORD *gammaTable;

The gamma correction table.

RenderInfo *rendInfo;

A pointer to an instance of RenderInfo. See Class RenderInfo.

public:

BitmapInfo bi

Describes the properties of the bitmap associated with this storage.

Methods:

Prototype:

inline BitmapManager *Manager()

Remarks:

Implemented by the System.

Returns the bitmap manager for the storage.

Prototype:

float SetGamma(float gam)

Remarks:

Implemented by the System.

Sets the gamma setting to the value passed.

Parameters:

floag gam

The gamma setting to set.

Prototype:

inline int HasGamma()

Remarks:

Implemented by the System.

Returns nonzero if the gamma table has been allocated; otherwise 0.

Prototype:

void SetHasGamma(BOOL onOff)

Remarks:

Implemented by the System.

This method allocates or deallocates the gamma table.

Parameters:

BOOL onOff

If TRUE the gamma table is allocated; otherwise it is deleted.

Prototype:

UWORD *GetInputGammaTable()

Remarks:

Implemented by the System.

This methods returns a pointer to a gamma table that can be used for converting pixels using whatever gamma value is appropriate for the storage. It is typically called inside of the GetLinearPixels() method of the particular BitmapStorage subclasses which then use the gamma table to convert pixel values to linear values. Plug-In developers in most cases will not need to call this method directly.

Prototype:

inline int OpenMode()

Remarks:

Implemented by the System.

Returns the mode the storage was opened in. See Bitmap Open Mode Types.

Prototype:

inline int Width()

Remarks:

Implemented by the System.

Returns the width (horizontal dimension) of the storage's BitmapInfo instance (bi.Width()).

Prototype:

inline int Height()

Remarks:

Implemented by the System.

Returns the height (vertical dimension) of the storage's BitmapInfo instance (bi.Height()).

Prototype:

inline float Aspect()

Remarks:

Implemented by the System.

Returns the aspect ratio of the storage's BitmapInfo instance (bi.Aspect()).

Prototype:

inline float Gamma()

Remarks:

Implemented by the System.

Returns the gamma setting of the storage's BitmapInfo instance (bi.Gamma()).

Prototype:

inline int Paletted()

Remarks:

Implemented by the System.

Determines if the image is paletted. If the image has a palette (indexed color), the number of palette slots used is returned; otherwise zero.

Prototype:

inline int IsDithered()

Remarks:

Implemented by the System.

Returns the dithered state of the image. If the image is dithered nonzero is returned; otherwise 0,

Prototype:

inline int PreMultipliedAlpha()

Remarks:

Implemented by the System.

Determines if the image has pre-multiplied alpha. If the image has pre-multiplied alpha nonzero is returned; otherwise 0.

Prototype:

inline int HasAlpha()

Remarks:

Implemented by the System.

Determines if the image has an alpha channel. If the image has an alpha channel nonzero is returned; otherwise 0.

Prototype:

inline void UseScaleColors(int on);

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

Set whether colors are scaled (on) or clamped (off) when converting from BMM_Color_fl to BMM_Color_64.

Prototype:

inline int ScaleColors();

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

Returns the last value set by UseScaleColors.

Prototype:

inline static void ClampColor(BMM_Color_64& out, const BMM_Color_fl& in);

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

Converts in to out clamping the RGB components to 0 to 65535. The alpha component is not copied.

Parameters:

BMM_Color_64& out

The result of the conversion.

BMM_Color_fl& in

The value to convert.

Prototype:

inline static void ClampColorA(BMM_Color_64& out, const BMM_Color_fl& in);

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

Converts in to out clamping the RGB components to 0 to 65535.

Parameters:

BMM_Color_64& out

The result of the conversion.

BMM_Color_fl& in

The value to convert.

Prototype:

inline void ScaleColor (BMM_Color_64& out, BMM_Color_fl in);

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

Converts in to out clamping the RGB components to 0 to 65535. The alpha component is not copied.

Parameters:

BMM_Color_64& out

The result of the conversion.

BMM_Color_fl& in

The value to convert.

Prototype:

inline void ScaleColorA(BMM_Color_64& out, const BMM_Color_fl& in);

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

Converts in to out clamping the RGB components to 0 to 65535.

Parameters:

BMM_Color_64& out

The result of the conversion.

BMM_Color_fl& in

The value to convert.

Prototype:

inline void ClampScaleColor (BMM_Color_64& out, const BMM_Color_fl& in);

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

Converts in to out, using the value of ScaleColors() to determine the clamping or scaling. The alpha component is not copied.

Parameters:

BMM_Color_64& out

The result of the conversion.

BMM_Color_fl& in

The value to convert.

Prototype:

inline void ClampScaleColorA (BMM_Color_64& out, const BMM_Color_fl& in);

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

Converts in to out, using the value of ScaleColors() to determine the clamping or scaling.

Parameters:

BMM_Color_64& out

The result of the conversion.

BMM_Color_fl& in

The value to convert.

Prototype:

inline int UsageCount()

Remarks:

Implemented by the System.

Returns the number of times this image is being used in the system.

Prototype:

inline int Type()

Remarks:

Implemented by the System.

Returns the type of bitmap managed by this storage. See List of Bitmap Types.

Prototype:

inline int Flags()

Remarks:

Implemented by the System.

Returns the bitmap flags. See List of Bitmap Flags.

Prototype:

inline void SetFlags(DWORD f)

Remarks:

Implemented by the System.

Sets the specified flag bits. See List of Bitmap Flags.

Parameters:

DWORD f

The flags to set.

Prototype:

virtual int MaxRGBLevel() = 0;

Remarks:

This method returns the number of bits per pixel for each color component. For example a 24-bit TARGA has a MaxRGBLevel() of 8 (8 red, 8 green, and 8 blue).

Prototype:

virtual int MaxAlphaLevel() = 0;

Remarks:

Returns the number of bits per pixel in the alpha channel.

Prototype:

virtual int IsHighDynamicRange() = 0;

Remarks:

This method is available in release 4.0 and later only.

Returns nonzero if this storage uses high dynamic range data; otherwise zero. See the Advanced Topics secion Working With Bitmaps for details on High Dynamic Range bitmaps.

Prototype:

virtual void *GetStoragePtr(int *type)

Remarks:

Implemented by the Plug-In.

This method is used to get a pointer to the beginning of the image storage. Not all storage types can return a valid pointer. In those cases, this method will set the passed type to BMM_NO_TYPE and return NULL.

Parameters:

int *type

The type of storage is returned here. See List of Bitmap Types.

Default Implementation:

{ *type = BMM_NO_TYPE; return (NULL); }

Prototype:

virtual void *GetAlphaPtr(int *type);

Remarks:

This method is available in release 2.0 and later only.

This method will attempt to get a pointer to the beginning of the image alpha storage. Not all storage types can return a valid pointer. In those cases, this call will fail and the user should use some other method described below.

Parameters:

int *type

The type of storage is returned here. See List of Bitmap Types.

Default Implementation:

{ *type = BMM_NO_TYPE; return (NULL); }

Below are the standard methods for accessing image pixels. Important Note: The following "GetPixels()" methods operate on a single scanline of the image at a time. Thus the number of pixels+x must be less than the width of the image.

Prototype:

virtual int Get16Gray(int x, int y, int pixels, WORD *ptr) = 0;

Remarks:

Implemented by the System.

Retrieves the specified 16 bit grayscale pixels from the storage. This method operates on a single scanline of the image at a time.

Parameters:

int x

Source x location.

int y

Source y location.

int pixels

Number of pixels to retrieve.

WORD *ptr

Pointer to storage for the retrieved pixels.

Return Value:

Nonzero if pixels were retrieved; otherwise 0.

Prototype:

virtual int Put16Gray( int x, int y, int pixels, WORD *ptr) = 0;

Remarks:

Implemented by the System.

Stores the 16 bit grayscale pixels to the specified location in the storage. This method operates on a single scanline of the image at a time.

Parameters:

int x

Destination x location.

int y

Destination y location.

int pixels

Number of pixels to store.

WORD *ptr

Pointer to storage for the pixels.

Return Value:

Nonzero if pixels were stored; otherwise 0.

Prototype:

virtual int Get16Gray(int x, int y, int pixels, float *ptr) = 0;

Remarks:

Implemented by the System.

Retrieves the specified 16 bit grayscale pixels from the storage. This method operates on a single scanline of the image at a time.

Parameters:

int x

Source x location.

int y

Source y location.

int pixels

Number of pixels to retrieve.

float *ptr

Pointer to storage for the retrieved pixels.

Return Value:

Nonzero if pixels were retrieved; otherwise 0.

Prototype:

virtual int Put16Gray( int x, int y, int pixels, float *ptr) = 0;

Remarks:

Implemented by the System.

Stores the 16 bit grayscale pixels to the specified location in the storage. This method operates on a single scanline of the image at a time.

Parameters:

int x

Destination x location.

int y

Destination y location.

int pixels

Number of pixels to store.

float *ptr

Pointer to storage for the pixels.

Return Value:

Nonzero if pixels were stored; otherwise 0.

Prototype:

virtual int GetLinearPixels(int x,int y,int pixels,BMM_Color_64 *ptr) = 0;

Remarks:

Implemented by the Plug-In.

This method retrieves the specified 64 bit true color pixels from the storage. Pixels returned from this method are NOT gamma corrected. These have linear gamma (1.0). This method operates on a single scanline of the image at a time.

Parameters:

int x

Source x location.

int y

Source y location.

int pixels

Number of pixels to store.

BMM_Color_64 *ptr

Pointer to storage for the pixels.

Return Value:

Nonzero if pixels were retrieved; otherwise 0.

Prototype:

inline int GetPixels(int x,int y,int pixels,BMM_Color_64 *ptr)

Remarks:

Retrieves the specified 64-bit pixel values from the bitmap. Note: This method provides access to pixel data one scanline at a time.

Parameters:

int x

Source x location.

int y

Source y location.

int pixels

Number of pixels to retrieve.

BMM_Color_64 *ptr

Pointer to storage for the retrieved pixel values. See Structure BMM_Color_64.

Return Value:

Returns nonzero if pixels were retrieved; otherwise 0. If storage has not been allocated 0 is returned.

Prototype:

int PutPixels(int x,int y,int pixels,BMM_Color_64 *ptr)

Remarks:

Stores the specified 64-bit pixel values into the bitmap's own local storage. The pointer you pass to this method may be freed or reused as soon as the function returns. Note: This method provides access to pixel data one scanline at a time.

Parameters:

int x

Destination x location.

int y

Destination y location.

int pixels

Number of pixels to store.

BMM_Color_64 *ptr

Pixel values to store. See Structure BMM_Color_64.

Return Value:

Returns nonzero if pixels were stored; otherwise 0. If storage has not been allocated 0 is returned.

Prototype:

virtual int GetLinearPixels(int x,int y,int pixels,BMM_Color_fl *ptr) = 0;

Remarks:

Implemented by the Plug-In.

This method retrieves the specified 64 bit true color pixels from the storage. Pixels returned from this method are NOT gamma corrected. These have linear gamma (1.0). This method operates on a single scanline of the image at a time.

Parameters:

int x

Source x location.

int y

Source y location.

int pixels

Number of pixels to store.

BMM_Color_fl *ptr

Pointer to storage for the pixels.

Return Value:

Nonzero if pixels were retrieved; otherwise 0.

Prototype:

inline int GetPixels(int x,int y,int pixels,BMM_Color_fl *ptr)

Remarks:

Retrieves the specified 64-bit pixel values from the bitmap. Note: This method provides access to pixel data one scanline at a time.

Parameters:

int x

Source x location.

int y

Source y location.

int pixels

Number of pixels to retrieve.

BMM_Color_fl *ptr

Pointer to storage for the retrieved pixel values.

Return Value:

Returns nonzero if pixels were retrieved; otherwise 0. If storage has not been allocated 0 is returned.

Prototype:

int PutPixels(int x,int y,int pixels,BMM_Color_fl *ptr)

Remarks:

Stores the specified 64-bit pixel values into the bitmap's own local storage. The pointer you pass to this method may be freed or reused as soon as the function returns. Note: This method provides access to pixel data one scanline at a time.

Parameters:

int x

Destination x location.

int y

Destination y location.

int pixels

Number of pixels to store.

BMM_Color_fl *ptr

Pixel values to store.

Return Value:

Returns nonzero if pixels were stored; otherwise 0. If storage has not been allocated 0 is returned.

Prototype:

virtual int GetIndexPixels(int x, int y, int pixels, unsigned char *ptr) = 0;

Remarks:

Implemented by the System.

Retrieves the specified index color pixels from the storage. This is used to retrieve pixels from a paletted image. This method operates on a single scanline of the image at a time.

Parameters:

int x

Source x location.

int y

Source y location.

int pixels

Number of pixels to retrieve.

unsigned char *ptr

Pointer to storage for the pixels.

Return Value:

Nonzero if pixels were retrieved; otherwise 0.

Prototype:

virtual int PutIndexPixels(int x, int y, int pixels, unsigned char *ptr) = 0;

Remarks:

Implemented by the System.

Stores the index color pixels to the specified location in the storage. This method operates on a single scanline of the image at a time.

Parameters:

int x

Destination x location.

int y

Destination y location.

int pixels

Number of pixels to store.

unsigned char *ptr

Pointer to the pixels to store.

Return Value:

Nonzero if pixels were stored; otherwise 0.

Prototype:

virtual int CropImage(int width,int height,BMM_Color_64 fillcolor) = 0;

Remarks:

Implemented by the Plug-In.

Adjusts the bitmap size to the specified dimensions. The image is not resized to fit; it is cropped or filled with fillcolor pixels to accommodate the new size.

Parameters:

int width

The new horizontal size for the bitmap.

int height

The new vertical size for the bitmap.

BMM_Color_64 fillcolor

If the bitmap's new size is bigger than its current size, this is the color used to fill the new pixels. See Structure BMM_Color_64.

Return Value:

Nonzero if the image was cropped; otherwise 0.

Prototype:

virtual int CropImage(int width, int height, int fillindex) = 0;

Remarks:

Implemented by the Plug-In.

Adjusts the bitmap size to the specified dimensions. The image is not resized to fit; it is cropped or filled with fillindex pixels to accommodate the new size.

Parameters:

int width

The new horizontal size for the bitmap.

int height

The new vertical size for the bitmap.

int fillindex

If the bitmap's new size is bigger than its current size, this is the color used to fill the new pixels.

Return Value:

Nonzero if the image was cropped; otherwise 0.

Prototype:

virtual int ResizeImage(int width,int height,int newpalette) = 0;

Remarks:

Implemented by the Plug-In.

This method is no longer used.

Prototype:

virtual int CopyImage(Bitmap *from, int operation, BMM_Color_64 fillcolor)

Remarks:

Implemented by the Plug-In.

Copies the specified bitmap to this storage. The image is cropped or resized as specified.

Parameters:

Bitmap *from

The source bitmap.

int operation

The type of copy to perform:

COPY_IMAGE_CROP

Copy image to current map size using cropping if necessary.

COPY_IMAGE_RESIZE_LO_QUALITY

Resize the source image to the destination map size (draft quality).

COPY_IMAGE_RESIZE_HI_QUALITY

Resize source image to the destination map size (final quality).

COPY_IMAGE_USE_CUSTOM

Resize based on the Image Input Options (BitmapInfo *).

BMM_Color_64 fillcolor

Vacant areas of the bitmap are filled with fillcolor pixels if the operation specified is COPY_IMAGE_CROP and one of the source bitmap dimensions is less than the size of this bitmap. See Structure BMM_Color_64.

Return Value:

Nonzero if the copy was performed; otherwise 0.

Prototype:

virtual int CopyImage(Bitmap *from, int operation, BMM_Color_64 fillcolor, BitmapInfo *bi = NULL) = 0;

Remarks:

Implemented by the Plug-In.

Copies the specified bitmap to this storage. The image is cropped or resized as specified.

Parameters:

Bitmap *from

The source bitmap.

int operation

The type of copy to perform:

COPY_IMAGE_CROP

Copy image to current map size using cropping if necessary.

COPY_IMAGE_RESIZE_LO_QUALITY

Resize the source image to the destination map size (draft quality).

COPY_IMAGE_RESIZE_HI_QUALITY

Resize source image to the destination map size (final quality).

COPY_IMAGE_USE_CUSTOM

Resize based on the Image Input Options (BitmapInfo *).

BMM_Color_64 fillcolor

Vacant areas of the bitmap are filled with fillcolor pixels if the operation specified is COPY_IMAGE_CROP and one of the source bitmap dimensions is less than the size of this bitmap. See Structure BMM_Color_64.

BitmapInfo *bi

When using custom options (resize to fit, positioning, etc.) this is how the flags are passed down to the Bitmap Manager. This is an optional argument -- for simple copy operations, *bi can default to NULL. If present, the code checks the option flags and acts accordingly.

Return Value:

Nonzero if the copy was performed; otherwise 0.

Prototype:

virtual int CopyImage(Bitmap *from, int operation, BMM_Color_fl fillcolor, BitmapInfo *bi = NULL) = 0;

Remarks:

Implemented by the Plug-In.

Copies the specified bitmap to this storage. The image is cropped or resized as specified.

Parameters:

Bitmap *from

The source bitmap.

int operation

The type of copy to perform:

COPY_IMAGE_CROP

Copy image to current map size using cropping if necessary.

COPY_IMAGE_RESIZE_LO_QUALITY

Resize the source image to the destination map size (draft quality).

COPY_IMAGE_RESIZE_HI_QUALITY

Resize source image to the destination map size (final quality).

COPY_IMAGE_USE_CUSTOM

Resize based on the Image Input Options (BitmapInfo *).

BMM_Color_fl fillcolor

Vacant areas of the bitmap are filled with fillcolor pixels if the operation specified is COPY_IMAGE_CROP and one of the source bitmap dimensions is less than the size of this bitmap. See Structure BMM_Color_fl.

BitmapInfo *bi

When using custom options (resize to fit, positioning, etc.) this is how the flags are passed down to the Bitmap Manager. This is an optional argument -- for simple copy operations, *bi can default to NULL. If present, the code checks the option flags and acts accordingly.

Return Value:

Nonzero if the copy was performed; otherwise 0.

Prototype:

virtual int CopyImage( Bitmap *from,int operation,int fillindex)

Remarks:

Implemented by the Plug-In.

Copies the specified bitmap to this storage.

Parameters:

Bitmap *from

The source bitmap.

int operation

The type of copy to perform.

COPY_IMAGE_CROP

Copy image to current map size using cropping if necessary.

COPY_IMAGE_RESIZE_LO_QUALITY

Resize the source image to the destination map size (draft quality).

COPY_IMAGE_RESIZE_HI_QUALITY

Resize source image to destination map size (final quality).

COPY_IMAGE_USE_CUSTOM

Resize based on the Image Input Options (BitmapInfo *).

int fillindex

Vacant areas of the bitmap are filled with fillindex pixels if the operation specified is COPY_IMAGE_CROP and one of the source bitmap dimensions is less than the size of this bitmap.

Return Value:

Nonzero if the copy was performed; otherwise 0.

Prototype:

virtual int CopyCrop(Bitmap *from, BMM_Color_64 fillcolor);

Remarks:

Implemented by the Plug-In.

Copies the specified bitmap to this storage. The image is cropped to fit.

Parameters:

Bitmap *from

The bitmap to copy to this bitmap.

BMM_Color_64 fillcolor

The color to use if the source image is smaller than the destination image. See Structure BMM_Color_64.

Return Value:

Nonzero if the copy/crop was performed; otherwise zero.

Prototype:

virtual int CopyScaleLow(Bitmap *from);

Remarks:

Implemented by the System.

This method copies the specified bitmap to this storage. The source bitmap is scaled to fit using a lower quality but faster algorithm than CopyScaleHigh().This is an internal function implemented within BMM.DLL for copying bitmaps back and forth. If a developer creates new storage type, they will automatically get these copy functions as these are implemented in the base class.

Parameters:

Bitmap *from

The source bitmap.

Return Value:

Nonzero if the copy/scale was performed; otherwise zero.

Prototype:

virtual int CopyScaleHigh(Bitmap *from, HWND hWnd, BMM_Color_64 **buf = NULL, int w=0, int h=0);

Remarks:

Implemented by the System.

This method copies the specified bitmap to this storage. The source bitmap is scaled to fit using a higher quality but slower algorithm than CopyScaleLow(). This is an internal function implemented within BMM.DLL for copying bitmaps back and forth. If a developer creates new storage type, they will automatically get these copy functions as these are implemented in the base class.

Prototype:

virtual int CopyScaleHigh(Bitmap *from, HWND hWnd, BMM_Color_fl **buf = NULL, int w=0, int h=0);

Remarks:

Implemented by the System.

This method copies the specified bitmap to this storage. The source bitmap is scaled to fit using a higher quality but slower algorithm than CopyScaleLow(). This is an internal function implemented within BMM.DLL for copying bitmaps back and forth. If a developer creates new storage type, they will automatically get these copy functions as these are implemented in the base class.

Prototype:

virtual int GetPalette(int start,int count,BMM_Color_48 *ptr) = 0;

Remarks:

Implemented by the Plug-In.

Retrieves the specified portion of the palette of this storage.

Parameters:

int start

Zero based index of the first palette entry to retrieve.

int count

Number of palette entries to retrieve.

BMM_Color_48 *ptr

Points to storage for the palette values. See Structure BMM_Color_48.

Return Value:

Nonzero if the palette was retrieved; otherwise 0.

Prototype:

virtual int SetPalette(int start, int count, BMM_Color_48 *ptr) = 0;

Remarks:

Implemented by the Plug-In.

Sets the specified portion of the palette for this storage.

Parameters:

int start

First palette index entry to store.

int count

Number of palette entries to store.

BMM_Color_48 *ptr

Points to storage for the palette values. See Structure BMM_Color_48.

Return Value:

Nonzero if the palette was stored; otherwise 0.

Sample Code:

See Load() in \MAXSDK\SAMPLES\IO\BMP\BMP.CPP.

Prototype:

virtual int GetFiltered(float u, float v, float du, float dv, BMM_Color_64 *ptr) = 0;

Remarks:

Implemented by the Plug-In.

This method uses summed area table or pyramidal filtering to compute an averaged color over a specified area.

Parameters:

float u, float v

The location in the bitmap to filter. These values go from 0.0 to 1.0 across the size of the bitmap.

float du, float dv

The size of the rectangle to sample. These values go from 0.0 to 1.0 across the size of the bitmap.

BMM_Color_64 *ptr

The result is returned here - the average over the specified area. See Structure BMM_Color_64.

Prototype:

virtual int GetFiltered(float u,float v,float du,float dv,BMM_Color_fl *ptr) = 0;

Remarks:

This method is available in release 4.0 and later only.

Implemented by the Plug-In.

This method uses summed area table or pyramidal filtering to compute an averaged color over a specified area and outputs to a floating point color structure.

Parameters:

float u, float v

The location in the bitmap to filter. These values go from 0.0 to 1.0 across the size of the bitmap.

float du, float dv

The size of the rectangle to sample. These values go from 0.0 to 1.0 across the size of the bitmap.

BMM_Color_fl *ptr

The result is returned here - the average over the specified area.

Prototype:

virtual int Allocate(BitmapInfo *bi, BitmapManager *manager, int openMode) = 0;

Remarks:

Implemented by the System.

This method is called to allocate image storage.

Parameters:

BitmapInfo *bi

Points to an instance of the BitmapInfo class describing the properties of the bitmap.

BitmapManager *manager

Points to the BitmapManager for the bitmap.

int openMode

See Bitmap Open Mode Types.

Return Value:

Nonzero if storage was allocated; otherwise 0.

Prototype:

virtual void Scale( float *, int, float *, int );

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

This method is used internally.

Prototype:

virtual BOOL GetSRow( float *, int, float *, int );

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

This method is used internally.

Prototype:

virtual BOOL PutSRow( float *, int, float *, int );

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

This method is used internally.

Prototype:

virtual BOOL GetSCol( float *, float *, int, int );

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

This method is used internally.

Prototype:

virtual BOOL PutSCol( float *, float *, int, int );

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

This method is used internally.

Prototype:

virtual BOOL ScaleY( Bitmap *, BMM_Color_fl *, float *, float *, HWND, int cw = 0, int ch = 0 );

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

This method is used internally.

Prototype:

virtual BOOL ScaleX( Bitmap *, BMM_Color_fl *, float *, float *, HWND, int cw = 0, int ch = 0 );

Remarks:

This method is available in release 4.0 and later only.

Implemented by the System.

This method is used internally.

Prototype:

virtual int CropImage(int width,int height, BMM_Color_fl fillcolor) = 0;

Remarks:

This method is available in release 4.0 and later only.

Implemented by the Plug-In.

Adjusts the bitmap size to the specified dimensions. The image is not resized to fit; it is cropped or filled with fillcolor pixels to accommodate the new size.

Parameters:

int width

The new horizontal size for the bitmap.

int height

The new vertical size for the bitmap.

BMM_Color_fl fillcolor

If the bitmap's new size is bigger than its current size, this is the color used to fill the new pixels. See Structure BMM_Color_fl.

Return Value:

Nonzero if the image was cropped; otherwise 0.

Prototype:

virtual int CopyCrop(Bitmap *from, BMM_Color_fl fillcolor) = 0;

Remarks:

This method is available in release 4.0 and later only.

Implemented by the Plug-In.

Copies the specified bitmap to this storage. The image is cropped to fit.

Parameters:

Bitmap *from

The bitmap to copy to this bitmap.

BMM_Color_fl fillcolor

The color to use if the source image is smaller than the destination image. See Structure BMM_Color_fl.

Return Value:

Nonzero if the copy/crop was performed; otherwise zero.

G-Buffer Methods.

Prototype:

virtual void *GetChannel(ULONG channelID, ULONG& chanType)

Remarks:

Implemented by the Plug-In.

Returns a pointer to specified geometry/graphics buffer channel, and determines its pixel depth.

Parameters:

ULONG channelID

The channel to return a pointer to. See List of G-Buffer Channels.

ULONG& chanType

The type of the returned channel. One of the following values:

BMM_CHAN_TYPE_UNKNOWN

Channel not of a known type.

BMM_CHAN_TYPE_1

1 bit per pixel

BMM_CHAN_TYPE_8

1 byte per pixel

BMM_CHAN_TYPE_16

1 word per pixel

BMM_CHAN_TYPE_32

2 words per pixel

BMM_CHAN_TYPE_48

3 words per pixel

BMM_CHAN_TYPE_64

4 words per pixel

BMM_CHAN_TYPE_96

6 words per pixel

Default Implementation:

{ return NULL;}

Prototype:

GBuffer *GetGBuffer();

Remarks:

Returns a pointer to the G-Buffer associated with this storage.

Prototype:

virtual ULONG CreateChannels(ULONG channelIDs)

Remarks:

Implemented by the Plug-In.

Create the specified channels.

Parameters:

ULONG channelIDs

Specifies the channels to create. See List of G-Buffer Channels.

Return Value:

The channels that are present.

Default Implementation:

{ return 0;}

Prototype:

virtual void DeleteChannels(ULONG channelIDs)

Remarks:

Implemented by the Plug-In.

Delete the specified channels.

Parameters:

ULONG channelIDs

Specifies the channels to delete. See List of G-Buffer Channels.

Prototype:

virtual ULONG ChannelsPresent()

Remarks:

Implemented by the Plug-In.

Returns the channels that are present. See List of G-Buffer Channels.

Default Implementation:

{ return 0; }

Prototype:

RenderInfo* AllocRenderInfo();

Remarks:

Implemented by the Plug-In.

Output bitmaps can get an instance of the class RenderInfo, which is written by the renderer. This method will allocate an instance only if a RenderInfo doesn't yet exist.

Return Value:

A pointer to a RenderInfo. See Class RenderInfo.

Prototype:

RenderInfo* GetRenderInfo();

Remarks:

Implemented by the Plug-In.

Returns a RenderInfo pointer. See Class RenderInfo.