Public Member Functions | Public Attributes | Friends

BitmapManager Class Reference

This reference page is linked to from the following overview topics: Principal Bitmap Classes, Creating Bitmaps, Loading Bitmaps, Saving Bitmaps, Custom Bitmap Properties, Memory Management for Plug-ins that Work with Bitmaps, Error Reporting, Plug-in Configuration System.


Search for all occurrences

Detailed Description

See also:
Class BitmapInfo, Class Bitmap, Class BitmapIO, Class BitmapStorage, Working with Bitmaps, Bitmap Error (result) Codes.

Description:
This class is used to manage the use of bitmaps within 3ds Max. There is a global instance of this class provided by 3ds Max that developers may use to call these methods. It is called TheManager. This class provides methods for things such as creating and loading bitmaps, and access to the bitmap Map Path directories. There are also methods for displaying some general dialogs that let users select input and output files and devices, as well as dialogs for setting options for the bitmap such as its custom width, height and positioning.

Note: In the 3ds Max release 3.0 SDK these methods were made virtual.
Data Members:
BMMVfbPalette *pal;

This is used internally as the virtual framebuffer palette.
Defines:
#define BMM_FLUSH_RELATIVE_FILE_RESOLUTION_CACHE 5

Used to flush the internal cache used to avoid having to re-resolve relative paths on each LoadInto call

Method Groups:
See Method Groups for Class BitmapManager.

#include <bitmap.h>

Inheritance diagram for BitmapManager:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  BitmapManager (BMMInterface *i)
  BitmapManager (BMMInterface *i, const MCHAR *name)
virtual BMMExport  ~BitmapManager ()
virtual int  DeleteAllMaps ()=0
virtual int  AddStorage (BitmapStorage *s)=0
virtual int  AddFilter (BitmapFilter *a)=0
virtual int  AddBitmap (Bitmap *b)=0
virtual int  DelStorage (BitmapStorage *s)=0
virtual int  DelFilter (BitmapFilter *a)=0
virtual int  DelBitmap (Bitmap *b)=0
virtual BitmapFilter FindFilter (BitmapStorage *s, UINT type)=0
virtual BitmapStorage FindStorage (BitmapInfo *bi, int openMode)=0
virtual int  FnametoBitMapInfo (BitmapInfo *bi)=0
virtual void  FixFileExt (OPENFILENAME &ofn, const MCHAR *extension)=0
virtual void  MakeVfbPalette ()=0
virtual void  ListIO ()=0
virtual HINSTANCE  AppInst ()=0
virtual HWND  AppWnd ()=0
virtual DllDir AppDllDir ()=0
virtual const MCHAR *  GetDir (int i)=0
virtual BOOL  AddMapDir (const MCHAR *dir, int update)=0
virtual int  GetMapDirCount ()=0
virtual const MCHAR *  GetMapDir (int i)=0
virtual Interface Max ()=0
virtual Bitmap NewBitmap ()=0
virtual void  SetFileInputDialog (BitmapFileInputDialog *dlg=NULL)=0
virtual void  SetFileOutputDialog (BitmapFileOutputDialog *dlg=NULL)=0
virtual int  Status (int *sCount, int *aCount, int *bCount)=0
virtual int  Error (const MCHAR *string)=0
virtual BOOL  SilentMode ()=0
virtual void  SysLog (int type, char *format,...)=0
virtual BOOL  SetSilentMode (BOOL s)=0
virtual void  SetLogLevel (DWORD level)=0
virtual DWORD  GetLogLevel ()=0
virtual BMMExport Bitmap Create (BitmapInfo *bi)=0
virtual BMMExport Bitmap Create (PBITMAPINFO pbmi)=0
virtual BMMExport Bitmap Load (BitmapInfo *bi, BMMRES *status=NULL)=0
virtual BMMRES  LoadInto (BitmapInfo *bi, Bitmap **map, BOOL forceReload=FALSE)=0
virtual BMMRES  GetImageInfoDlg (HWND hWnd, BitmapInfo *bi, const MCHAR *filename=NULL)=0
virtual BMMRES  GetImageInfo (BitmapInfo *bi, const MCHAR *filename=NULL)=0
virtual BOOL  ImageInputOptions (BitmapInfo *bi, HWND hWnd)=0
virtual BOOL  SelectDeviceInput (BitmapInfo *bi, HWND hWnd)=0
virtual BOOL  SelectDeviceOutput (BitmapInfo *bi, HWND hWnd)=0
virtual BOOL  SelectFileOutput (BitmapInfo *bi, HWND hWnd, MCHAR *title=NULL, ULONG *pflags=NULL)=0
virtual BOOL  SelectFileInput (BitmapInfo *bi, HWND hWnd, MCHAR *title=NULL)=0
virtual BOOL  SelectFileInputEx (BitmapInfo *bi, HWND hWnd, MCHAR *title=NULL, BOOL viewonly=FALSE)=0
virtual void  RefreshAllVFBs ()=0
virtual void  DeleteAllAutonomousVFBMaps ()=0
virtual INT_PTR  Execute (int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0)=0
virtual void  BeginSavingLoadErrorFiles ()=0
virtual NameTab GetLoadErrorFileList ()=0
virtual void  EndSavingLoadErrorFiles ()=0
virtual BMMExport bool  CanImport (const MCHAR *filename)=0
void  ClearInternalRelativePathResolutionCache ()

Public Attributes

BMMVfbPalette pal
BMM_IOList  ioList

Friends

void  DoConstruct (BitmapManager *m, BMMInterface *i, const MCHAR *name)

Constructor & Destructor Documentation

BitmapManager ( BMMInterface *  i ) [inline]
{ pal = NULL; }
BitmapManager ( BMMInterface *  i,
const MCHAR *  name 
) [inline]
{ pal = NULL; }
virtual BMMExport ~BitmapManager ( ) [virtual]

Member Function Documentation

virtual int DeleteAllMaps ( ) [pure virtual]
virtual int AddStorage ( BitmapStorage s ) [pure virtual]
virtual int AddFilter ( BitmapFilter a ) [pure virtual]
virtual int AddBitmap ( Bitmap b ) [pure virtual]
virtual int DelStorage ( BitmapStorage s ) [pure virtual]
virtual int DelFilter ( BitmapFilter a ) [pure virtual]
virtual int DelBitmap ( Bitmap b ) [pure virtual]
virtual BitmapFilter* FindFilter ( BitmapStorage s,
UINT  type 
) [pure virtual]
virtual BitmapStorage* FindStorage ( BitmapInfo bi,
int  openMode 
) [pure virtual]
virtual int FnametoBitMapInfo ( BitmapInfo bi ) [pure virtual]
virtual void FixFileExt ( OPENFILENAME &  ofn,
const MCHAR *  extension 
) [pure virtual]
virtual void MakeVfbPalette ( ) [pure virtual]
virtual void ListIO ( ) [pure virtual]
virtual HINSTANCE AppInst ( ) [pure virtual]
Remarks:
Returns the application instance handle of 3ds Max itself.
virtual HWND AppWnd ( ) [pure virtual]
Remarks:
Returns the window handle of 3ds Max's main window.
virtual DllDir* AppDllDir ( ) [pure virtual]
virtual const MCHAR* GetDir ( int  i ) [pure virtual]
Remarks:
Implemented by the System.

Retrieves the specified standard 3ds Max directory name (fonts, scenes, images, etc.).
Parameters:
int i

Specifies the directory name to retrieve. See MAX Directory IDs
Returns:
The name of the specified directory.
virtual BOOL AddMapDir ( const MCHAR *  dir,
int  update 
) [pure virtual]
Remarks:
For internal use only - This is used to add a MAP PATH to the Map path list.
virtual int GetMapDirCount ( ) [pure virtual]
Remarks:
Returns the number of map paths (used in conjunction with the method below).
Returns:
The number of map paths.
virtual const MCHAR* GetMapDir ( int  i ) [pure virtual]
Remarks:
Map paths are accessed using a virtual array mechanism. This method returns the 'i-th' map path.
Parameters:
int i

Specifies the map path to retrieve.
Returns:
The name of the 'i-th' map path.
virtual Interface* Max ( ) [pure virtual]
Remarks:
Implemented by the System.

Returns an interface pointer for calling methods provided by 3ds Max. See Class Interface.
virtual Bitmap* NewBitmap ( ) [pure virtual]
Remarks:
This method is called to allocate and return a pointer to a new instance of the Bitmap class. The default constructor is used.
virtual void SetFileInputDialog ( BitmapFileInputDialog dlg = NULL ) [pure virtual]
virtual void SetFileOutputDialog ( BitmapFileOutputDialog dlg = NULL ) [pure virtual]
virtual int Status ( int *  sCount,
int *  aCount,
int *  bCount 
) [pure virtual]
virtual int Error ( const MCHAR *  string ) [pure virtual]
virtual BOOL SilentMode ( ) [pure virtual]
Remarks:
Determines if silent mode is on. Silent mode specifies if developers should display error messages. If this method returns FALSE, error messages should be displayed. If TRUE, error message dialogs should not be shown.
Returns:
Returns TRUE if silent mode is on; FALSE otherwise.
virtual void SysLog ( int  type,
char *  format,
  ... 
) [pure virtual]
Remarks:
This is reserved for future use.
virtual BOOL SetSilentMode ( BOOL  s ) [pure virtual]
Remarks:
This method is used internally.
virtual void SetLogLevel ( DWORD  level ) [pure virtual]
Remarks:
This method is used internally.
virtual DWORD GetLogLevel ( ) [pure virtual]
Remarks:
This method is used internally.
virtual BMMExport Bitmap* Create ( BitmapInfo bi ) [pure virtual]
Remarks:
This method creates a new bitmap using the properties of the BitmapInfo passed. For more details on creating bitmaps, see the section Working with Bitmaps. Make sure you delete the Bitmap created when you are done using it.
Parameters:
BitmapInfo *bi

A pointer to an instance of the class BitmapInfo describing the bitmap to create.
Returns:
A pointer to a newly created instance of class Bitmap.
virtual BMMExport Bitmap* Create ( PBITMAPINFO  pbmi ) [pure virtual]
Remarks:
This method is used for creating a new bitmap from an existing Windows Device Independent Bitmap. Make sure you delete the Bitmap created when you are done using it.
Parameters:
PBITMAPINFO pbmi

An existing Windows DIB. For more details on creating bitmaps, see the section Working with Bitmaps.
Returns:
Pointer to a new instance of class Bitmap created from the DIB.

See also:
To create a Windows DIB from a Bitmap see Bitmap::ToDib()
virtual BMMExport Bitmap* Load ( BitmapInfo bi,
BMMRES *  status = NULL 
) [pure virtual]
Remarks:
This method loads a bitmap using the parameters specified by the BitmapInfo pointer. Make sure you delete the Bitmap created when you are done using it.

Note: When several plug-ins call this method to load the same image, they all receive the same pointer to one instance of the BitmapStorage. So if one plug-in manipulates the image, the changes will get reflected everywhere. A developer may use BitmapManager::Create() followed by Bitmap::CopyImage() to create a unique instance of BitmapStorage.

Also Note: One of the methods in BitmapInfo returns a window handle to send progress report messages. If you want to receive these messages (for purposes of putting up a progress bar during the load), set the window handle (bi->SetUpdateWindow(hWnd)) and process BMM_PROGRESS and BMM_CHECKABORT messages.
Parameters:
BitmapInfo *bi

Specifies the properties of the bitmap to load.

BMMRES *status

The result of the bitmap load operation. See Bitmap Error (result) Codes.
Returns:
A pointer to a new instance of the class Bitmap.
virtual BMMRES LoadInto ( BitmapInfo bi,
Bitmap **  map,
BOOL  forceReload = FALSE 
) [pure virtual]
Remarks:
This method loads the bitmap specified by bi into the bitmap pointed to by map. The normal Load() method creates a new bitmap. However, if you already have an existing bitmap and simply want to load in a new frame, this method may be used. Specify which bitmap to use using bi and the map to load into using map. For instance, if you have an AVI file and you want to load a new frame, you can simply update the frame number specified in the BitmapInfo and call this method passing the bitmap associates with the previous frame.
Parameters:
BitmapInfo *bi

Specifies the properties of the bitmap to load.

Bitmap **map

A pointer to a pointer to a bitmap. This is the bitmap that will be loaded into.

BOOL forceReload=FALSE

If an existing bitmap that matches bi is already loaded, then calling calling LoadInto() won't load from the disk or device. Rather it will just use the existing in memory version. If you want to force the bitmap to be reloaded from the file or device set this to TRUE.
Returns:
The result of the bitmap load operation. See Bitmap Error (result) Codes.
virtual BMMRES GetImageInfoDlg ( HWND  hWnd,
BitmapInfo bi,
const MCHAR *  filename = NULL 
) [pure virtual]
Remarks:
This method will display information about the given bitmap in a dialog. The source of the information is either defined in bi->Name()/bi->Device() or explicitly in the filename passed). This method is an interface into BitmapIO::GetImageInfoDlg(). It is not normally called by developers.

The default implementation is within the Bitmap Manager. There is a generic Image Info dialog that is used unless the proper BitmapIO class implements it own dialog (and notifies the system through the BitmapIO::Capabilities() method).
Parameters:
HWND hWnd

The parent window handle calling the dialog.

BitmapInfo *bi

Defines the name of the bitmap or device (unless specified below). The image information fields of BitmapInfo *bi are set with the information loaded from the image.

const MCHAR *filename = NULL

Specifies the filename to use explicitly.
Returns:
The result of the operation. See Bitmap Error (result) Codes.
virtual BMMRES GetImageInfo ( BitmapInfo bi,
const MCHAR *  filename = NULL 
) [pure virtual]
Remarks:
This method is used to get information about an image, ie things like image resolution (bi->Width()/bi->Height()), number of frames, etc. This is an interface into BitmapIO::GetImageInfo(). Given an image definition in bi.Name() / bi.Device() or explicitly in filename (this function will place filename, if not NULL, into bi.Name() before calling BitmapIO::GetImageInfo()), the proper device will fill the data members in BitmapInfo *bi with information about the image.
Parameters:
BitmapInfo *bi

Defines the name of the bitmap or device (unless specified below).

const MCHAR *filename = NULL

Specifies the filename to use explicitly.
Returns:
The result of the operation. See Bitmap Error (result) Codes.
virtual BOOL ImageInputOptions ( BitmapInfo bi,
HWND  hWnd 
) [pure virtual]
Remarks:
This method brings up the standard 3ds Max Image Input Options dialog box. If the users selects OK from the dialog, the appropriate data members of BitmapInfo *bi are filled specifying the user's choices. These are the 'Custom' fields accessed using methods such as GetCustomX(), GetCustomGamma(), GetCustomStep(), etc.
Parameters:
BitmapInfo *bi

The instance of BitmapInfo that is updated based on the users dialog selections.

HWND hWnd

The parent window handle for the dialog.
Returns:
Returns TRUE if the users selects OK from the dialog; otherwise FALSE.
virtual BOOL SelectDeviceInput ( BitmapInfo bi,
HWND  hWnd 
) [pure virtual]
Remarks:
Brings up the standard 3ds Max Select Image Input Device dialog box. If the users selects OK from the dialog, then bi->Device() is set to the name of the users device choice.
Parameters:
BitmapInfo *bi

Points to the instance of BitmapInfo that is updated based on the users dialog selections.

HWND hWnd

The parent window handle for the dialog.
Returns:
TRUE if the user exited the dialog using OK; otherwise FALSE.
virtual BOOL SelectDeviceOutput ( BitmapInfo bi,
HWND  hWnd 
) [pure virtual]
Remarks:
Brings up the standard 3ds Max Select Image Output Device dialog box. If the users selects OK from the dialog, then bi->Device() is set to the name of the users device choice.
Parameters:
BitmapInfo *bi

Points to the instance of BitmapInfo that is updated based on the users dialog selections.

HWND hWnd

The parent window handle for the dialog.
Returns:
TRUE if the user exited the dialog using OK; otherwise FALSE.
virtual BOOL SelectFileOutput ( BitmapInfo bi,
HWND  hWnd,
MCHAR *  title = NULL,
ULONG *  pflags = NULL 
) [pure virtual]
Remarks:
Brings up the standard 3ds Max Browse Images for Output dialog box. If the users selects OK from the dialog, then bi->Name() is set to the name of the users file choice.
Parameters:
BitmapInfo *bi

Points to the instance of BitmapInfo that is updated based on the users dialog selections.

HWND hWnd

The parent window handle for the dialog.

MCHAR *title = NULL

The optional title string to display in the title bar of the dialog.

ULONG *pflags = NULL

This parameter is available in release 4.0 and later only.

One of the following:

BMM_ENABLE_SAVE_REGION

This flag will cause the "SaveRegion" check box to appear in the dialog.

BMM_DO_SAVE_REGION

This flag will return the state of the check box.
Returns:
TRUE if the user exited the dialog using OK; otherwise FALSE.

virtual BOOL SelectFileOutput ( BitmapInfo *bi, HWND hWnd, MCHAR *title = NULL, ULONG *pflags = NULL)
virtual BOOL SelectFileInput ( BitmapInfo bi,
HWND  hWnd,
MCHAR *  title = NULL 
) [pure virtual]
Remarks:
Brings up the standard 3ds Max Browse Images for Input dialog box. If the users selects OK from the dialog, then bi->Name() is set to the name of the users file choice.
Parameters:
BitmapInfo *bi

The instance of BitmapInfo that is updated based on the users dialog selections.

HWND hWnd

The parent window handle for the dialog.

MCHAR *title = NULL

The optional title string to display in the title bar of the dialog.
Returns:
TRUE if the user exited the dialog using OK; otherwise FALSE.
virtual BOOL SelectFileInputEx ( BitmapInfo bi,
HWND  hWnd,
MCHAR *  title = NULL,
BOOL  viewonly = FALSE 
) [pure virtual]
Remarks:
This method brings up the standard 3ds Max Browse Images for Input dialog box (the same as SelectFileInput()) but a "Devices" button is present so the user can select both image files and image devices.
Parameters:
BitmapInfo *bi

The instance of BitmapInfo that is updated based on the users dialog selections.

HWND hWnd

The parent window handle for the dialog.

MCHAR *title = NULL

The optional title string to display in the title bar of the dialog.

BOOL viewonly = FALSE

If viewonly is set to TRUE, the View button is hidden in the dialog.
Returns:
TRUE if the user exited the dialog using OK; otherwise FALSE.
virtual void RefreshAllVFBs ( ) [pure virtual]
Remarks:
This method refreshes the interior of all the virtual frame buffer windows with each bitmap's contents.
virtual void DeleteAllAutonomousVFBMaps ( ) [pure virtual]
Remarks:
This method calls Bitmap::DeleteThis() on all the bitmaps whose virtual frame buffers are set to autonomous.
virtual INT_PTR Execute ( int  cmd,
ULONG_PTR  arg1 = 0,
ULONG_PTR  arg2 = 0,
ULONG_PTR  arg3 = 0 
) [pure virtual]
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.
virtual void BeginSavingLoadErrorFiles ( ) [pure virtual]
Remarks:
This method is used for accumulating the names of bitmap files that didn't load. Instead of having the BitmapManager display the missing file dialog, it now just collects the names (which can be retrieved using GetLoadErrorFileList() below).
virtual NameTab& GetLoadErrorFileList ( ) [pure virtual]
Remarks:
This method will return a list of names of bitmap files that were not found as discussed in the method above. See Class NameTab.
virtual void EndSavingLoadErrorFiles ( ) [pure virtual]
Remarks:
This method ends the accumulation of a list of bitmap files that didn't load, and frees the list. See the two methods above.
virtual BMMExport bool CanImport ( const MCHAR *  filename ) [pure virtual]
Remarks:
Returns true if the extension of the specified file name is one of the supported types (i.e. there is a BitmapIO module for it); otherwise false.
Parameters:
const MCHAR* filename

The file name to check.
void ClearInternalRelativePathResolutionCache ( ) [inline]
Remarks:
Implements the 'strip path' action.
{ Execute(BMM_FLUSH_RELATIVE_FILE_RESOLUTION_CACHE); }

Friends And Related Function Documentation

void DoConstruct ( BitmapManager m,
BMMInterface *  i,
const MCHAR *  name 
) [friend]

Member Data Documentation


BitmapManager BitmapManager BitmapManager BitmapManager BitmapManager BitmapManager BitmapManager BitmapManager BitmapManager BitmapManager
BitmapManager BitmapManager BitmapManager BitmapManager BitmapManager BitmapManager BitmapManager BitmapManager BitmapManager BitmapManager