Detailed Description
- See also:
- Class ImageFilterInfo, Class Bitmap, Class ITrackViewNode, Class TimeChange, Class UndoNotify, Working with
Bitmaps.
- Description:
- Image processing filter plug-ins are derived from ImageFilter. This class
has virtual methods the developer implements to provide information
about the plug-in version, and description. The developer also
implements the Capability()
method to indicate the properties of the plug-in such as if it is a
one pass filter or compositor, and whether it has a control dialog
to be displayed.
The Render()
method is the one that actually alters the source image to perform
the work of the application.
Filter plug-ins have access to several bitmaps associated with the
video post data stream. All filter plug-ins will have at least a
pointer to data member srcmap. This is Video Post's main
image pipeline. Composition and transition (layer) filters will
also receive a second bitmap (frgmap) which should be
composited above the main bitmap (srcmap). If mskmap
is not NULL, it will contain a pointer to a grayscale image to be
used as a mask for the process. Note that developers should not
delete these bitmaps as they are maintained by 3ds Max.
If a plug-in is both a filter and a compositor, the plug-in can
tell if it is running as a filter when the frgmap pointer is
NULL.
Note: If changes are made to an ImageFilter plug-in, the system
will not automatically put up the 'The scene has been modified. Do
you want to save your changes?' dialog if the user attempts to exit
without saving. So that your plug-in does not go unsaved, you
should call the following global function if you make changes. This
will indicate to the system that the save requester needs to be
brought up:
void SetSaveRequired(int b=TRUE);
Sets the 'save dirty bit'. This will indicate to the system that
the save requester needs to be presented to the user.
- Method Groups:
- See Method Groups for Class ImageFilter.
- Data Members:
- protected:
BOOL interactive;
This data member is available in release 2.0 and later only.
TRUE if the setup dialog is interactive; otherwise FALSE.
HWND vpSetuphWnd;
The window handle of the video post setup dialog.
HWND vphWnd;
The window handle of the Video Post dialog.
HWND dlghWnd;
The window handle of the filter's setup dialogue when in
"Interactive" mode.
Bitmap
*srcmap
The Source Bitmap
(background). Note: The Video Post output resolution may be
retrieved using this pointer. The width is
srcmap->Width() and the height is
srcmap->Height().
Bitmap
*mskmap
The Image Mask Bitmap
(for grayscale masking). This bitmap is at the Video Post output
resolution size when the developer needs to access it in the
Render()
method.
Bitmap
*frgmap
The Foreground Bitmap
(for layering/transitions). This bitmap is at the Video Post output
resolution size when the developer needs to access it in the
Render()
method.
ImageFilterInfo *ifi
A pointer to an instance of the class that provides information
about this filter and the video post queue.
TimeChange
timeChange;
This data member is available in release 2.0 and later only.
This class maintains this time change object so it may send
FLT_TIMECHANGED messages.
UndoNotify* undonotify;
This data member is available in release 2.0 and later only.
Points to an instance of the class that can be used so an
ImageFilter
plug-in can get notified on a change to its Track View Node.
#include <filters.h>
List of all
members.
Public Member Functions
|
FLTExport |
ImageFilter
() |
virtual
FLTExport |
~ImageFilter
() |
virtual
FLTExport const MCHAR * |
Description
()=0 |
virtual
FLTExport const MCHAR * |
AuthorName
()=0 |
virtual
FLTExport const MCHAR * |
CopyrightMessage
()=0 |
virtual
FLTExport UINT |
Version
()=0 |
virtual
FLTExport DWORD |
Capability
()=0 |
virtual
FLTExport void |
ShowAbout
(HWND hWnd)=0 |
virtual
FLTExport BOOL |
ShowControl
(HWND hWnd) |
virtual
FLTExport void |
SetSource
(Bitmap *map) |
virtual
FLTExport void |
SetForeground
(Bitmap *map) |
virtual
FLTExport void |
SetMask
(Bitmap *map) |
virtual
FLTExport void |
SetFilterInfo
(ImageFilterInfo *i) |
virtual
FLTExport BOOL |
Render
(HWND hWnd)=0 |
virtual
FLTExport Interface
* |
Max
() |
virtual
FLTExport int |
Lerp
(int a, int b, int l) |
virtual
FLTExport int |
Lerp
(int a, int b, float f) |
virtual
FLTExport DWORD |
EvaluateConfigure
() |
virtual
FLTExport BOOL |
LoadConfigure
(void *ptr) |
virtual
FLTExport BOOL |
SaveConfigure
(void *ptr) |
virtual
FLTExport BOOL |
CreatePreview
(HWND hWnd, Bitmap
**back, int frame, int width, int height, float aspect, Bitmap **fore=NULL, DWORD
flag=PREVIEW_UP) |
virtual
FLTExport DWORD |
ChannelsRequired
() |
virtual
FLTExport HWND |
DlgHandle
(void) |
virtual
FLTExport void |
MakeDlgInteractive
(HWND hWnd) |
virtual
FLTExport BOOL |
IsInteractive
(void) |
virtual
FLTExport ITrackViewNode * |
CreateNode
() |
virtual
FLTExport ITrackViewNode * |
Node
() |
virtual
FLTExport void |
FilterUpdate
() |
Public Attributes
|
TimeChange |
timeChange |
UndoNotify * |
undonotify |
Protected Attributes
|
BOOL |
interactive |
HWND |
vpSetuphWnd |
HWND |
vphWnd |
HWND |
dlghWnd |
Bitmap * |
srcmap |
Bitmap * |
mskmap |
Bitmap * |
frgmap |
ImageFilterInfo
* |
ifi |
Constructor & Destructor Documentation
Member Function Documentation
virtual FLTExport const MCHAR* Description |
( |
|
) |
[pure virtual] |
virtual FLTExport const MCHAR* AuthorName |
( |
|
) |
[pure virtual] |
virtual FLTExport const MCHAR*
CopyrightMessage |
( |
|
) |
[pure virtual] |
virtual FLTExport UINT Version |
( |
|
) |
[pure virtual] |
virtual FLTExport DWORD Capability |
( |
|
) |
[pure virtual] |
virtual FLTExport void ShowAbout |
( |
HWND |
hWnd |
) |
[pure virtual] |
- Parameters:
- HWND hWnd
The parent window handle of the dialog.
virtual FLTExport BOOL ShowControl |
( |
HWND |
hWnd |
) |
[inline, virtual] |
- Parameters:
- HWND hWnd
The parent window handle of the dialog.
- Returns:
- TRUE if the user selects OK to exit the dialog, and FALSE if
the user selects Cancel.
- Default Implementation:
- { return FALSE; }
virtual FLTExport void SetSource |
( |
Bitmap * |
map |
) |
[inline, virtual] |
virtual FLTExport void SetForeground |
( |
Bitmap * |
map |
) |
[inline, virtual] |
virtual FLTExport void SetMask |
( |
Bitmap * |
map |
) |
[inline, virtual] |
virtual FLTExport void SetFilterInfo |
( |
ImageFilterInfo * |
i |
) |
[inline, virtual] |
virtual FLTExport BOOL Render |
( |
HWND |
hWnd |
) |
[pure virtual] |
- Parameters:
- HWND hWnd
The window handle to which the plug-in will be sending progress and
abort check messages.
- Returns:
- TRUE if the render was completed; otherwise FALSE (error or
canceled by user).
- Sample Code:
- Below is an example of a render loop through each horizontal
band of the image demonstrating the posting of messages. At the
start of the loop the progress and check abort messages are sent.
The progress message updates the Execute Video Post dialog with how
much of the image has been processed. The check abort message
allows the plug-in to detect if the user has canceled the
operation.
BOOL result = TRUE;
BOOL abort = FALSE;
for (int iy = 0; iy Height(); iy++)
{
SendMessage(hWnd,FLT_PROGRESS,iy,srcmap->Height()-1);
SendMessage(hWnd,FLT_CHECKABORT,0,(LPARAM)(BOOL )&abort);
if (abort) {
result = FALSE;
break;
}
}
return(result);
Messages are sent via the Window API SendMessage() function.
See ImageFilter-Related
Messages.
virtual FLTExport Interface* Max |
( |
|
) |
[virtual] |
virtual FLTExport int Lerp |
( |
int |
a, |
|
|
int |
b, |
|
|
int |
l |
|
) |
|
[virtual] |
virtual FLTExport int Lerp |
( |
int |
a, |
|
|
int |
b, |
|
|
float |
f |
|
) |
|
[virtual] |
virtual FLTExport DWORD EvaluateConfigure |
( |
|
) |
[inline, virtual] |
- Returns:
- The number of bytes required by the plug-in's parameter
block.
- Default Implementation:
- { return 0; }
virtual FLTExport BOOL LoadConfigure |
( |
void * |
ptr |
) |
[inline, virtual] |
- Parameters:
- void *ptr
A pre-allocated buffer.
- Returns:
- TRUE if the data was loaded OK; otherwise FALSE.
- Default Implementation:
- { return (FALSE) };
virtual FLTExport BOOL SaveConfigure |
( |
void * |
ptr |
) |
[inline, virtual] |
- Parameters:
- void *ptr
A pre-allocated buffer the plug-in may write to.
- Returns:
- TRUE if the data was saved OK; otherwise FALSE.
- Default Implementation:
- { return (FALSE); }
virtual FLTExport BOOL CreatePreview |
( |
HWND |
hWnd, |
|
|
Bitmap ** |
back, |
|
|
int |
frame, |
|
|
int |
width, |
|
|
int |
height, |
|
|
float |
aspect, |
|
|
Bitmap ** |
fore = NULL , |
|
|
DWORD |
flag =
PREVIEW_UP |
|
) |
|
[virtual] |
- Parameters:
- HWND hWnd
This window handle will receive progress notification messages. The
messages are defined in both BITMAP.H and FILTERS.H:
FLT_PROGRESS
wParam: Current
lParam: Total
FLT_CHECKABORT
wParam: 0
lParam: BOOL*
FLT_TEXTMSG
wParam: 0
lParam: LPCMSTR
BMM_PROGRESS
wParam: Current
lParam: Total
BMM_CHECKABORT
wParam: 0
lParam: *BOOL
BMM_TEXTMSG
wParam: 0
lParam: LPCMSTR
Bitmap
**back
A pointer to the Bitmap
Pointer (the Background). If the Bitmap pointer is NULL, a new bitmap is
created using the given dimensions. This pointer must be NULL the
first time this function is called as the bitmap must be created by
Video Post. Once this function is called and a bitmap is returned,
it is OK to call it again using this map. In this case, Video Post
will simply use it instead of creating a new one. Note: You must
NOT delete the bitmap when done -- Video Post will take care of
it.
int frame
The desired frame in TICKS. Note that this is the position of the
Video Post frame slider (in TICKS) and not the main 3ds Max frame
slider. See the Advanced Topics section on Time for
details on ticks.
int width
The desired width of the preview.
int height
The desired height of the preview.
Float aspect
The desired aspect ratio of the preview.
Bitmap **fore =
NULL
A pointer to the Bitmap
Pointer (the Foreground). For layer plug-ins, this points to the
foreground image. This is only valid if flag is set to
PREVIEW_BEFORE. In this case back will hold Video
Post main queue and fore will have the foreground image to
be composited. This is useful if you, a layer plug-in, want to
collect the images and run a realtime preview. If flag is not
PREVIEW_BEFORE, fore will be a NULL pointer
indicating there is no bitmap.
DWORD flag = PREVIEW_UP
The flag controls how much of the queue to run. The options
are:
PREVIEW_BEFORE
The queue is run up to the event before the filter calling
it.
PREVIEW_UP
The queue is run up to the event (filter) calling this
function.
PREVIEW_WHOLE
The whole queue is run including events after this filter.
- Returns:
- TRUE if the creation was successful; otherwise FALSE.
virtual FLTExport DWORD ChannelsRequired |
( |
|
) |
[inline, virtual] |
virtual FLTExport HWND DlgHandle |
( |
void |
|
) |
[inline, virtual] |
virtual FLTExport void MakeDlgInteractive |
( |
HWND |
hWnd |
) |
[virtual] |
This method may be used to allow a filter's dialog to operate
interactively. This means that a user can have the filter's control
dialog up and still operate 3ds Max and Track View at the same
time. This method should be called from the filter's
Control() method as part of the WM_INITDIALOG
code.
Note that even though this method can be called safely for any
reason, developers should only call it when using animated
parameters. It doesn't make sense to use it for filters with
non-animated or no parameters. For sample code using this method
see /MAXSDK/SAMPLES/POSTFILTERS/NEGATIVE/NEGATIVE.CPP.
- Parameters:
- HWND hWnd
The parent window handle.
- Sample Code:
-
BOOL ImageFilter_Negative::Control(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam) {
switch (message) {
case WM_INITDIALOG: {
MakeDlgInteractive(hWnd);
...
virtual FLTExport BOOL IsInteractive |
( |
void |
|
) |
[inline, virtual] |
virtual FLTExport void FilterUpdate |
( |
|
) |
[inline, virtual] |
- Default Implementation:
- {}
Member Data Documentation
ImageFilter ImageFilter ImageFilter
ImageFilter ImageFilter ImageFilter ImageFilter ImageFilter
ImageFilter ImageFilter
ImageFilter ImageFilter ImageFilter
ImageFilter ImageFilter ImageFilter ImageFilter ImageFilter
ImageFilter ImageFilter