Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Friends

BitmapStorage Class Reference

This reference page is linked to from the following overview topics: Principal Bitmap Classes, Resolution / Palettes / Pixel Storage Topics, Aspect Ratio, Gamma Preferences, Writing Image IO Plug-ins.


Search for all occurrences

Detailed Description

See also:
Class BitmapManager, Class BitmapInfo, Class Bitmap, Class BitmapIO, Bitmap Error (result) Codes.

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 "<b>Get/PutPixels()</b>" 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:

#include <bitmap.h>

Inheritance diagram for BitmapStorage:
Inheritance graph
[legend]

List of all members.

Public Member Functions

BMMExport  BitmapStorage ()
virtual BMMExport  ~BitmapStorage ()
BMMExport float  SetGamma (float gam)
int  HasGamma ()
BMMExport void  SetHasGamma (BOOL onOff)
void  UpdateGammaTable ()
BMMExport UWORD *  GetInputGammaTable ()
BitmapManager Manager ()
int  OpenMode ()
int  Width ()
int  Height ()
float  Aspect ()
float  Gamma ()
int  Paletted ()
int  IsDithered ()
int  PreMultipliedAlpha ()
int  HasAlpha ()
void  UseScaleColors (int on)
int  ScaleColors ()
void  ClampScaleColor (BMM_Color_64 &out, const BMM_Color_fl &in)
void  ClampScaleColorA (BMM_Color_64 &out, const BMM_Color_fl &in)
int  UsageCount ()
int  Type ()
int  Flags ()
void  SetFlags (DWORD f)
void  ClearFlags (DWORD f)
  Clears the given flags.
virtual BMMExport int  MaxRGBLevel ()=0
virtual BMMExport int  MaxAlphaLevel ()=0
virtual BMMExport int  IsHighDynamicRange ()=0
virtual BMMExport void *  GetStoragePtr (int *type)
virtual BMMExport void *  GetAlphaPtr (int *type)
virtual BMMExport void  Scale (WORD *, int, WORD *, int)
virtual BMMExport void  Scale (float *, int, float *, int)
virtual BMMExport BOOL  GetSRow (WORD *, int, WORD *, int)
virtual BMMExport BOOL  GetSRow (float *, int, float *, int)
virtual BMMExport BOOL  PutSRow (WORD *, int, WORD *, int)
virtual BMMExport BOOL  PutSRow (float *, int, float *, int)
virtual BMMExport BOOL  GetSCol (WORD *, WORD *, int, int)
virtual BMMExport BOOL  GetSCol (float *, float *, int, int)
virtual BMMExport BOOL  PutSCol (WORD *, WORD *, int, int)
virtual BMMExport BOOL  PutSCol (float *, float *, int, int)
virtual BMMExport BOOL  ScaleY (Bitmap *, BMM_Color_64 *, WORD *, WORD *, HWND, int cw=0, int ch=0)
virtual BMMExport BOOL  ScaleY (Bitmap *, BMM_Color_fl *, float *, float *, HWND, int cw=0, int ch=0)
virtual BMMExport BOOL  ScaleX (Bitmap *, BMM_Color_64 *, WORD *, WORD *, HWND, int cw=0, int ch=0)
virtual BMMExport BOOL  ScaleX (Bitmap *, BMM_Color_fl *, float *, float *, HWND, int cw=0, int ch=0)
virtual BMMExport int  StraightCopy (Bitmap *from)=0
virtual BMMExport int  Get16Gray (int x, int y, int pixels, WORD *ptr)=0
virtual BMMExport int  Put16Gray (int x, int y, int pixels, WORD *ptr)=0
virtual BMMExport int  Get16Gray (int x, int y, int pixels, float *ptr)=0
virtual BMMExport int  Put16Gray (int x, int y, int pixels, float *ptr)=0
virtual BMMExport int  GetLinearPixels (int x, int y, int pixels, BMM_Color_64 *ptr)=0
virtual BMMExport int  GetPixels (int x, int y, int pixels, BMM_Color_64 *ptr)=0
virtual BMMExport int  PutPixels (int x, int y, int pixels, BMM_Color_64 *ptr)=0
virtual BMMExport int  GetLinearPixels (int x, int y, int pixels, BMM_Color_fl *ptr)=0
virtual BMMExport int  GetPixels (int x, int y, int pixels, BMM_Color_fl *ptr)=0
virtual BMMExport int  PutPixels (int x, int y, int pixels, BMM_Color_fl *ptr)=0
virtual BMMExport int  GetIndexPixels (int x, int y, int pixels, unsigned char *ptr)=0
virtual BMMExport int  PutIndexPixels (int x, int y, int pixels, unsigned char *ptr)=0
virtual BMMExport int  Fill (const BMM_Color_fl &fillColor)
virtual BMMExport int  Fill (const BMM_Color_64 &fillColor)
virtual BMMExport int  CropImage (int width, int height, BMM_Color_64 fillcolor)=0
virtual BMMExport int  CropImage (int width, int height, BMM_Color_fl fillcolor)=0
virtual BMMExport int  CropImage (int width, int height, int fillindex)=0
virtual BMMExport int  ResizeImage (int width, int height, int newpalette)=0
virtual BMMExport int  CopyCrop (Bitmap *from, BMM_Color_64 fillcolor)=0
virtual BMMExport int  CopyCrop (Bitmap *from, BMM_Color_fl fillcolor)=0
virtual BMMExport int  CopyScaleLow (Bitmap *from)=0
virtual BMMExport int  CopyScaleHigh (Bitmap *from, HWND hWnd, BMM_Color_64 **buf=NULL, int w=0, int h=0)=0
virtual BMMExport int  CopyScaleHigh (Bitmap *from, HWND hWnd, BMM_Color_fl **buf=NULL, int w=0, int h=0)=0
virtual BMMExport int  CopyImage (Bitmap *from, int operation, BMM_Color_64 fillcolor, BitmapInfo *bi=NULL)=0
virtual BMMExport int  CopyImage (Bitmap *from, int operation, BMM_Color_fl fillcolor, BitmapInfo *bi=NULL)=0
virtual BMMExport int  CopyImage (Bitmap *from, int operation, int fillindex)=0
virtual BMMExport int  GetPalette (int start, int count, BMM_Color_48 *ptr)=0
virtual BMMExport int  SetPalette (int start, int count, BMM_Color_48 *ptr)=0
virtual BMMExport int  GetFiltered (float u, float v, float du, float dv, BMM_Color_64 *ptr)=0
virtual BMMExport int  GetFiltered (float u, float v, float du, float dv, BMM_Color_fl *ptr)=0
virtual BMMExport int  Allocate (BitmapInfo *bi, BitmapManager *manager, int openMode)=0
virtual BMMExport int  Connect ()=0
virtual BMMExport int  Disconnect ()=0
virtual BMMExport int  MapReady ()=0
virtual BMMExport int  ClosestColor (BMM_Color_48 color)
virtual BMMExport int  ClosestColor (int r, int g, int b)
virtual BMMExport void *  GetChannel (ULONG channelID, ULONG &chanType)
GBuffer GetGBuffer ()
virtual BMMExport ULONG  CreateChannels (ULONG channelIDs)
virtual BMMExport void  DeleteChannels (ULONG channelIDs)
virtual BMMExport ULONG  ChannelsPresent ()
BMMExport RenderInfo AllocRenderInfo ()
BMMExport RenderInfo GetRenderInfo ()

Static Public Member Functions

static void  ClampColor (BMM_Color_64 &out, const BMM_Color_fl &in)
static void  ClampColorA (BMM_Color_64 &out, const BMM_Color_fl &in)
static BMMExport void  ScaleColor (BMM_Color_64 &out, BMM_Color_fl in)
static void  ScaleColorA (BMM_Color_64 &out, const BMM_Color_fl &in)

Public Attributes

BitmapInfo  bi
MCHAR *  evalString

Protected Attributes

int  openMode
UINT  usageCount
BitmapManager manager
int  flags
int  type
BMM_Color_48  palette [256]
int  paletteSlots
UWORD *  gammaTable
RenderInfo rendInfo
GBuffer gbuffer

Friends

class  GcsBitmap

Constructor & Destructor Documentation

BMMExport BitmapStorage ( )
virtual BMMExport ~BitmapStorage ( ) [virtual]

Member Function Documentation

BMMExport 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.
int HasGamma ( ) [inline]
Remarks:
Implemented by the System.

Returns nonzero if the gamma table has been allocated; otherwise 0.
{ return (gammaTable!=NULL)          ? 1:0; };
BMMExport 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.
void UpdateGammaTable ( )
BMMExport 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.
BitmapManager* Manager ( ) [inline]
Remarks:
Implemented by the System.

Returns the bitmap manager for the storage.
{ return manager;     }
int OpenMode ( ) [inline]
Remarks:
Implemented by the System.

Returns the mode the storage was opened in. See Bitmap Open Mode Types.
{ return openMode;    }
int Width ( ) [inline]
Remarks:
Implemented by the System.

Returns the width (horizontal dimension) of the storage's BitmapInfo instance (bi.Width()).
{ return bi.Width();  }
int Height ( ) [inline]
Remarks:
Implemented by the System.

Returns the height (vertical dimension) of the storage's BitmapInfo instance (bi.Height()).
{ return bi.Height(); }
float Aspect ( ) [inline]
Remarks:
Implemented by the System.

Returns the aspect ratio of the storage's BitmapInfo instance (bi.Aspect()).
{ return bi.Aspect(); }
float Gamma ( ) [inline]
Remarks:
Implemented by the System.

Returns the gamma setting of the storage's BitmapInfo instance (bi.Gamma()).
{ return bi.Gamma();  }
int Paletted ( ) [inline]
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.
{ return (flags & MAP_PALETTED)            ? paletteSlots:0; }
int IsDithered ( ) [inline]
Remarks:
Implemented by the System.

Returns the dithered state of the image. If the image is dithered nonzero is returned; otherwise 0,
{ return (flags & MAP_DITHERED)            ? 1:0; };
int PreMultipliedAlpha ( ) [inline]
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.
{ return (flags & MAP_ALPHA_PREMULTIPLIED) ? 1:0; };
int HasAlpha ( ) [inline]
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.
{ return (flags & MAP_HAS_ALPHA)           ? 1:0; };
void UseScaleColors ( int  on ) [inline]
Remarks:
Implemented by the System.

Set whether colors are scaled (on) or clamped (off) when converting from BMM_Color_fl to BMM_Color_64.
int ScaleColors ( ) [inline]
Remarks:
Implemented by the System.

Returns the last value set by UseScaleColors.
{ return (flags & MAP_USE_SCALE_COLORS)    ? 1:0; };
static void ClampColor ( BMM_Color_64 out,
const BMM_Color_fl in 
) [inline, static]
Remarks:
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.
{ out.r = in.clipColor(in.r); out.g = in.clipColor(in.g); out.b = in.clipColor(in.b); }
static void ClampColorA ( BMM_Color_64 out,
const BMM_Color_fl in 
) [inline, static]
Remarks:
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.
{ ClampColor(out, in); out.a = in.clipColor(in.a); }
static BMMExport void ScaleColor ( BMM_Color_64 out,
BMM_Color_fl  in 
) [static]
Remarks:
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.
static void ScaleColorA ( BMM_Color_64 out,
const BMM_Color_fl in 
) [inline, static]
Remarks:
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.
{ ScaleColor(out, in); out.a = in.clipColor(in.a); }
void ClampScaleColor ( BMM_Color_64 out,
const BMM_Color_fl in 
) [inline]
Remarks:
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.
{ if (ScaleColors()) ScaleColor(out, in); else ClampColor(out, in); }
void ClampScaleColorA ( BMM_Color_64 out,
const BMM_Color_fl in 
) [inline]
Remarks:
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.
{ if (ScaleColors()) ScaleColorA(out, in); else ClampColorA(out, in); }
int UsageCount ( ) [inline]
Remarks:
Implemented by the System.

Returns the number of times this image is being used in the system.
{ return usageCount; };
int Type ( ) [inline]
Remarks:
Implemented by the System.

Returns the type of bitmap managed by this storage. See Bitmap Types.
{ return type; };
int Flags ( ) [inline]
Remarks:
Implemented by the System.

Returns the bitmap flags. See Bitmap Flags.
{ return flags; };
void SetFlags ( DWORD  f ) [inline]
Remarks:
Implemented by the System.

Sets the specified flag bits. See Bitmap Flags.
Parameters:
DWORD f

The flags to set.
{ flags |=  f; }
void ClearFlags ( DWORD  f ) [inline]

Clears the given flags.

virtual BMMExport int MaxRGBLevel ( ) [pure virtual]
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).
virtual BMMExport int MaxAlphaLevel ( ) [pure virtual]
Remarks:
Returns the number of bits per pixel in the alpha channel.
virtual BMMExport int IsHighDynamicRange ( ) [pure virtual]
Remarks:
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.

Implemented in BitmapStorageLDR, and BitmapStorageHDR.

virtual BMMExport void* GetStoragePtr ( int *  type ) [inline, virtual]
Remarks:
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 Bitmap Types.
Default Implementation:
{ *type = BMM_NO_TYPE; return (NULL); }
{ *type = BMM_NO_TYPE; return (NULL); }
virtual BMMExport void* GetAlphaPtr ( int *  type ) [inline, virtual]
Remarks:
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 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.
{ *type = BMM_NO_TYPE; return (NULL); }
virtual BMMExport void Scale ( WORD *  ,
int  ,
WORD *  ,
int   
) [virtual]
virtual BMMExport void Scale ( float *  ,
int  ,
float *  ,
int   
) [virtual]
Remarks:
Implemented by the System.

This method is used internally.
virtual BMMExport BOOL GetSRow ( WORD *  ,
int  ,
WORD *  ,
int   
) [virtual]
virtual BMMExport BOOL GetSRow ( float *  ,
int  ,
float *  ,
int   
) [virtual]
Remarks:
Implemented by the System.

This method is used internally.
virtual BMMExport BOOL PutSRow ( WORD *  ,
int  ,
WORD *  ,
int   
) [virtual]
virtual BMMExport BOOL PutSRow ( float *  ,
int  ,
float *  ,
int   
) [virtual]
Remarks:
Implemented by the System.

This method is used internally.
virtual BMMExport BOOL GetSCol ( WORD *  ,
WORD *  ,
int  ,
int   
) [virtual]
virtual BMMExport BOOL GetSCol ( float *  ,
float *  ,
int  ,
int   
) [virtual]
Remarks:
Implemented by the System.

This method is used internally.
virtual BMMExport BOOL PutSCol ( WORD *  ,
WORD *  ,
int  ,
int   
) [virtual]
virtual BMMExport BOOL PutSCol ( float *  ,
float *  ,
int  ,
int   
) [virtual]
Remarks:
Implemented by the System.

This method is used internally.
virtual BMMExport BOOL ScaleY ( Bitmap ,
BMM_Color_64 ,
WORD *  ,
WORD *  ,
HWND  ,
int  cw = 0,
int  ch = 0 
) [virtual]
virtual BMMExport BOOL ScaleY ( Bitmap ,
BMM_Color_fl ,
float *  ,
float *  ,
HWND  ,
int  cw = 0,
int  ch = 0 
) [virtual]
Remarks:
Implemented by the System.

This method is used internally.
virtual BMMExport BOOL ScaleX ( Bitmap ,
BMM_Color_64 ,
WORD *  ,
WORD *  ,
HWND  ,
int  cw = 0,
int  ch = 0 
) [virtual]
virtual BMMExport BOOL ScaleX ( Bitmap ,
BMM_Color_fl ,
float *  ,
float *  ,
HWND  ,
int  cw = 0,
int  ch = 0 
) [virtual]
Remarks:
Implemented by the System.

This method is used internally.
virtual BMMExport int StraightCopy ( Bitmap from ) [pure virtual]
virtual BMMExport int Get16Gray ( int  x,
int  y,
int  pixels,
WORD *  ptr 
) [pure virtual]
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.
Returns:
Nonzero if pixels were retrieved; otherwise 0.

Implemented in BitmapStorageHDR.

virtual BMMExport int Put16Gray ( int  x,
int  y,
int  pixels,
WORD *  ptr 
) [pure virtual]
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.
Returns:
Nonzero if pixels were stored; otherwise 0.

Implemented in BitmapStorageHDR.

virtual BMMExport int Get16Gray ( int  x,
int  y,
int  pixels,
float *  ptr 
) [pure virtual]
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.
Returns:
Nonzero if pixels were retrieved; otherwise 0.

Implemented in BitmapStorageLDR.

virtual BMMExport int Put16Gray ( int  x,
int  y,
int  pixels,
float *  ptr 
) [pure virtual]
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.
Returns:
Nonzero if pixels were stored; otherwise 0.

Implemented in BitmapStorageLDR.

virtual BMMExport int GetLinearPixels ( int  x,
int  y,
int  pixels,
BMM_Color_64 ptr 
) [pure virtual]
Remarks:
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.
Returns:
Nonzero if pixels were retrieved; otherwise 0.

Implemented in BitmapStorageHDR.

virtual BMMExport int GetPixels ( int  x,
int  y,
int  pixels,
BMM_Color_64 ptr 
) [pure virtual]
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.
Returns:
Returns nonzero if pixels were retrieved; otherwise 0. If storage has not been allocated 0 is returned.

Implemented in BitmapStorageHDR.

virtual BMMExport int PutPixels ( int  x,
int  y,
int  pixels,
BMM_Color_64 ptr 
) [pure virtual]
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.
Returns:
Returns nonzero if pixels were stored; otherwise 0. If storage has not been allocated 0 is returned.

Implemented in BitmapStorageHDR.

virtual BMMExport int GetLinearPixels ( int  x,
int  y,
int  pixels,
BMM_Color_fl ptr 
) [pure virtual]
Remarks:
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.
Returns:
Nonzero if pixels were retrieved; otherwise 0.

Implemented in BitmapStorageLDR.

virtual BMMExport int GetPixels ( int  x,
int  y,
int  pixels,
BMM_Color_fl ptr 
) [pure virtual]
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.
Returns:
Returns nonzero if pixels were retrieved; otherwise 0. If storage has not been allocated 0 is returned.

Implemented in BitmapStorageLDR.

virtual BMMExport int PutPixels ( int  x,
int  y,
int  pixels,
BMM_Color_fl ptr 
) [pure virtual]
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.
Returns:
Returns nonzero if pixels were stored; otherwise 0. If storage has not been allocated 0 is returned.

Implemented in BitmapStorageLDR.

virtual BMMExport int GetIndexPixels ( int  x,
int  y,
int  pixels,
unsigned char *  ptr 
) [pure virtual]
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.
Returns:
Nonzero if pixels were retrieved; otherwise 0.

Implemented in BitmapStorageLDR.

virtual BMMExport int PutIndexPixels ( int  x,
int  y,
int  pixels,
unsigned char *  ptr 
) [pure virtual]
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.
Returns:
Nonzero if pixels were stored; otherwise 0.

Implemented in BitmapStorageLDR.

virtual BMMExport int Fill ( const BMM_Color_fl fillColor ) [virtual]
virtual BMMExport int Fill ( const BMM_Color_64 fillColor ) [virtual]
virtual BMMExport int CropImage ( int  width,
int  height,
BMM_Color_64  fillcolor 
) [pure virtual]
Remarks:
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.
Returns:
Nonzero if the image was cropped; otherwise 0.

Implemented in BitmapStorageHDR.

virtual BMMExport int CropImage ( int  width,
int  height,
BMM_Color_fl  fillcolor 
) [pure virtual]
Remarks:
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.
Returns:
Nonzero if the image was cropped; otherwise 0.

Implemented in BitmapStorageLDR.

virtual BMMExport int CropImage ( int  width,
int  height,
int  fillindex 
) [pure virtual]
Remarks:
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.
Returns:
Nonzero if the image was cropped; otherwise 0.

Implemented in BitmapStorageHDR.

virtual BMMExport int ResizeImage ( int  width,
int  height,
int  newpalette 
) [pure virtual]
Remarks:
This method is no longer used.
virtual BMMExport int CopyCrop ( Bitmap from,
BMM_Color_64  fillcolor 
) [pure virtual]
Remarks:
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.
Returns:
Nonzero if the copy/crop was performed; otherwise zero.

Implemented in BitmapStorageLDR, and BitmapStorageHDR.

virtual BMMExport int CopyCrop ( Bitmap from,
BMM_Color_fl  fillcolor 
) [pure virtual]
Remarks:
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.
Returns:
Nonzero if the copy/crop was performed; otherwise zero.

Implemented in BitmapStorageLDR, and BitmapStorageHDR.

virtual BMMExport int CopyScaleLow ( Bitmap from ) [pure virtual]
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.
Returns:
Nonzero if the copy/scale was performed; otherwise zero.

Implemented in BitmapStorageLDR, and BitmapStorageHDR.

virtual BMMExport int CopyScaleHigh ( Bitmap from,
HWND  hWnd,
BMM_Color_64 **  buf = NULL,
int  w = 0,
int  h = 0 
) [pure virtual]
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.

Implemented in BitmapStorageLDR, and BitmapStorageHDR.

virtual BMMExport int CopyScaleHigh ( Bitmap from,
HWND  hWnd,
BMM_Color_fl **  buf = NULL,
int  w = 0,
int  h = 0 
) [pure virtual]
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.

Implemented in BitmapStorageLDR, and BitmapStorageHDR.

virtual BMMExport int CopyImage ( Bitmap from,
int  operation,
BMM_Color_64  fillcolor,
BitmapInfo bi = NULL 
) [pure virtual]
Remarks:
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.
Returns:
Nonzero if the copy was performed; otherwise 0.

Implemented in BitmapStorageLDR, and BitmapStorageHDR.

virtual BMMExport int CopyImage ( Bitmap from,
int  operation,
BMM_Color_fl  fillcolor,
BitmapInfo bi = NULL 
) [pure virtual]
Remarks:
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.
Returns:
Nonzero if the copy was performed; otherwise 0.

Implemented in BitmapStorageLDR, and BitmapStorageHDR.

virtual BMMExport int CopyImage ( Bitmap from,
int  operation,
int  fillindex 
) [pure virtual]
Remarks:
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.
Returns:
Nonzero if the copy was performed; otherwise 0.

Implemented in BitmapStorageLDR, and BitmapStorageHDR.

virtual BMMExport int GetPalette ( int  start,
int  count,
BMM_Color_48 ptr 
) [pure virtual]
Remarks:
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.
Returns:
Nonzero if the palette was retrieved; otherwise 0.
virtual BMMExport int SetPalette ( int  start,
int  count,
BMM_Color_48 ptr 
) [pure virtual]
Remarks:
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.
Returns:
Nonzero if the palette was stored; otherwise 0.
Sample Code:
See Load() in /MAXSDK/SAMPLES/IO/BMP/BMP.CPP.
virtual BMMExport int GetFiltered ( float  u,
float  v,
float  du,
float  dv,
BMM_Color_64 ptr 
) [pure virtual]
Remarks:
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.

Implemented in BitmapStorageHDR.

virtual BMMExport int GetFiltered ( float  u,
float  v,
float  du,
float  dv,
BMM_Color_fl ptr 
) [pure virtual]
Remarks:
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.

Implemented in BitmapStorageLDR.

virtual BMMExport int Allocate ( BitmapInfo bi,
BitmapManager manager,
int  openMode 
) [pure virtual]
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.
Returns:
Nonzero if storage was allocated; otherwise 0.
virtual BMMExport int Connect ( ) [pure virtual]
virtual BMMExport int Disconnect ( ) [pure virtual]
virtual BMMExport int MapReady ( ) [pure virtual]
virtual BMMExport int ClosestColor ( BMM_Color_48  color ) [virtual]
virtual BMMExport int ClosestColor ( int  r,
int  g,
int  b 
) [virtual]
virtual BMMExport void* GetChannel ( ULONG  channelID,
ULONG &  chanType 
) [inline, virtual]
Remarks:
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 Image (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;}
{ return gbuffer?gbuffer->GetChannel(channelID, chanType):NULL;}
GBuffer* GetGBuffer ( ) [inline]
Remarks:
Returns a pointer to the G-Buffer associated with this storage.
{ return gbuffer; } 
virtual BMMExport ULONG CreateChannels ( ULONG  channelIDs ) [virtual]
Remarks:
Create the specified channels.
Parameters:
ULONG channelIDs

Specifies the channels to create. See Image (G-Buffer) Channels.
Returns:
The channels that are present.
Default Implementation:
{ return 0;}
virtual BMMExport void DeleteChannels ( ULONG  channelIDs ) [inline, virtual]
Remarks:
Delete the specified channels.
Parameters:
ULONG channelIDs

Specifies the channels to delete. See Image (G-Buffer) Channels.
{ if (gbuffer) gbuffer->DeleteChannels(channelIDs); }  
virtual BMMExport ULONG ChannelsPresent ( ) [inline, virtual]
Remarks:
Returns the channels that are present. See Image (G-Buffer) Channels.
Default Implementation:
{ return 0; }
{ return gbuffer?gbuffer->ChannelsPresent():0;  }
BMMExport RenderInfo* AllocRenderInfo ( )
Remarks:
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.
Returns:
A pointer to a RenderInfo. See Class RenderInfo.
BMMExport RenderInfo* GetRenderInfo ( )
Remarks:
Returns a RenderInfo pointer. See Class RenderInfo.

Friends And Related Function Documentation

friend class GcsBitmap [friend]

Member Data Documentation

int openMode [protected]
UINT usageCount [protected]
BitmapManager* manager [protected]
int flags [protected]
int type [protected]
BMM_Color_48 palette[256] [protected]
int paletteSlots [protected]
UWORD* gammaTable [protected]
RenderInfo* rendInfo [protected]
GBuffer* gbuffer [protected]
MCHAR* evalString

BitmapStorage BitmapStorage BitmapStorage BitmapStorage BitmapStorage BitmapStorage BitmapStorage BitmapStorage BitmapStorage BitmapStorage
BitmapStorage BitmapStorage BitmapStorage BitmapStorage BitmapStorage BitmapStorage BitmapStorage BitmapStorage BitmapStorage BitmapStorage