Class BitmapStorageLDR

3DS Max Plug-In SDK

Class BitmapStorageLDR

See Also: Class BitmapStorage.

class BitmapStorageLDR : public BitmapStorage

Description:

This class is available in release 4.0 and later only.

This is the base class for the development of plug-in Bitmap Storage plug-ins that don't use Hight Dynamic Range bitmaps.

Note that bVirtual is actuall a shortcut macro for BMMExport virtual.

All methods of this class are implemented by the System.

Methods:

public:

Prototype:

bVirtual int IsHighDynamicRange();

Remarks:

This method returns 0 if the bitmap is not a high dynamic range bitmap or 1 if it is.

Default Implementation:

{ return(0); }

 

Prototype:

bVirtual int StraightCopy(Bitmap *from);

Remarks:

Implemented by the System.

This method does a straightforward copy from the specified bitmap.

Parameters:

Bitmap *from

The bitmap to copy from.

Prototype:

bVirtual int Get16Gray(int x,int y,int pixels,float *ptr);

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 the storage for the retrieved pixels.

Return Value:

Nonzero if pixels were retrieved; otherwise 0.

Prototype:

bVirtual int Put16Gray(int x,int y,int pixels,float *ptr);

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 the storage for the pixels.

Return Value:

Nonzero if pixels were stored; otherwise 0.

Prototype:

bVirtual int GetLinearPixels(int x,int y,int pixels,BMM_Color_fl *ptr);

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

BMM_Color_fl *ptr

Pointer to the storage for the retrieved pixels.

Return Value:

Nonzero if pixels were retrieved; otherwise 0.

Prototype:

bVirtual 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 the storage for the retrieved pixels.

Return Value:

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

Prototype:

bVirtual 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

The pixels values to store.

Return Value:

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

Prototype:

bVirtual 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 the storage for the pixels.

Return Value:

Nonzero if pixels were retrieved; otherwise 0.

Prototype:

bVirtual 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

The pixels values to store.

Return Value:

Nonzero if pixels were stored; otherwise 0.

Prototype:

bVirtual int CropImage(int width,int height,BMM_Color_fl fillcolor);

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_fl fillcolor

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:

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

Return Value:

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

Prototype:

bVirtual int CopyCrop(Bitmap *from, BMM_Color_fl 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_fl fillcolor

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

Return Value:

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

Prototype:

bVirtual 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 bitmap to copy to this bitmap.

Return Value:

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

Prototype:

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

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

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

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.

BitmapInfo *bi = NULL

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:

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

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

BitmapInfo *bi = NULL

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:

bVirtual 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 the 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 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.

Return Value:

Nonzero if the copy was performed; otherwise 0.

Prototype:

bVirtual int GetFiltered(float u,float v,float du,float dv,BMM_Color_fl *ptr);

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_fl *ptr

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