📄 bitmap.h
字号:
//
class BMM_IOHandler {
//-- Name and Capabilities ------------------------
TCHAR ioShortDesc[MAX_DESCRIPTION];
TCHAR ioLongDesc[MAX_DESCRIPTION];
DWORD ioCapabilities;
//-- Extension for file types
TSTRList ioExtension;
//-- DLL Handler ----------------------------------
ClassDesc *cd;
int dllNumber;
public:
BMMExport BMM_IOHandler();
BMMExport TCHAR *ShortDescription ( const TCHAR *d = NULL );
BMMExport TCHAR *LongDescription ( const TCHAR *d = NULL );
BMMExport TCHAR *Extension ( int index, const TCHAR *e = NULL );
BMMExport int NumExtensions ( ) { return ioExtension.Count(); }
BMMExport void SetCD ( ClassDesc *dll ) { cd = dll;};
BMMExport ClassDesc *GetCD ( ) { return cd;};
BMMExport void SetDllNumber ( int num ) { dllNumber = num; }
BMMExport int GetDllNum ( ) { return dllNumber; }
BMMExport void SetCapabilities ( DWORD cap ) { ioCapabilities |= cap;};
BMMExport DWORD GetCapabilities ( ) { return (ioCapabilities);};
BMMExport BOOL TestCapabilities ( DWORD cap ) { return ((ioCapabilities & cap) != 0);};
BMMExport BMM_IOHandler& operator=(BMM_IOHandler &from);
};
//-----------------------------------------------------------------------------
//-- List of I/O Handlers
//
// Class for storing a linked list of Bitmap Manager BMM_IOHandler objects
MakeLinkedList(BMM_IOHandler);
class BMM_IOList: public BMM_IOHandlerList {
BOOL listed;
public:
BMM_IOList ( ) { listed = FALSE; }
BOOL Listed ( BOOL f) { listed = f; return (listed);};
BOOL Listed ( ) { return (listed);};
BMMExport int FindDevice ( const TCHAR *name);
BMMExport int FindDeviceFromFilename ( const TCHAR *name);
BMMExport int ResolveDevice ( BitmapInfo *bi );
BMMExport DWORD GetDeviceCapabilities ( const TCHAR *name);
//-- This Creates an Instance - Make sure to "delete" it after use.
BMMExport BitmapIO *CreateDevInstance( const TCHAR *d );
BMMExport BitmapIO *CreateDevInstance( int idx );
};
//-----------------------------------------------------------------------------
//-- RenderInfo Class
//
enum ProjectionType { ProjPerspective=0, ProjParallel=1 };
class RenderInfo {
public:
RenderInfo();
ProjectionType projType;
float kx,ky; // 3D to 2D projection scale factor
float xc,yc; // screen origin
BOOL fieldRender; // field rendered?
BOOL fieldOdd; // if true, the first field is Odd lines
// Render time and tranformations for the 2 fields, if field rendering.
// If not, use renderTime[0], etc.
TimeValue renderTime[2];
Matrix3 worldToCam[2];
Matrix3 camToWorld[2];
BMMExport Point2 MapWorldToScreen(Point3 p, int field=0) { return MapCamToScreen(worldToCam[field]*p);}
BMMExport Point2 MapCamToScreen(Point3 p); // map point in camera space to screen
BMMExport Ray MapScreenToCamRay(Point2 p); // get viewing ray through screen point, in camera space
BMMExport Ray MapScreenToWorldRay(Point2 p, int field=0); // get viewing ray through screen point, in world space
};
//-----------------------------------------------------------------------------
//-- Bitmap Info Class
//
//-- Bitmap flags
#define MAP_NOFLAGS ((DWORD)0)
#define MAP_READY ((DWORD)(1<<0))
#define MAP_HAS_ALPHA ((DWORD)(1<<1))
#define MAP_ALPHA_PREMULTIPLIED ((DWORD)(1<<2))
#define MAP_PALETTED ((DWORD)(1<<3))
#define MAP_FRAME_SYSTEM_LOCKED ((DWORD)(1<<4))
#define MAP_DITHERED ((DWORD)(1<<5))
#define MAP_FLIPPED ((DWORD)(1<<6)) // Flipped horizontally
#define MAP_INVERTED ((DWORD)(1<<7)) // Flipped vertically
//#define MAP_CUSTOMSIZE ((DWORD)(1<<8)) // Custom size for input
//#define MAP_RESIZE ((DWORD)(1<<9)) // Resize when input
#ifdef DESIGN_VER
#define MAP_HAS_BGIMAGE ((DWORD)(1<<29)) // internal use only
#endif
#define MAP_LEGAL_DELETE ((DWORD)(1<<30)) // internal use only
#define MAP_VIEW_FILTERED ((DWORD)(1<<31)) // Test stuff
#define MAP_ALL_FLAGS 0xFFFFFFFF
//-----------------------------------------------------------------------------
//-- Messages sent back by various (client) methods
//-- Sent by the plug-in to notify host of current progress. The host should
// return TRUE if it's ok to continue or FALSE to abort process.
#define BMM_PROGRESS WM_USER + 0x120 //-- wParam: Current lParam: Total
//-- Sent by the plug-in to check for process interruption. The host should
// return FALSE (by setting lParam) if it's ok to continue or TRUE to abort
// process.
#define BMM_CHECKABORT WM_USER + 0x121 //-- wParam: 0 lParam: *BOOL
//-- Sent by the plug-in to display an optional textual message (for progress
// report).
#define BMM_TEXTMSG WM_USER + 0x122 //-- wParam: 0 lParam: LPCTSTR
class BitmapInfo {
//-- Image name in case of named images such as files -------
TCHAR name[MAX_PATH];
//-- Device name gotten from BMM_IOHandler::LongDescription()
TCHAR device[MAX_DESCRIPTION];
//-- Window Handle to send BMM_UPDATE messages --------------
HWND hWnd;
//-- Plug-In Parameter Block --------------------------------
void *pidata;
DWORD pisize;
//-- Basic Image Data ---------------------------------------
//
// When reading an image, or asking for image info, these
// fields will tell the user what the image is like.
//
// When creating an image the user will set these fields to
// the desired parameters.
//
WORD width,height;
float aspect,gamma;
int fstart,fend;
DWORD flags,type;
//-- User data (what user wants) ----------------------------
//
// Custom dimmensions, custom start and end point when
// reading sequence of imges, frame to fetch/save, etc.
//
WORD cwidth,cheight;
int custxpos,custypos;
int start,end;
int step,preset_al;
float custgamma;
#define BMM_UNDEF_FRAME 0x7FFF0000
#define BMM_CUSTOM_GAMMA ((DWORD)(1 << 0))
#define BMM_CUSTOM_SIZE ((DWORD)(1 << 1))
#define BMM_CUSTOM_RESFIT ((DWORD)(1 << 2))
#define BMM_CUSTOM_POS ((DWORD)(1 << 3))
#define BMM_CUSTOM_FILEGAMMA ((DWORD)(1 << 4))
#define BMM_CUSTOM_IFLENUMFILES ((DWORD)(1 << 5))
#define BMM_CUSTOM_POSNW 0
#define BMM_CUSTOM_POSN 1
#define BMM_CUSTOM_POSNE 2
#define BMM_CUSTOM_POSW 3
#define BMM_CUSTOM_POSCN 4
#define BMM_CUSTOM_POSE 5
#define BMM_CUSTOM_POSSW 6
#define BMM_CUSTOM_POSS 7
#define BMM_CUSTOM_POSSE 8
DWORD customflags;
int fnumber; //-- Defines frame to
// read or write.
//-- When reading a sequence of frames, loopflag indicates what to
// do when reading beyond the end of available frames. It
// defaults to BMM_SEQ_WRAP.
#define BMM_SEQ_WRAP 0 //-- Wraps around back to start point
#define BMM_SEQ_ERROR 1 //-- Generates an error
#define BMM_SEQ_HOLD 2 //-- Holds last frame when done
WORD loopflag;
void doConstruct ( );
public:
BMMExport BitmapInfo ( );
BMMExport BitmapInfo ( TCHAR *n );
BMMExport BitmapInfo ( BitmapInfo &bi );
BMMExport ~BitmapInfo ( );
//-- Bitmap Flags
BMMExport DWORD Flags ( ) { return (flags); }
BMMExport DWORD SetFlags ( DWORD f ) { flags |= f; return (flags); }
BMMExport DWORD ResetFlags ( DWORD f ) { flags &= ~f; return (flags); }
BMMExport BOOL TestFlags ( DWORD f ) { return (flags & f); }
//-- Generic Read
BMMExport WORD Width ( ) { return (width); }
BMMExport WORD Height ( ) { return (height); }
BMMExport float Gamma ( ) { return (gamma); }
BMMExport float Aspect ( ) { return (aspect);}
BMMExport int Type ( ) { return (type); }
BMMExport int FirstFrame ( ) { return (fstart); }
BMMExport int LastFrame ( ) { return (fend); }
BMMExport int NumberFrames ( ) { return (fend - fstart + 1); }
BMMExport int CurrentFrame ( ) { return (fnumber); }
BMMExport WORD SequenceOutBound ( ) { return (loopflag); }
//-- "Name" returns full path of image file
BMMExport const TCHAR *Name ( ) { return (const TCHAR *)name; }
//-- "Filename" returns just the name of image file
BMMExport const TCHAR *Filename ( );
//-- "Device" is the device reponsible for producing this image.
// For file types, this is just informative. For non file types
// this is the way this image is identified. Therefore, it is
// important to save both name and device in order to properly
// identify an image.
BMMExport const TCHAR *Device ( ) { return (const TCHAR *)device; }
//-- Compare Two Bitmaps
BMMExport BOOL CompareName ( BitmapInfo *bi );
//-- Copy Image info. Only name, device and image characteristics are
// copied. User info, such as Custom Width, etc. is not copied.
BMMExport void CopyImageInfo ( BitmapInfo *from );
//-- Generic Write
BMMExport int SetFirstFrame ( int m ) { int o = fstart; fstart = m; return (o);}
BMMExport int SetLastFrame ( int s ) { int o = fend; fend = s; return (o);}
BMMExport int SetCurrentFrame ( int v ) { int o = fnumber; fnumber = v; return (o);}
BMMExport WORD SetSequenceOutBound ( WORD c ) { WORD o = loopflag; loopflag = c; return (o);}
BMMExport WORD SetWidth ( WORD s ) { WORD o = width; width = s; return (o);}
BMMExport WORD SetHeight ( WORD u ) { WORD o = height; height = u; return (o);}
BMMExport float SetGamma ( float c ) { float o = gamma; gamma = c; return (o);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -