3ds Max C++ API Reference
Loading...
Searching...
No Matches
Bitmap Class Reference

Class for image input and output. More...

#include <bitmap.h>

+ Inheritance diagram for Bitmap:

Public Member Functions

BitmapManagerManager ()
 
BMMExport int Create (BitmapInfo *bi)
 
BMMExport BOOL FixDeviceName (BitmapInfo *bi)
 
int MapReady ()
 
BMMExport void AddOutput (BitmapIO *out)
 
BMMExport void RemoveOutput (BitmapIO *out, BOOL deleteOutput=TRUE)
 
BMMExport BitmapIOFindOutput (BitmapInfo *bi)
 
BMMExport PAVIFILE GetPaviFile (BitmapInfo *bi)
 
voidGetVFBData ()
 
void SetVFBData (void *vfb)
 
int Put16Gray (int x, int y, int pixels, WORD *ptr)
 
voidGetStoragePtr (int *type)
 
voidGetAlphaPtr (int *type)
 
int Get16Gray (int x, int y, int pixels, WORD *ptr)
 
int GetPixels (int x, int y, int pixels, BMM_Color_64 *ptr)
 
BMMExport int PutPixels (int x, int y, int pixels, BMM_Color_64 *ptr)
 
int GetLinearPixels (int x, int y, int pixels, BMM_Color_fl *ptr)
 
int CropImage (int width, int height, BMM_Color_64 fillcolor)
 
int CropImage (int width, int height, BMM_Color_fl fillcolor)
 
int CropImage (int width, int height, int fillindex)
 
int CopyImage (Bitmap *from, int operation, BMM_Color_fl fillcolor, BitmapInfo *bi=nullptr)
 
BMMExport void FilmGrain (float grain, BOOL mask, PBITMAP_FX_CALLBACK callback=nullptr, void *param=nullptr)
 
BMMExport BOOL PrepareGChannels (DWORD channels)
 
BMMExport int GetFiltered (float u, float v, float du, float dv, BMM_Color_64 *ptr)
 
BMMExport int Fill (const BMM_Color_fl &fillColor)
 
BMMExport int Fill (const BMM_Color_64 &fillColor)
 
DWORD GetModifyID () const
 
void SetModifyID (DWORD m)
 
BMMExport void IncrModifyID ()
 
Memory Deallocation
BMMExport void DeleteThis ()
 
Flag Access
DWORD Flags () const
 
void SetFlag (DWORD flag)
 
void ToggleFlag (DWORD flag)
 
void ClearFlag (DWORD flag)
 
Bitmap Properties

The following methods return properties of the bitmap.

When these methods are called, they are passed to the BitmapStorage instance maintained by the Bitmap. The BitmapStorage implements these methods by returning the properties of the BitmapInfo instance maintained by the storage. Therefore, the values returned from the methods represent what is returned from the BitmapInfo instance associated with the Bitmap.

int Width () const
 
int Height () const
 
float Aspect () const
 
float Gamma () const
 
int Paletted () const
 
int IsDithered () const
 
int PreMultipliedAlpha () const
 
int HasAlpha () const
 
int IsHighDynamicRange () const
 
int MaxRGBLevel () const
 
int MaxAlphaLevel () const
 
BMMExport BMMRES GoTo (BitmapInfo *bi)
 
BitmapInfo GetBitmapInfo ()
 
Standard Pixel Access Methods

The following methods access pixel data one scanline at a time.

Thus, x + pixels must be less than the bitmap width.

int Put16Gray (int x, int y, int pixels, float *ptr)
 
int Get16Gray (int x, int y, int pixels, float *ptr)
 
int GetPixels (int x, int y, int pixels, BMM_Color_fl *ptr)
 
BMMExport int PutPixels (int x, int y, int pixels, BMM_Color_fl *ptr)
 
int GetLinearPixels (int x, int y, int pixels, BMM_Color_64 *ptr)
 
int GetIndexPixels (int x, int y, int pixels, BYTE *ptr)
 
int PutIndexPixels (int x, int y, int pixels, BYTE *ptr)
 
Copying / Cropping Methods
int ResizeImage (int width, int height, int newpalette)
 
int CopyImage (Bitmap *from, int operation, BMM_Color_64 fillcolor, BitmapInfo *bi=nullptr)
 
int CopyImage (Bitmap *from, int operation, int fillindex)
 
BMMExport PBITMAPINFO ToDib (int depth=24, UWORD *gam=nullptr, BOOL doDither=FALSE, BOOL displayGamma=FALSE)
 
BMMExport BOOL FromDib (PBITMAPINFO pbmi)
 
Palette Access
int GetPalette (int start, int count, BMM_Color_48 *ptr)
 
int SetPalette (int start, int count, BMM_Color_48 *ptr)
 
Channel Access
voidGetChannel (ULONG channelID, ULONG &chanType)
 
GBufferGetGBuffer ()
 
ULONG CreateChannels (ULONG channelIDs)
 
void DeleteChannels (ULONG channelIDs)
 
ULONG ChannelsPresent ()
 
RenderInfoGetRenderInfo ()
 
RenderInfoAllocRenderInfo ()
 
BMMExport BOOL PrepareGChannels (BitmapInfo *bi)
 
Filtering / Dithering Methods
BMMExport int GetFiltered (float u, float v, float du, float dv, BMM_Color_fl *ptr)
 
BMMExport int SetDither (UINT nDitherType)
 
BMMExport int SetFilter (UINT nFilterType)
 
int HasFilter ()
 
BitmapFilterFilter ()
 
BMMExport int SetStorage (BitmapStorage *pstorage)
 
BitmapStorageStorage ()
 
void NullStorage ()
 
Display (Virtual Frame Buffer) Methods


BMMExport int Display (const MCHAR *title=nullptr, int position=BMM_CN, BOOL autonomous=FALSE, BOOL savebutton=TRUE, CropCallback *crop=nullptr, Bitmap *cloneMyVFB=nullptr)
 
BMMExport int UnDisplay ()
 
BMMExport HWND GetWindow ()
 
BMMExport void RefreshWindow (RECT *rect=nullptr)
 
BMMExport void SetWindowTitle (const MCHAR *title)
 
BMMExport void SetCroppingValues (float u, float v, float w, float h, BOOL placeImage)
 
BMMExport BOOL IsAutonomousVFB () const
 
Handy built-in functions
BMMExport int Fill (int r, int g, int b, int alpha)
 
BMMExport void Print (bool silent=false)
 Print the bitmap (if supported by the host app)
 
BMMExport void ShowProgressLine (int y)
 
Storage Change Notification


BMMExport void SetNotify (BitmapNotify *bmnot=nullptr)
 
BitmapNotifyGetNotify ()
 
Generic Expansion Method
BMMExport INT_PTR Execute (int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0)
 
- Public Member Functions inherited from BaseInterfaceServer
UtilExport BaseInterfaceGetInterface (Interface_ID id) override
 
virtual UtilExport int NumInterfaces () const
 
virtual UtilExport BaseInterfaceGetInterfaceAt (int i) const
 
virtual UtilExport ~BaseInterfaceServer ()
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor.
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Friends

class BitmapManagerImp
 
LRESULT CALLBACK InputWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 

Output / Writing / Closing Methods

void UseScaleColors (int on)
 
int ScaleColors () const
 
void ClampScaleColor (BMM_Color_64 &out, const BMM_Color_fl &in)
 
void ClampScaleColorA (BMM_Color_64 &out, const BMM_Color_fl &in)
 
BMMExport BMMRES OpenOutput (BitmapInfo *bi)
 Opens the image for output.
 
BMMExport BMMRES Write (BitmapInfo *bi, int frame=BMM_SINGLEFRAME)
 Write the image from BitmapStorage to disk.
 
BMMExport BMMRES WriteAll (int frame=BMM_SINGLEFRAME)
 
BMMExport int Close (BitmapInfo *bi, int flag=BMM_CLOSE_COMPLETE)
 
BMMExport int CloseAll (int flag=BMM_CLOSE_COMPLETE)
 
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 void ScaleColor (BMM_Color_64 &out, const BMM_Color_fl &in)
 
static void ScaleColorA (BMM_Color_64 &out, const BMM_Color_fl &in)
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator.
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator.
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary.
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary.
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.
 
- Protected Attributes inherited from BaseInterfaceServer
Tab< BaseInterface * > interfaces
 

Detailed Description

Class for image input and output.

Description:
The Bitmap class is the bitmap itself. All image access is done through this class. The Bitmap class has methods to retrieve properties of the bitmap such as image width, height, whether it is dithered, has an alpha channel, etc. There are methods to retrieve and store pixels from the image. Additional methods allow a developer to copy bitmaps. This class also has methods to open outputs and write multi-frame files. All methods of this class are implemented by the system.
\par Examples 
The following is some examples of how to write some files out to disk:
To write a single image to a file/device, first create the Create BitmapInfo class: 
\code
BitmapInfo bi;
\endcode
Then define the output file or device:
\code
bi.SetName("file.tga");
\endcode
or use the BitmapManager:
\code
BitmapManager::SelectFileOutput( ... &bi ...)
\endcode
Then define your parameters for the Bitmap:
\code
bi.SetWidth(x)
bi.SetHeight(y)
etc...
\endcode
Then create the Bitmap:
\code
Bitmap* map = BitmapManager::Create(&bi);
\endcode
Then do something with the bitmap:
\code
map->Fill({0,0,0});
\endcode
Then you actually open, write and close the bitmap:
\code
map->OpenOutput(&bi);
map->Write(&bi);
map->Close(&bi);
map->DeleteThis();
\endcode

\par
To write a multi-frame file, just keep doing something different to
the Bitmap and keep writing. 
\par
To write a sequence of images to a file/device.
Create BitmapInfo class
\code
BitmapInfo bi;
\endcode
Define the output file/device, either directly
\code
bi.SetName(_T("E:\Renders\file.tga"));
\endcode
or using the user interface.
\code
BitmapManager::SelectFileOutput( ... &bi ...);
\endcode
The customize or define the BitmapInfo:
\code
bi.SetWidth(x)
bi.SetHeight(y)
bi.SetFirstFrame(0)
bi.SetLastFrame(29)
etc...
\endcode
Then create the Bitmap
\code
Bitmap* map = BitmapManager::Create(&bi);
\endcode
Then open the Bitmap for writing
\code
map->OpenOutput(&bi);
for (int x = 0; x < 29; x++)
{
    ## Do something to image...
    map->Write(&bi,x);
}
map->Close(&bi);
map->DeleteThis();
\endcode

\par
Note that in a localized environment there is no need to call BitmapInfo::SetDevice. This is because
calling Bitmap::OpenOutput will automatically determine the device type or BitmapIO type 
based off of the extension of the filename. 
Another alternative to manually setting the device type that even works in a localized environment is to
call BitmapInfo::FixDeviceName which will find the correct BitmapIO type based off of the extension.

\par
Note: You can add any number of outputs to a bitmap. Just keep
calling map->OpenInput() with different outputs (Targa file AND
Frame Buffer for instance). To write or close a specific output,
use Write()  and Close().  To write  and close them all at once,
use WriteAll() and CloseAll().

\par 
It is ok to use WriteAll() and CloseAll() if you have just one output defined.
See also
Class BitmapManager, Class BitmapInfo, Class BitmapStorage, Class GBuffer, Working with Bitmaps.

Member Function Documentation

◆ Manager()

BitmapManager * Manager ( )
inline
Remarks
Returns a pointer to the bitmap manager being used.
4079{ return manager; };

◆ Create()

BMMExport int Create ( BitmapInfo bi)

◆ FixDeviceName()

BMMExport BOOL FixDeviceName ( BitmapInfo bi)

◆ MapReady()

int MapReady ( )
inline
4085{ if (storage) return storage->MapReady(); return 0; };
virtual BMMExport int MapReady()=0

◆ AddOutput()

BMMExport void AddOutput ( BitmapIO out)

◆ RemoveOutput()

BMMExport void RemoveOutput ( BitmapIO out,
BOOL  deleteOutput = TRUE 
)

◆ FindOutput()

BMMExport BitmapIO * FindOutput ( BitmapInfo bi)

◆ GetPaviFile()

BMMExport PAVIFILE GetPaviFile ( BitmapInfo bi)

◆ GetVFBData()

void * GetVFBData ( )
inline
4092{ return vfbData; }

◆ SetVFBData()

void SetVFBData ( void vfb)
inline
4093{ vfbData = vfb; }

◆ DeleteThis()

BMMExport void DeleteThis ( )
Remarks
This method should be called to free the Bitmap. Note that you should not invoke ~Bitmap() directly by calling delete on the Bitmap as was done in 3ds Max1.x. An assert will be raised if you call delete on a Bitmap directly. Instead use this method.

◆ Flags()

DWORD Flags ( ) const
inline
Remarks
Returns the state of the bitmap flags. These flags describe properties of the bitmap such as if the bitmap is flipped horizontally or inverted vertically, is paletted, is dithered, etc. See Bitmap Flags.
4112{ return flags; };

◆ SetFlag()

void SetFlag ( DWORD  flag)
inline
Remarks
Sets the specified flag bit(s).
Parameters:
DWORD flag

The flag(s) to set. See Bitmap Flags.
4117{ flags |= flag; };

◆ ToggleFlag()

void ToggleFlag ( DWORD  flag)
inline
Remarks
Toggles the specified flag bit(s) on/off.
Parameters:
DWORD flag

The flag(s) to toggle. See Bitmap Flags.
4122{ flags ^= flag; };

◆ ClearFlag()

void ClearFlag ( DWORD  flag)
inline
Remarks
Clears the specified flag bit(s) (sets them to zero).
Parameters:
DWORD flag

The flag(s) to clear. See Bitmap Flags.
4127{ flags &= (~flag); };

◆ Width()

int Width ( ) const
inline
Remarks
Returns the width of the bitmap (the horizontal dimension).
Returns
If storage has been allocated the width of the bitmap; otherwise 0.
4140{ if (storage) return storage->Width(); return 0; }
int Width() const
Definition: bitmap.h:2480

◆ Height()

int Height ( ) const
inline
Remarks
Returns the height (vertical dimension) of the bitmap.
Returns
If storage has been allocated the height of the bitmap; otherwise 0.
4144{ if (storage) return storage->Height(); return 0; }
int Height() const
Definition: bitmap.h:2484

◆ Aspect()

float Aspect ( ) const
inline
Remarks
Returns the aspect ratio of the bitmap.
Returns
If storage has been allocated the aspect ratio of the bitmap; otherwise 0.0f.
4148{ if (storage) return storage->Aspect(); return (float)0.0; }
float Aspect() const
Definition: bitmap.h:2488

◆ Gamma()

float Gamma ( ) const
inline
Remarks
Returns the gamma value for the bitmap.
Returns
If storage has been allocated the gamma of the bitmap; otherwise 0.0f.
4152{ if (storage) return storage->Gamma(); return (float)0.0; }
float Gamma() const
Definition: bitmap.h:2492

◆ Paletted()

int Paletted ( ) const
inline
Remarks
Returns whether the bitmap uses a palette (is not true color).
Returns
If storage has been allocated returns nonzero if the bitmap uses a palette (returns the number of palette slots used); otherwise 0.
4157{ if (storage) return storage->Paletted(); return 0; }
int Paletted() const
Definition: bitmap.h:2497

◆ IsDithered()

int IsDithered ( ) const
inline
Remarks
Returns whether the bitmap is dithered or not.
Returns
If storage has been allocated returns nonzero if the bitmap is dithered; otherwise 0.
4161{ if (storage) return storage->IsDithered(); return 0; }
int IsDithered() const
Definition: bitmap.h:2501

◆ PreMultipliedAlpha()

int PreMultipliedAlpha ( ) const
inline
Remarks
Returns whether the bitmap uses pre-multiplied alpha.
Returns
If storage has been allocated returns nonzero if the bitmap uses pre-multiplied alpha; otherwise 0.
4165{ if (storage) return storage->PreMultipliedAlpha(); return 0; }
int PreMultipliedAlpha() const
Definition: bitmap.h:2505

◆ HasAlpha()

int HasAlpha ( ) const
inline
Remarks
Returns whether the bitmap has an alpha channel.
Returns
If storage has been allocated returns nonzero if the bitmap has an alpha channel; otherwise 0.
4169{ if (storage) return storage->HasAlpha(); return 0; };
int HasAlpha() const
Definition: bitmap.h:2509

◆ IsHighDynamicRange()

int IsHighDynamicRange ( ) const
inline
Remarks
Returns nonzero if this is a bitmap that supports high dynamic range data; zero if it doesn't.
4172{ if (storage) return storage->IsHighDynamicRange(); return 0; }
virtual BMMExport int IsHighDynamicRange()=0

◆ MaxRGBLevel()

int MaxRGBLevel ( ) const
inline
Remarks
This method returns the number of bits per pixel for each color component. For example a 24-bit TARGA has a MaxRGBLevel() of
4176{ if (storage) return storage->MaxRGBLevel(); return 0; }
virtual BMMExport int MaxRGBLevel()=0

◆ MaxAlphaLevel()

int MaxAlphaLevel ( ) const
inline
Remarks
Implemented by the System.

Returns the number of bits per pixel in the alpha channel.
Returns
If storage has not been allocated returns 0.
4180{ if (storage) return storage->MaxAlphaLevel(); return 0; }
virtual BMMExport int MaxAlphaLevel()=0

◆ GoTo()

BMMExport BMMRES GoTo ( BitmapInfo bi)
Remarks
This method is used with multi-frame bitmaps (FLI's, AVI's, DDR devices, etc.). It is used to load a frame to replace a previously saved image. To define the desired frame, use:

bi->SetCurrentFrame(frame);
Parameters:
BitmapInfo *bi

A pointer to the BitmapInfo. The frame number information is passed here.
Returns
If used with single frame drivers or if the driver doesn't support this function, it returns BMMRES_SINGLEFRAME. If the return value is BMMRES_SUCCESS, a new frame has been loaded into the given bitmap.

◆ GetBitmapInfo()

BitmapInfo GetBitmapInfo ( )
inline
Remarks
Implemented by the System.

Returns a copy of the BitmapInfo instance maintained by the storage.
Returns
If the BitmapInfo instance maintained by the storage.
4212{ if (storage) return storage->bi; return BitmapInfo(); };
Information about an image file or in-memory bitmap, including settings for loading/saving,...
Definition: bitmap.h:707
BitmapInfo bi
Definition: bitmap.h:2434

◆ UseScaleColors()

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. If storage is not allocated, does nothing.
4222{ if (storage) storage->UseScaleColors(on); };
void UseScaleColors(int on)
Definition: bitmap.h:2513

◆ ScaleColors()

int ScaleColors ( ) const
inline
Remarks
Implemented by the System.

Returns the last value set by UseScaleColors. If storage is not allocated, returns 0.
4226{ if (storage) return storage->ScaleColors(); return 0; };
int ScaleColors() const
Definition: bitmap.h:2516

◆ ClampColor()

static void ClampColor ( BMM_Color_64 out,
const BMM_Color_fl in 
)
inlinestatic
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.
4235{ BitmapStorage::ClampColor(out, in); }
static void ClampColor(BMM_Color_64 &out, const BMM_Color_fl &in)
Definition: bitmap.h:2525

◆ ClampColorA()

static void ClampColorA ( BMM_Color_64 out,
const BMM_Color_fl in 
)
inlinestatic
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.
4243{ BitmapStorage::ClampColorA(out, in); }
static void ClampColorA(BMM_Color_64 &out, const BMM_Color_fl &in)
Definition: bitmap.h:2533

◆ ScaleColor()

static void ScaleColor ( BMM_Color_64 out,
const BMM_Color_fl in 
)
inlinestatic
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.
4253{ BitmapStorage::ScaleColor(out, in);}
static BMMExport void ScaleColor(BMM_Color_64 &out, BMM_Color_fl in)

◆ ScaleColorA()

static void ScaleColorA ( BMM_Color_64 out,
const BMM_Color_fl in 
)
inlinestatic
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.
4261{ BitmapStorage::ScaleColorA(out, in);}
static void ScaleColorA(BMM_Color_64 &out, const BMM_Color_fl &in)
Definition: bitmap.h:2550

◆ ClampScaleColor()

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. If the storage is not allocated, the clamping is performed.
Parameters:
BMM_Color_64& out

The result of the conversion.

BMM_Color_fl& in

The value to convert.
4271{ if (storage) storage->ClampScaleColor(out, in); else ClampColor(out, in); }
static void ClampColor(BMM_Color_64 &out, const BMM_Color_fl &in)
Definition: bitmap.h:4235
void ClampScaleColor(BMM_Color_64 &out, const BMM_Color_fl &in) const
Definition: bitmap.h:2559

◆ ClampScaleColorA()

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. If the storage is not allocated, the clamping is performed.
Parameters:
BMM_Color_64& out

The result of the conversion.

BMM_Color_fl& in

The value to convert.
4281{ if (storage) storage->ClampScaleColorA(out, in); else ClampColorA(out, in); }
static void ClampColorA(BMM_Color_64 &out, const BMM_Color_fl &in)
Definition: bitmap.h:4243
void ClampScaleColorA(BMM_Color_64 &out, const BMM_Color_fl &in) const
Definition: bitmap.h:2568

◆ Put16Gray() [1/2]

int Put16Gray ( int  x,
int  y,
int  pixels,
WORD *  ptr 
)
inline
4285 { if (storage) return storage->Put16Gray(x,y,pixels,ptr); return 0; };
virtual BMMExport int Put16Gray(int x, int y, int pixels, WORD *ptr)=0
controller mat max min numsubs x z controller keys x z controller keys x
Definition: generics.inl:212

◆ Put16Gray() [2/2]

int Put16Gray ( int  x,
int  y,
int  pixels,
float *  ptr 
)
inline
Remarks
Stores the specified 16-bit pixel values into the bitmap. The pixel value 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.

float *ptr

Pixel values to store.
Returns
Returns nonzero if pixels were stored; otherwise 0. If storage has not been allocated 0 is returned.
4308 { if (storage) return storage->Put16Gray(x,y,pixels,ptr); return 0; };

◆ Get16Gray() [1/2]

int Get16Gray ( int  x,
int  y,
int  pixels,
float *  ptr 
)
inline
Remarks
Retrieves the specified 16-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.

float *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.
4325 { if (storage) return storage->Get16Gray(x,y,pixels,ptr); return 0; };
virtual BMMExport int Get16Gray(int x, int y, int pixels, WORD *ptr)=0

◆ GetPixels() [1/2]

int GetPixels ( int  x,
int  y,
int  pixels,
BMM_Color_fl ptr 
)
inline
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. See Structure BMM_Color_fl.
Returns
Returns nonzero if pixels were retrieved; otherwise 0. If storage has not been allocated 0 is returned.
4343 { if (storage) return storage->GetPixels(x,y,pixels,ptr); return 0; };
virtual BMMExport int GetPixels(int x, int y, int pixels, BMM_Color_64 *ptr)=0

◆ PutPixels() [1/2]

BMMExport 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. See Structure BMM_Color_fl.
Returns
Returns nonzero if pixels were stored; otherwise 0. If storage has not been allocated 0 is returned.

◆ GetLinearPixels() [1/2]

int GetLinearPixels ( int  x,
int  y,
int  pixels,
BMM_Color_64 ptr 
)
inline
Remarks
Retrieves the specified 64-bit pixel values from the bitmap. These pixels are NOT gamma corrected (i.e. they have linear gamma
  • 1.0). 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.
4380 { if (storage) return storage->GetLinearPixels(x,y,pixels,ptr); return 0; };
virtual BMMExport int GetLinearPixels(int x, int y, int pixels, BMM_Color_64 *ptr)=0

◆ GetIndexPixels()

int GetIndexPixels ( int  x,
int  y,
int  pixels,
BYTE *  ptr 
)
inline
Remarks
Retrieves the specified pixels from the paletted bitmap. The palette for the image may be accessed using GetPalette(). 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.

BYTE *ptr

Pointer to storage for the pixel values.
Returns
Returns nonzero if pixels were retrieved; otherwise 0. If storage has not been allocated 0 is returned.
4397 { if (storage) return storage->GetIndexPixels(x,y,pixels,ptr); return 0; };
virtual BMMExport int GetIndexPixels(int x, int y, int pixels, unsigned char *ptr)=0

◆ PutIndexPixels()

int PutIndexPixels ( int  x,
int  y,
int  pixels,
BYTE *  ptr 
)
inline
Remarks
Stores the pixels into the specified location of the paletted bitmap. The pixel value 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.

BYTE *ptr

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

4416 { if (storage) return storage->PutIndexPixels(x,y,pixels,ptr); return 0; };
virtual BMMExport int PutIndexPixels(int x, int y, int pixels, unsigned char *ptr)=0

◆ GetStoragePtr()

void * GetStoragePtr ( int type)
inline
4420 { if (storage) return storage->GetStoragePtr(type); return nullptr; };
virtual BMMExport void * GetStoragePtr(int *bmmType)
Definition: bitmap.h:2608

◆ GetAlphaPtr()

void * GetAlphaPtr ( int type)
inline
4422 { if (storage) return storage->GetAlphaPtr(type); return nullptr; };
virtual BMMExport void * GetAlphaPtr(int *bmmType)
Definition: bitmap.h:2622

◆ Get16Gray() [2/2]

int Get16Gray ( int  x,
int  y,
int  pixels,
WORD *  ptr 
)
inline
4424 { if (storage) return storage->Get16Gray(x,y,pixels,ptr); return 0; };

◆ GetPixels() [2/2]

int GetPixels ( int  x,
int  y,
int  pixels,
BMM_Color_64 ptr 
)
inline
4426 { if (storage) return storage->GetPixels(x,y,pixels,ptr); return 0; };

◆ PutPixels() [2/2]

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

◆ GetLinearPixels() [2/2]

int GetLinearPixels ( int  x,
int  y,
int  pixels,
BMM_Color_fl ptr 
)
inline
4429 { if (storage) return storage->GetLinearPixels(x,y,pixels,ptr); return 0; };

◆ CropImage() [1/3]

int CropImage ( int  width,
int  height,
BMM_Color_64  fillcolor 
)
inline
4432 { if (storage) return storage->CropImage(width,height,fillcolor); return 0; };
virtual BMMExport int CropImage(int width, int height, BMM_Color_64 fillcolor)=0

◆ CropImage() [2/3]

int CropImage ( int  width,
int  height,
BMM_Color_fl  fillcolor 
)
inline
4434 { if (storage) return storage->CropImage(width,height,fillcolor); return 0; };

◆ CropImage() [3/3]

int CropImage ( int  width,
int  height,
int  fillindex 
)
inline
4436 { if (storage) return storage->CropImage(width,height,fillindex); return 0; };

◆ ResizeImage()

int ResizeImage ( int  width,
int  height,
int  newpalette 
)
inline
Remarks
This method is not currently implemented.
4442 { if (storage) return storage->ResizeImage(width,height,newpalette);return 0; };
virtual BMMExport int ResizeImage(int width, int height, int newpalette)=0

◆ CopyImage() [1/3]

int CopyImage ( Bitmap from,
int  operation,
BMM_Color_64  fillcolor,
BitmapInfo bi = nullptr 
)
inline
Remarks
This method is not currently implemented.
4445 { if (storage) return storage->CopyImage(from,operation,fillcolor,bi); return 0; };
virtual BMMExport int CopyImage(Bitmap *from, int operation, BMM_Color_64 fillcolor, BitmapInfo *bmInfo=nullptr)=0

◆ CopyImage() [2/3]

int CopyImage ( Bitmap from,
int  operation,
int  fillindex 
)
inline
Remarks
Copies the specified bitmap to this bitmap.
Parameters:
Bitmap *from

The source bitmap.

int operation

The type of copy to perform. See Copy Image Operations 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.
4459 { if (storage) return storage->CopyImage(from,operation,fillindex); return 0; };

◆ CopyImage() [3/3]

int CopyImage ( Bitmap from,
int  operation,
BMM_Color_fl  fillcolor,
BitmapInfo bi = nullptr 
)
inline
Remarks
Copies the specified bitmap to this bitmap.
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 = 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.
Returns
Nonzero if the copy was performed; otherwise 0.
4487 { if (storage) return storage->CopyImage(from,operation,fillcolor,bi); return 0; };

◆ GetPalette()

int GetPalette ( int  start,
int  count,
BMM_Color_48 ptr 
)
inline
Remarks
Retrieves a portion of the palette from the bitmap.
Parameters:
int start

The index into the palette of where to begin retrieving palette entries.

int count

The number of palette entries to retrieve.

BMM_Color_48 *ptr

Storage for the palette entries. See Structure BMM_Color_48.
Returns
Nonzero if the palette entries were retrieved; otherwise 0.
4504 { if (storage) return storage->GetPalette(start,count,ptr); return 0; };
virtual BMMExport int GetPalette(int start, int count, BMM_Color_48 *ptr)=0

◆ SetPalette()

int SetPalette ( int  start,
int  count,
BMM_Color_48 ptr 
)
inline
Remarks
Sets the specified portion of the palette of this bitmap.
Parameters:
int start

The index into the palette of where to begin storing palette entries.

int count

The number of palette entries to store.

BMM_Color_48 *ptr

The palette entries to store. See Structure BMM_Color_48.
Returns
Nonzero if the palette entries were stored; otherwise 0.
4517 { if (storage) return storage->SetPalette(start,count,ptr); return 0; };
virtual BMMExport int SetPalette(int start, int count, BMM_Color_48 *ptr)=0

◆ FilmGrain()

BMMExport void FilmGrain ( float  grain,
BOOL  mask,
PBITMAP_FX_CALLBACK  callback = nullptr,
void param = nullptr 
)

◆ GetChannel()

void * GetChannel ( ULONG  channelID,
ULONG &  chanType 
)
inline
Remarks
Returns a pointer to the specified channel of the bitmap, and determines its type in terms of bits per pixel.
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_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
4554 { if (storage) return storage->GetChannel(channelID, chanType); return nullptr; }
virtual BMMExport void * GetChannel(ULONG channelID, ULONG &chanType)
Definition: bitmap.h:3117

◆ GetGBuffer()

GBuffer * GetGBuffer ( )
inline
Remarks
Returns a pointer to the GBuffer for the bitmap (or NULL if none).
4557{ return storage? storage->GetGBuffer(): nullptr; }
GBuffer * GetGBuffer()
Definition: bitmap.h:3121

◆ CreateChannels()

ULONG CreateChannels ( ULONG  channelIDs)
inline
Remarks
This method creates the specified channels. After creation, these may be accessed using void *GetChannel().
Parameters:
ULONG channelIDs

Specifies the channels to create. See Image (G-Buffer) Channels.
Returns
The channels that are present.
4566 { if (storage) return storage->CreateChannels(channelIDs); return 0; }
virtual BMMExport ULONG CreateChannels(ULONG channelIDs)

◆ DeleteChannels()

void DeleteChannels ( ULONG  channelIDs)
inline
Remarks
Delete the specified channels.
Parameters:
ULONG channelIDs

Specifies the channels to delete. See Image (G-Buffer) Channels.
4573 { if (storage) storage->DeleteChannels(channelIDs); }
virtual BMMExport void DeleteChannels(ULONG channelIDs)
Definition: bitmap.h:3138

◆ ChannelsPresent()

ULONG ChannelsPresent ( )
inline
Remarks
Returns the channels that are present. See Image (G-Buffer) Channels.
4577 { if (storage) return storage->ChannelsPresent(); return 0; }
virtual BMMExport ULONG ChannelsPresent()
Definition: bitmap.h:3144

◆ GetRenderInfo()

RenderInfo * GetRenderInfo ( )
inline
Remarks
This is used internally. It returns a pointer to the RenderInfo associated with the storage if available; otherwise NULL. See Class RenderInfo.
4581{ if (storage) return storage->GetRenderInfo(); return nullptr; }
BMMExport RenderInfo * GetRenderInfo()

◆ AllocRenderInfo()

RenderInfo * AllocRenderInfo ( )
inline
Remarks
This is used internally. It returns a pointer to the RenderInfo instance allocated by the storage. If this could not be allocated NULL is returned. See Class RenderInfo.
4586{ if (storage) return storage->AllocRenderInfo(); return nullptr; }
BMMExport RenderInfo * AllocRenderInfo()

◆ PrepareGChannels() [1/2]

BMMExport BOOL PrepareGChannels ( BitmapInfo bi)
Remarks
This method is used internally. This method will check with the plug-in (file or device) defined in the given BitmapInfo and prepare (create) the proper channels. If a given channel already exists, no new channel will be created. After creating a bitmap, use this function to define the optional channels that may be required by the given handler.
Parameters:
BitmapInfo *bi

Points to an instance of BitmapInfo that defines the properties of the image.
Returns
TRUE if the channels were created; otherwise FALSE.

◆ PrepareGChannels() [2/2]

BMMExport BOOL PrepareGChannels ( DWORD  channels)

◆ GetFiltered() [1/2]

BMMExport int GetFiltered ( float  u,
float  v,
float  du,
float  dv,
BMM_Color_64 ptr 
)

◆ GetFiltered() [2/2]

BMMExport int GetFiltered ( float  u,
float  v,
float  du,
float  dv,
BMM_Color_fl ptr 
)
Remarks
This method uses summed area table or pyramidal filtering to compute an averaged color over the specified area. You must have a filter plugged in for this to work. See SetFilter() below.
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. See Structure BMM_Color_fl.
Remarks
This method uses summed area table or pyramidal filtering to compute an averaged color over the specified area. You must have a filter plugged in for this to work. See SetFilter() below.
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.

◆ SetDither()

BMMExport int SetDither ( UINT  nDitherType)
Remarks
Sets the type of dithering used on the bitmap.
Parameters:
UINT nDitherType

The type of dither to perform.

BMM_DITHER_NONE

Specifies no dithering is to be performed.

BMM_DITHER_FLOYD

Specifies the Floyd-Steinberg dithering algorithm.
Returns
Nonzero if the bitmap dithering was set; otherwise 0.

◆ SetFilter()

BMMExport int SetFilter ( UINT  nFilterType)
Remarks
Establishes a filtering algorithm to be used by the bitmap.
Parameters:
UINT nFilterType

See Bitmap Filter Types.
Returns
Nonzero if the bitmap filtering was set; otherwise 0.

◆ HasFilter()

int HasFilter ( )
inline
Remarks
Determines if the bitmap has a filter.
Returns
Returns nonzero if the bitmap has a filter; otherwise 0.
4661{ return (filter) ? 1:0; };

◆ Filter()

BitmapFilter * Filter ( )
inline
Remarks
This method is used internally. It returns a pointer to the bitmap filter used by the bitmap.
4664{ return filter; };

◆ SetStorage()

BMMExport int SetStorage ( BitmapStorage pstorage)
Remarks
Establishes a bitmap storage to manage this bitmap.
Parameters:
BitmapStorage *pstorage

The storage to manage the bitmap.
Returns
Nonzero if the storage was assigned; otherwise 0.

◆ Storage()

BitmapStorage * Storage ( )
inline
Remarks
Returns the storage that is managing this bitmap.
Returns
A pointer to the storage.
4673{ return storage; };

◆ NullStorage()

void NullStorage ( )
inline
Remarks
Sets the storage pointer to nullptr.
4675{ storage = nullptr; };

◆ ToDib()

BMMExport PBITMAPINFO ToDib ( int  depth = 24,
UWORD gam = nullptr,
BOOL  doDither = FALSE,
BOOL  displayGamma = FALSE 
)
Remarks
Creates a new Windows Device Independent Bitmap (DIB) and returns a pointer to it. The DIB bitmap is created from this Bitmap. The DIB is allocated using LocalAlloc(). The pseudo-code below show how one may be created and freed. Note that the DIB is never used or accessed inside 3ds Max (the call to ToDib() is the first and last time that 3ds Max sees this pointer):

PBITMAPINFO pDib;
pDib = bitmap-\>ToDib();
...
BMMExport PBITMAPINFO ToDib(int depth=24, UWORD *gam=nullptr, BOOL doDither=FALSE, BOOL displayGamma=FALSE)
When you are done using the DIB call:

LocalFree(pDib);
Parameters:
int depth = 24

The bitmap depth; either 24 (BGR) or 32 (BGRO). If not specified the default is 24.

UWORD *gam=NULL

Specifies a pointer to an optional gamma table that is used to apply gamma correction to the color components as part of the conversion to a DIB. The table has RCOLN entries.

BOOL doDither=FALSE

Specifies if a random dither is applied when reducing the color components from 16 bits per channel to 8 bits per channel (to reduce banding effects).

BOOL displayGamma=FALSE

Specifies whether the output should be color corrected for screen display. If so, the gamma table parameter is ignored, and the DIB is color corrected using display gamma or LUT, as necessary.

◆ FromDib()

BMMExport BOOL FromDib ( PBITMAPINFO  pbmi)
Remarks
Converts the DIB to this bitmap's storage type. This bitmap's storage must already be allocated or the call will fail. The source must be 16, 24 or 32 bit. You cannot use an 8 bit DIB.
Parameters:
PBITMAPINFO pbmi

The source bitmap.
Returns
TRUE if the conversion was performed; otherwise FALSE.

◆ OpenOutput()

BMMExport BMMRES OpenOutput ( BitmapInfo bi)

Opens the image for output.

Remarks
This method will open the image for output. This allows the image to be written to. Note that you can pass a BitmapInfo to this method on which you simply set the file name 'by hand' (bi->SetName(_T("D:\renders\output.jpg"))). This will work and the correct driver (i.e. BitmapIO) will be selected based on the filename extension. This will work even in a localized environment, therefore there is no need to manually call BitmapInfo::SetDevice on the BitmapInfo that is passed to this function. However you won't be able to set any driver specific settings (such as compression settings for JPEGs). The alternative way is to use the BitmapManger methods.
Parameters
bi- Contains the name of the image or device to open for output.
Returns

BMMRES_SUCCESS - Indicates success.

BMMRES_ERRORTAKENCARE - Indicates that 3ds Max could not find a device to handle the image.

BMMRES_INTERNALERROR - Indicates the IO module handling the image could not be opened for writing.

◆ Write()

BMMExport BMMRES Write ( BitmapInfo bi,
int  frame = BMM_SINGLEFRAME 
)

Write the image from BitmapStorage to disk.

Remarks
Write the image from the BitmapStorage to disk. Note that you must pass the same BitmapInfo used when the file was first "Opened for Output". The main reason is that any device specific settings are kept in the BitmapInfo object. Also, the custom options such as gamma value, optional channels, etc (if any) are kept in this BitmapInfo instance. These are assigned when the bitmap is first opened (for either read or write).
Parameters
bi- Contains the name of the file or device to write to.
frame- Specifies the frame number to write. If this is a single image, allow frame to default to single frame. This argument determines if the file will have the frame number appended to it. If you want the file to have a normal name (no frame number attached to it), you must set the frame argument to BMM_SINGLEFRAME (the default). Any other value is considered to be a frame number and it will be appended to the given filename.
Returns
BMMRES_SUCCESS - Indicates success.

BMMRES_ERRORTAKENCARE - Indicates that 3ds Max could not find a device to handle the image.

BMMRES_INTERNALERROR - Indicates the IO module handling the image could not be opened for writing.

◆ WriteAll()

BMMExport BMMRES WriteAll ( int  frame = BMM_SINGLEFRAME)
Remarks
Write the image to all the open outputs.
Parameters:
DWORD frame = BMM_SINGLEFRAME

Specifies the frame number to write. If this is a single image, allow frame to default to single frame.
Returns
BMMRES_SUCCESS

Indicates success.

BMMRES_ERRORTAKENCARE

Indicates that 3ds Max could not find a device to handle the image.

BMMRES_INTERNALERROR

Indicates the IO module handling the image could not be opened for writing.

◆ Close()

BMMExport int Close ( BitmapInfo bi,
int  flag = BMM_CLOSE_COMPLETE 
)
Remarks
Close the bitmap. This means the bitmap is no longer open for writing.
Parameters:
BitmapInfo *bi

Identifies the bitmap to close.

int flag = BMM_CLOSE_COMPLETE

See Bitmap Close Types.
Returns
Nonzero if the image output was closed without error; otherwise 0.

◆ CloseAll()

BMMExport int CloseAll ( int  flag = BMM_CLOSE_COMPLETE)
Remarks
Closes all the open outputs.
Parameters:
int flag = BMM_CLOSE_COMPLETE

See Bitmap Close Types.
Returns
Nonzero if the image outputs were closed without error; otherwise 0.

◆ Display()

BMMExport int Display ( const MCHAR title = nullptr,
int  position = BMM_CN,
BOOL  autonomous = FALSE,
BOOL  savebutton = TRUE,
CropCallback crop = nullptr,
Bitmap cloneMyVFB = nullptr 
)
Remarks
This method creates a window for the display of this bitmap and displays it.
Parameters:
MCHAR *title = NULL

The title to display in the title bar of the window.

int position = BMM_CN

Specifies how the bitmap should be positioned. One of the following values:

BMM_UL - Upper Left

BMM_LL - Lower Left

BMM_UR - Upper Right

BMM_LR - Lower Right

BMM_CN - Center

BMM_RND - Used internally. Renderer location.

BMM_VPP - Used internally. Video Post Primary location.

BMM_VPS - Used internally. Video Post Secondary location.

BOOL autonomous = FALSE

This is reserved for internal use, always let it default to FALSE.

BOOL savebutton = TRUE

This is reserved for internal use, always let it default to TRUE.

CropCallback *crop=NULL

This parameter is available in release 2.0 and later only.

When non-NULL this will cause the VFB to display, instead of its normal toolbar, a set of sliders for adjusting cropping and also will allow interactive adjustment of the cropping rectangle in the image window. See Class CropCallback.

Bitmap *cloneMyVFB = NULL

This parameter is available in release 4.0 and later only.

A pointer to a bitmap to clone the VFB to.
Returns
Nonzero if the bitmap was displayed; otherwise 0.

◆ UnDisplay()

BMMExport int UnDisplay ( )
Remarks
Close the display window associated with this bitmap (if any).
Returns
Always returns nonzero.

◆ GetWindow()

BMMExport HWND GetWindow ( )
Remarks
Get the window handle for the displayed bitmap.
Returns
Returns the window handle, or NULL if it's not displayed in a window.

◆ RefreshWindow()

BMMExport void RefreshWindow ( RECT *  rect = nullptr)
Remarks
Refreshes the interior of the display window with the bitmap contents. In release 3.0 and later this method respects the Bitmap::ShowProgressLine() setting. See that method for more details.
Parameters:
RECT *rect = NULL

The region of the display window to refresh (specified in image coordinates). If the pointer is NULL the entire window is refreshed.

◆ SetWindowTitle()

BMMExport void SetWindowTitle ( const MCHAR title)
Remarks
Sets the title displayed in the display window's title bar.
Parameters:
MCHAR *title

The title to display.

◆ SetCroppingValues()

BMMExport void SetCroppingValues ( float  u,
float  v,
float  w,
float  h,
BOOL  placeImage 
)
Remarks
This method is used when the VFB is being displayed and you want to change the cropping rectangle from your plug-in. An example of this is available in /MAXSDK/SAMPLES/MATERIALS/BMTEX.CPP.
Parameters:
float u

The U value to set.

float v

The U value to set.

float w

The U value to set.

float h

The U value to set.

BOOL placeImage

TRUE for place mode; FALSE for crop.

◆ Fill() [1/3]

BMMExport int Fill ( int  r,
int  g,
int  b,
int  alpha 
)
Remarks
Sets every pixel of the bitmap to the specified color and alpha value.
Parameters:
int r

Specifies the red value to fill with.

int g

Specifies the green value to fill with.

int b

Specifies the blue value to fill with.

int alpha

Specifies the alpha value to fill with.
Returns
Nonzero if the operation succeeded; otherwise FALSE.

◆ Fill() [2/3]

BMMExport int Fill ( const BMM_Color_fl fillColor)
Remarks
Used by Maxscript.
Parameters:
fillColor

◆ Fill() [3/3]

BMMExport int Fill ( const BMM_Color_64 fillColor)
Remarks
Used by Maxscript.
Parameters:
fillColor

◆ SetNotify()

BMMExport void SetNotify ( BitmapNotify bmnot = nullptr)
Remarks
This method is used to set a callback to allow the developer to get notified if the storage for the Bitmap has changed.
Parameters:
BitmapNotify *bmnot=NULL

The pointer to the callback object implemented by the developer used to provide notification when the Bitmap's storage changes. See Class BitmapNotify.

◆ GetNotify()

BitmapNotify * GetNotify ( )
inline
Remarks
Returns a pointer to the callback used to notify a developer when the Bitmap's storage changes.
Default Implementation:
{ return bmNotify; };
4926{ return bmNotify; }

◆ IsAutonomousVFB()

BMMExport BOOL IsAutonomousVFB ( ) const
Remarks
Returns TRUE if the virtual frame buffer (VFB) is autonomous; otherwise FALSE. For instance, Video Post has an associated VFB. When Video Post is closed so is its VFB since it belongs to it. In that case the VFB is not autonomous. If the user does a View File command, that VFB is autonomous.

◆ Execute()

BMMExport INT_PTR Execute ( int  cmd,
ULONG_PTR  arg1 = 0,
ULONG_PTR  arg2 = 0,
ULONG_PTR  arg3 = 0 
)
Remarks
This is a general purpose function that allows the API to be extended in the future. The 3ds Max development team can assign new cmd numbers and continue to add functionality to this class without having to 'break' the API.
Parameters:
int cmd

The index of the command to execute.

ULONG arg1=0

Optional argument 1. See the documentation where the cmd option is discussed for more details on these parameters.

ULONG arg2=0

Optional argument 2.

ULONG arg3=0

Optional argument 3.
Returns
An integer return value. See the documentation where the cmd option is discussed for more details on the meaning of this value.

◆ GetModifyID()

DWORD GetModifyID ( ) const
inline
4960{ return modifyID; }

◆ SetModifyID()

void SetModifyID ( DWORD  m)
inline
4961{ modifyID = m; }

◆ IncrModifyID()

BMMExport void IncrModifyID ( )

◆ Print()

BMMExport void Print ( bool  silent = false)

Print the bitmap (if supported by the host app)

◆ ShowProgressLine()

BMMExport void ShowProgressLine ( int  y)
Remarks
This method is used for showing a moving scanline in a virtual frame buffer displaying this bitmap. Here's how it works. If you call ShowProgressLine(y), it clears any previously set white line, and sets an internal counter: you have to call Bitmap::RefreshWindow() to get the new white line to show up. From then that line will be displayed as white. To Clear it call ShowProgressLine(-1).
Parameters:
int y

The scanline to display as white (the count begins at zero). Use a value of -1 to hide the line.

Friends And Related Function Documentation

◆ BitmapManagerImp

friend class BitmapManagerImp
friend

◆ InputWndProc

LRESULT CALLBACK InputWndProc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
friend