⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bitmap.h

📁 hl2 source code. Do not use it illegal.
💻 H
📖 第 1 页 / 共 5 页
字号:
      inline  int              Get16Gray                   ( int x,int y,int pixels,WORD *ptr )
                                                           { if (storage) return storage->Get16Gray(x,y,pixels,ptr);         return 0; };
      inline  int              GetPixels                   ( int x,int y,int pixels,BMM_Color_64 *ptr )
                                                           { if (storage) return storage->GetPixels(x,y,pixels,ptr);         return 0; };
      BMMExport int            PutPixels                   ( int x,int y,int pixels,BMM_Color_64 *ptr );
      inline  int              GetLinearPixels             ( int x,int y,int pixels,BMM_Color_64 *ptr )
                                                           { if (storage) return storage->GetLinearPixels(x,y,pixels,ptr);     return 0; };
      inline  int              GetIndexPixels              ( int x,int y,int pixels,BYTE *ptr )
                                                           { if (storage) return storage->GetIndexPixels(x,y,pixels,ptr);      return 0; };
      inline  int              PutIndexPixels              ( int x,int y,int pixels,BYTE *ptr )
                                                           { if (storage) return storage->PutIndexPixels(x,y,pixels,ptr);      return 0; };
      inline  int              CropImage                   ( int width,int height,BMM_Color_64 fillcolor)
                                                           { if (storage) return storage->CropImage(width,height,fillcolor);   return 0; };
      inline  int              CropImage                   ( int width,int height,int fillindex)
                                                           { if (storage) return storage->CropImage(width,height,fillindex);   return 0; };
      inline  int              ResizeImage                 ( int width,int height,int newpalette)
                                                           { if (storage) return storage->ResizeImage(width,height,newpalette);return 0; };
      inline  int              CopyImage                   ( Bitmap *from,int operation,BMM_Color_64 fillcolor, BitmapInfo *bi = NULL)
                                                           { if (storage) return storage->CopyImage(from,operation,fillcolor,bi); return 0; };
      inline  int              CopyImage                   ( Bitmap *from,int operation,int fillindex)
                                                           { if (storage) return storage->CopyImage(from,operation,fillindex); return 0; };
      inline  int              GetPalette                  ( int start,int count,BMM_Color_48 *ptr)
                                                           { if (storage) return storage->GetPalette(start,count,ptr);         return 0; };
      inline  int              SetPalette                  ( int start,int count,BMM_Color_48 *ptr)
                                                           { if (storage) return storage->SetPalette(start,count,ptr);         return 0; };

	  //-- GRAINSTART

      // Effects methods (GG 11/03/98) ----------

      BMMExport void			FilmGrain				( float grain, BOOL mask, PBITMAP_FX_CALLBACK callback = NULL, void *param = NULL );

	  //-- GRAINEND

      // GBuffer methods ---------------------

	  inline void             *GetChannel                ( ULONG channelID, ULONG& chanType ) 
                                       { if (storage) return storage->GetChannel(channelID, chanType); return NULL; }   
      
      inline GBuffer *GetGBuffer()  { return storage? storage->GetGBuffer(): NULL; } 

      inline ULONG            CreateChannels             ( ULONG channelIDs ) 
                                             { if (storage) return storage->CreateChannels(channelIDs); return 0; }   
      inline void             DeleteChannels             ( ULONG channelIDs ) 
                                             { if (storage) storage->DeleteChannels(channelIDs); }     
      inline ULONG            ChannelsPresent            ( )   
                                             { if (storage) return storage->ChannelsPresent();  return 0; }   
      inline RenderInfo*           GetRenderInfo()        { if (storage) return storage->GetRenderInfo(); return NULL; }

      inline RenderInfo*           AllocRenderInfo()     { if (storage) return storage->AllocRenderInfo(); return NULL; }


      //---------------------------------------------------------------------
      //
      //   This call 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. 
      //

      BMMExport BOOL          PrepareGChannels           ( BitmapInfo *bi ); 
      BMMExport BOOL          PrepareGChannels           ( DWORD channels ); 


      BMMExport int           GetFiltered                ( float u,float v,float du,float dv,BMM_Color_64 *ptr );
      BMMExport int           SetDither                  ( UINT ditherType );
      BMMExport int           SetFilter                  ( UINT filterType );
      inline    int           HasFilter                  ( ) { return (filter) ? 1:0; };
      inline    BitmapFilter  *Filter                    ( ) { return filter; }; 
      BMMExport int           SetStorage                 ( BitmapStorage *storage);
      inline    BitmapStorage *Storage                   ( ) { return storage; };
      inline    void          NullStorage                ( ) { storage = NULL; };
      
      //-- Windows DIB Conversion -------------------------------------------
      //
      //   Where depth is either 24 (BGR) or 32 (BGR0)
      //

      BMMExport PBITMAPINFO    ToDib                       ( int depth = 24, UWORD *gam=NULL, BOOL dither=FALSE);

      //-- Do not use this directly. Instead, use BitmapManager::Create(PBITMAPINFO)

      BMMExport BOOL           FromDib                     ( PBITMAPINFO pbmi );
      
      //-- Image output operations ------------------------------------------
      //
      //  To write a single image to a file/device:
      //
      //  *> Create BitmapInfo class: BitmapInfo bi;
      //
      //  *> Define output file/device:
      //
      //     Directly:       bi.SetName("file.tga");
      //   or
      //     User Interface: BitmapManager::SelectFileOutput( ... &bi ...)
      //
      //  *> Define bitmap: 
      //
      //                     bi.SetWidth(x)
      //                     bi.SetHeight(y)
      //                     etc...
      //
      //  *> Create bitmap:  Bitmap *map = BitmapManager::Create(&bi);
      //                     
      //
      //  *> Do something:   map->Fill({0,0,0});
      //
      //  *> OpenOutput:     map->OpenOutput(&bi);
      //
      //  *> Write:          map->Write(&bi)
      //
      //  *> Close:          map->Close(&bi)
      //
      //  To write a multiframe file, just keep doing something different to
      //  the bimap and keep writting. 
      //
      //  To write a sequence of images to a file/device:
      //
      //  *> Create BitmapInfo class: BitmapInfo bi;
      //
      //  *> Define output file/device:
      //
      //     Directly:       bi.SetName("file.tga");
      //   or
      //     User Interface: BitmapManager::SelectFileOutput( ... &bi ...)
      //
      //  *> Define bitmap: 
      //
      //                     bi.SetWidth(x)
      //                     bi.SetHeight(y)
      //
      //                     bi.SetFirstFrame(0)
      //                     bi.SetLastFrame(29)
      //
      //                     etc...
      //
      //  *> Create bitmap:  Bitmap *map = BitmapManager::Create(&bi);
      //                     
      //
      //  *> OpenOutput:     map->OpenOutput(&bi);
      //
      //     for (x = 0 to 29) {
      //        *> Do something to image...
      //        *> Write:    map->Write(&bi,x);
      //     }
      //
      //  *> Close:          map->Close(&bi)
      //
      //
      //  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().
      //
      //  It is ok to use WriteAll() and CloseAll() if you have just one
      //  output defined.
      //
      
      BMMExport BMMRES         OpenOutput                  ( BitmapInfo *bi );                                        // Open output
      BMMExport BMMRES         Write                       ( BitmapInfo *bi, int frame = BMM_SINGLEFRAME );         // Write frame to file
      BMMExport BMMRES         WriteAll                    ( int frame = BMM_SINGLEFRAME );                         // Write all open outputs
      BMMExport int            Close                       ( BitmapInfo *bi, int flag = BMM_CLOSE_COMPLETE );         // Close an open output
      BMMExport int            CloseAll                    ( int flag = BMM_CLOSE_COMPLETE);                          // Close all open outputs

      //-- Window gravity

      #define   BMM_UL  1      //-- Upper Left
      #define   BMM_LL  2      //-- Lower Left
      #define   BMM_UR  3      //-- Upper Right
      #define   BMM_LR  4      //-- Upper Left
      #define   BMM_CN  5      //-- Center

      #define   BMM_RND 10     //-- Renderer (Save/Restore)
      #define   BMM_VPP 11     //-- Video Post Primary (Save/Restore)
      #define   BMM_VPS 12     //-- Video Post Secondary (Save/Restore)

      BMMExport int            Display                     ( TCHAR *title = NULL, 	int position = BMM_CN, 
      		BOOL autonomous = FALSE, BOOL savebutton = TRUE, CropCallback *crop=NULL );
      BMMExport int            UnDisplay                   ( );
      BMMExport HWND           GetWindow                   ( );
      BMMExport void           RefreshWindow               ( RECT *rect = NULL );
      BMMExport void           SetWindowTitle              ( TCHAR *title );
	  BMMExport void           SetCroppingValues		   ( float u, float v, float w, float h, BOOL placeImage);

      //-- Get a Different Frame  -------------------------------------------
      //
      //   For  multifrane bitmaps (FLI's, AVI's, DDR devices, etc.),  if you
      //   simply want to load  another frame replacing a previously "Load"ed
      //   image.
      //
      //   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.
      //
      //   To define desired frame, use bi->SetCurrentFrame( frame );
      //
      
      BMMExport BMMRES         GoTo                        ( BitmapInfo *bi );

      //-- Handy built-in functions

      BMMExport int            Fill                        ( int r,int g,int b,int alpha);

	  // Set a callback so can get notified if storage changed
      BMMExport void 		  SetNotify( BitmapNotify *bmnot=NULL);
      BitmapNotify *		  GetNotify() { return bmNotify; }
		
	  BMMExport BOOL IsAutonomousVFB();

 	  // Generic expansion function
	  BMMExport int Execute(int cmd, ULONG arg1=0, ULONG arg2=0, ULONG arg3=0); 

	  DWORD GetModifyID() { return modifyID; }
	  void SetModifyID(DWORD m) { modifyID = m; }
	  BMMExport void IncrModifyID();

      // Print the bitmap (if supported by the host app)
      BMMExport void Print(bool silent = false);

	  BMMExport void ShowProgressLine(int y); // y<0 to hide
};

//-- Various Bitmap In-Memory Lists -------------------------------------------

struct BMMStorageList {
	BitmapStorage *ptr;
	BMMStorageList *next;
	};

struct BMMFilterList {
	BitmapFilter *ptr;
	BMMFilterList *next;
	} ;

struct BMMBitmapList {
	Bitmap *ptr;
	BMMBitmapList *next;
	};

typedef struct tag_BMMGammaSettings {
	BitmapManager *mgr;
	BitmapInfo    *bi;
	BOOL           out;
	} BMMGammaSettings;     

typedef struct tag_BMMVfbPalette {
	BYTE  r,g,b;
	} BMMVfbPalette;     

class BitmapFileInputDialog {
	public:
	virtual BOOL BrowseBitmapFilesInput(BitmapInfo* info, HWND hWnd, TCHAR* title, BOOL view) = 0;
	};

class BitmapFileOutputDialog {
	public:
	virtual BOOL BrowseBitmapFilesOutput(BitmapInfo* info, HWND hWnd, TCHAR* title) = 0;
	};

//-----------------------------------------------------------------------------
//-- Main Bitmap Manager Class
//

class BitmapManager {
   
   public:
   
      BMMVfbPalette            *pal;

      //-- Construction/Destruction
      
      BitmapManager               ( BMMInterface *i) { pal = NULL; }
      BitmapManager               ( BMMInterface *i,const TCHAR *name) { pal = NULL; }
      virtual  BMMExport    ~BitmapManager               ( );
      friend void       DoConstruct      ( BitmapManager *m, BMMInterface *i, const TCHAR *name);

      //-- These are for internal use only
      
      virtual int            DeleteAllMaps          

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -