📄 bitmap.h
字号:
BMMExport float SetAspect ( float k ) { float o = aspect; aspect = k; return (o);}
BMMExport int SetType ( int s ) { int o = type; type = s; return (o);}
BMMExport const TCHAR *SetName ( const TCHAR *n );
BMMExport const TCHAR *SetDevice ( const TCHAR *d );
//-- Custom Input Processing
BMMExport WORD CustWidth ( ) { return (cwidth); }
BMMExport WORD CustHeight ( ) { return (cheight); }
BMMExport void SetCustWidth ( WORD w ) { cwidth = w; }
BMMExport void SetCustHeight ( WORD h ) { cheight = h; }
BMMExport int StartFrame ( ) { return (start); }
BMMExport int EndFrame ( ) { return (end); }
BMMExport void SetStartFrame ( int s ) { start = s; }
BMMExport void SetEndFrame ( int e ) { end = e; }
BMMExport void SetCustomX ( int x ) { custxpos = x; }
BMMExport void SetCustomY ( int y ) { custypos = y; }
BMMExport int GetCustomX ( ) { return custxpos; }
BMMExport int GetCustomY ( ) { return custypos; }
BMMExport void SetCustomGamma ( float g ) { custgamma = g; }
BMMExport float GetCustomGamma ( ) { return custgamma; }
BMMExport void SetCustomStep ( int s ) { step = s; }
BMMExport int GetCustomStep ( ) { return step; }
BMMExport void SetPresetAlignment ( int p ) { preset_al = p; }
BMMExport int GetPresetAlignment ( ) { return preset_al; }
//-- Custom Input Flags
BMMExport DWORD GetCustomFlags ( ) { return (customflags); }
BMMExport void SetCustomFlag ( DWORD f ) { customflags |= f; }
BMMExport void ResetCustomFlag ( DWORD f ) { customflags &= ~f; }
BMMExport BOOL TestCustomFlags ( DWORD f ) { return (customflags & f); }
//-- Plug-In Parameter Block
BMMExport void* GetPiData ( ) { return pidata; }
BMMExport void SetPiData ( void *ptr ) { pidata = ptr; }
BMMExport DWORD GetPiDataSize ( ) { return pisize; }
BMMExport void SetPiDataSize ( DWORD s ) { pisize = s; }
BMMExport void ResetPiData ( );
BMMExport BOOL AllocPiData ( DWORD size );
//-- Used to create Format Specific Parameter Block. Name and/or Device must be defined before using it.
BMMExport void* CreateFmtSpecBlock ( void );
BMMExport void Copy ( BitmapInfo *from ); //\\-- OBSOLETE --\\//
BMMExport BitmapInfo &operator= ( BitmapInfo &from );
//-- Load/Save
BMMExport IOResult Save ( ISave *isave );
BMMExport IOResult Load ( ILoad *iload );
BMMExport void EnumAuxFiles ( NameEnumCallback& nameEnum, DWORD flags);
//-- Miscelaneous
BMMExport BOOL Validate ( );
BMMExport HWND GetUpdateWindow ( ) { return hWnd; }
BMMExport void SetUpdateWindow ( HWND hwnd ) { hWnd = hwnd; }
BMMExport DWORD GetGChannels ( );
BMMExport DWORD GetDeviceFlags ( );
};
//-----------------------------------------------------------------------------
//-- Bitmap I/O Class
//
// None of these methods are to be used directly. Use the BitmapManager for
// any image I/O.
//
class BitmapIO {
private:
UWORD* outputGammaTab; // this may be owned by gammaMgr
UWORD* privGammaTab; // private gamma table owned by the BitmapIO.
protected:
float gamma;
Bitmap *map; // The bitmap using this OUTPUT handler
BitmapStorage *storage; // The storage used by this INPUT handler
int openMode; // See above
//-- Linked list pointers for multiple output of a single bitmap
BitmapIO *prevIO;
BitmapIO *nextIO;
public:
// Used by the subclassed BitmapIO's to get pixels for output with
// the appropriate output gamma correction.
BMMExport int GetOutputPixels ( int x,int y,int pixels,BMM_Color_64 *ptr, BOOL preMultAlpha=TRUE);
// Used by the subclassed BitmapIO's to get 32 bit pixels for output with
// the appropriate output gamma correction and dither.
BMMExport int GetDitheredOutputPixels ( int x,int y,int pixels,BMM_Color_32 *ptr, BOOL preMultAlpha=TRUE);
// Used by the subclassed BitmapIO's to get a DIB for output with
// the appropriate output gamma correction.
BMMExport PBITMAPINFO GetOutputDib ( int depth = 24 );
// Used by the subclassed BitmapIO's to get a DIB for output with
// the appropriate output gamma correction and dither
BMMExport PBITMAPINFO GetDitheredOutputDib ( int depth = 24 );
BMMExport float OutputGamma();
// If a BitmapIO wants to do its own dithering, it should call
// these to find out if dithering is wanted. If it is a 24 bit or
// 32 bit format, it would usually just call GetDitheredOutputPixels instead.
BMMExport BOOL DitherTrueColor();
BMMExport BOOL DitherPaletted();
// Calculate a color palette for output color packing: gamma corrects
BMMExport int CalcOutputPalette(int palsize, BMM_Color_48 *pal);
BMMExport BitmapIO ( );
bVirtual ~BitmapIO ( );
BitmapInfo bi;
inline int OpenMode ( ) { return (openMode); }
inline void SetPrev ( BitmapIO *prev) { prevIO = prev; };
inline void SetNext ( BitmapIO *next) { nextIO = next; };
inline BitmapIO *Prev ( ) { return prevIO; };
inline BitmapIO *Next ( ) { return nextIO; };
BMMExport BitmapStorage *Storage ( );
inline Bitmap *Map ( ) { return map; };
bVirtual int ExtCount ( ) = 0; // Number of extemsions supported
bVirtual const TCHAR *Ext ( int n ) = 0; // Extension #n (i.e. "3DS")
bVirtual const TCHAR *LongDesc ( ) = 0; // Long ASCII description (i.e. "Targa 2.0 Image File")
bVirtual const TCHAR *ShortDesc ( ) = 0; // Short ASCII description (i.e. "Targa")
bVirtual const TCHAR *AuthorName ( ) = 0; // ASCII Author name
bVirtual const TCHAR *CopyrightMessage ( ) = 0; // ASCII Copyright message
bVirtual UINT Version ( ) = 0; // Version number * 100 (i.e. v3.01 = 301)
bVirtual int Capability ( ) = 0; // Returns IO module ability flags (see above)
bVirtual void ShowAbout ( HWND hWnd ) = 0; // Show DLL's "About..." box
//-- If the BMMIO_OWN_VIEWER flag is set, this method will be called
// whenever the user wants to view an image for this device. This
// is for devices which can "play" image sequences such as AVI's, FLIC's, etc.
//-- TH 2/26/96 -- Added BOOL return to indicate if view worked. If it didn't,
// it returns FALSE and the caller can view by the normal mechanism.
bVirtual BOOL ShowImage ( HWND hWnd, BitmapInfo *bi ) { return FALSE; }
//-- Show DLL's Control Panel
//
// If the user exists through an Ok, this function will return TRUE.
// If the user cancels out, it will return FALSE. False indicates
// nothing has changed so the system won't bother asking the plug-in
// if it wants to save data.
//
// This function is only called if the plug-in has defined it supports
// it (through the Capability flag above). The flag will indicate to
// the plug-in what operation is this control for (read, write, or
// generic).
//
bVirtual BOOL ShowControl ( HWND hWnd, DWORD flag ) { return FALSE; }
//-- Parameter Block Load and Save ------------------------------------
//
// The host will call EvaluateConfigure() to determine the buffer size
// required by the plug-in.
//
// SaveConfigure() will be called so the plug-in can transfer its
// parameter block to the host ( ptr is a pre-allocated buffer).
//
// LoadConfigure() will be called so the plug-in can load its
// parameter block back.
//
// Memory management is performed by the host using standard
// LocalAlloc() and LocalFree().
//
bVirtual DWORD EvaluateConfigure ( ) = 0;
bVirtual BOOL LoadConfigure ( void *ptr ) = 0;
bVirtual BOOL SaveConfigure ( void *ptr ) = 0;
//-- Used internaly to make sure current block belongs to Plug-In
bVirtual BOOL ValidatePiData ( BitmapInfo *bi );
//-- System Interface
BMMExport BOOL SilentMode ( );
//-- Calculate Desired Frame
//
// This is for multiframe sequences. It processes the desired frame
// based on user options. It is used at the Load() function to find
// out which frame to load.
//
// "fbi" is the one passed to Load()
// "frame" is a pointer to an integer to receive the frame number
BMMExport BMMRES GetFrame ( BitmapInfo *fbi, int *frame);
//-- Critical Error Handling
BMMExport BMMRES ProcessImageIOError ( BitmapInfo *bi, TCHAR *string = NULL);
BMMExport BMMRES ProcessImageIOError ( BitmapInfo *bi, int errorcode);
//---------------------------------------------------------------------
//-- Channels Required (for Output)
//
// By setting this flag, the plug-in can request the host to generate
// the given channels. Prior to Rendering, the host will scan the
// plug-ins in the chain of events and list all types of channels
// being requested. The plug-in, at the time of the Write() call, will
// have access to these channels through the channel interface
// described below in BitmapStorage().
//
// The generation of these channels should not, normally, be a
// default setting for a plug-in. These channels are memory hungry and
// if the plug-in won't use it, it should not ask for it. Normally
// the plug-in would ask the user which channels to save and set only
// the proper flags.
//
bVirtual DWORD ChannelsRequired ( ) { return BMM_CHAN_NONE; }
//-- Image Info
bVirtual BMMRES GetImageInfoDlg ( HWND hWnd, BitmapInfo *bi, const TCHAR *filename = NULL ) {return BMMRES_NODRIVER;}
bVirtual BMMRES GetImageInfo ( BitmapInfo *bi ) = 0;
//-- Image File Loaders (IFL handlers)
bVirtual BMMRES GetImageName ( BitmapInfo *bi, TCHAR *filename) {filename[0]=0; return (BMMRES_SUCCESS);}
//-- Image I/O (Not to use directly)
bVirtual BitmapStorage *Load ( BitmapInfo *bi, Bitmap *map, BMMRES *status ) = 0;
bVirtual BMMRES OpenOutput ( BitmapInfo *bi, Bitmap *map );
bVirtual BMMRES Write ( int frame );
bVirtual int Close ( int flag );
bVirtual PAVIFILE GetPaviFile ( ) { return NULL; }
// used internally to build output gamma table
BMMExport void InitOutputGammaTable(BitmapInfo*bi);
//-- Evaluate Matching Frame (R2)
bVirtual void EvalMatch ( TCHAR *matchString ) { matchString[0] = 0; }
};
//-----------------------------------------------------------------------------
//-- Bitmap Storage Class
//
// None of these methods are to be used directly. Use the Bitmap class for
// any image read/write.
//
//-- Channel Operations (for Get/Put16Channel)
#define BMM_CHANNEL_RED 0 //-- Get/Put only Red
#define BMM_CHANNEL_GREEN 1 //-- Get/Put only Green
#define BMM_CHANNEL_BLUE 3 //-- Get/Put only Blue
#define BMM_CHANNEL_ALPHA 4 //-- Get/Put only Alpha
#define BMM_CHANNEL_Z 5 //-- Get/Put only Z
#define BMM_CHANNEL_LUMINANCE 6 //-- Get (R+G+B)/3
class BitmapStorage {
#ifdef DESIGN_VER
friend class GcsBitmap;
#endif
protected:
int openMode; // See above
UINT usageCount; // Number of Bitmaps using this storage
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -