00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #pragma once
00020 #include "BMMExport.h"
00021 #include <WTypes.h>
00022 #include <vfw.h>
00023 #include <CommDlg.h>
00024 #include "maxheap.h"
00025 #include "palutil.h"
00026 #include "linklist.h"
00027 #include "gbuf.h"
00028 #include "pixelbuf.h"
00029 #include "path.h"
00030 #include "containers\array.h"
00031 #include "assetmanagement\AssetType.h"
00032 #include "assetmanagement\IAssetAccessor.h"
00033 #include "assetmanagement\AssetUser.h"
00034 #include "matrix3.h"
00035 #include "GetCOREInterface.h"
00036 #include "box2.h"
00037
00038
00039 #define INTBITS (sizeof(int) * 8)
00040
00041
00042 #define IMGCLASSID 1
00043 #define CYCLECLASSID 2
00044 #define FLICCLASSID 5
00045 #define TARGACLASSID 6
00046 #define YUVCLASSID 7
00047 #define FBCLASSID 8
00048 #define WSDCLASSID 9
00049 #define IFLCLASSID 10
00050 #define BMPCLASSID 11
00051 #define JPEGCLASSID 12
00052 #define TARGAPLSCLASSID 13
00053 #define AVICLASSID 14
00054 #define RLACLASSID 15
00055 #define RPFCLASSID 16
00056 #define MPGCLASSID 17
00057
00058 #define MAXOPENEXR_CLASSID Class_ID(0x12f95b5e, 0x62a60b57)
00059
00060
00061
00062 class BitmapManager;
00063 class BitmapManagerImp;
00064 class BitmapProxyManager;
00065 class BitmapStorage;
00066 class BitmapFilter;
00067 class BitmapDither;
00068 class BitmapInfo;
00069 class BitmapPicker;
00070 class BitmapIO;
00071 class Bitmap;
00072
00073
00074
00075 class GraphicsWindow;
00076 class BMMInterface;
00077 class DllDir;
00078
00079
00080
00081 extern int TheSystemFrame;
00082
00083
00084
00085
00086
00087 extern BMMExport BitmapManager *TheManager;
00088
00089
00090
00091
00092
00093 #ifndef NULL
00094 #define NULL (0)
00095 #endif
00096
00097
00098
00099
00100 class bmmHistoryList: public MaxHeapOperators {
00101
00102 protected:
00103
00104 MCHAR title[MAX_PATH];
00105 MCHAR initDir[MAX_PATH];
00106 HWND hParent,hChild;
00107 int listID;
00108
00109 BMMExport void StripSpaces (MCHAR *string);
00110
00111 public:
00112
00113 BMMExport void Init ( const MCHAR *title );
00114 BMMExport void SetDlgInfo ( HWND hParent, HWND hChild, int ListID );
00115 BMMExport void LoadDefaults( );
00116 BMMExport void LoadList ( );
00117 BMMExport void SaveList ( );
00118 BMMExport void SetPath ( bool first = false );
00119 BMMExport void NewPath ( const MCHAR *path );
00120 BMMExport MCHAR*DefaultPath ( ) { return initDir; }
00121 BMMExport void SetPath ( const MCHAR *path );
00122 BMMExport int Count ( );
00123
00124 };
00125
00126
00127
00128 struct BMMImageInfo : public MaxHeapOperators {
00129 int width,height;
00130 float aspect,gamma;
00131 DWORD flags;
00132 };
00133
00134
00139 #define BMM_NO_TYPE 0 //!< Not allocated yet
00140 #define BMM_LINE_ART 1 //!< 1-bit monochrome image
00141 #define BMM_PALETTED 2 //!< 8-bit paletted image. Each pixel value is an index into the color table.
00142 #define BMM_GRAY_8 3 //!< 8-bit grayscale bitmap.
00143 #define BMM_GRAY_16 4 //!< 16-bit grayscale bitmap.
00144 #define BMM_TRUE_16 5 //!< 16-bit true color image.
00145 #define BMM_TRUE_32 6 //!< 32-bit color: 8 bits each for Red, Green, Blue, and Alpha.
00146 #define BMM_TRUE_64 7 //!< 64-bit color: 16 bits each for Red, Green, Blue, and Alpha.
00147
00150 #define BMM_LOGLUV_32 13
00151
00153 #define BMM_LOGLUV_24 14
00154
00156 #define BMM_LOGLUV_24A 15
00157 #define BMM_REALPIX_32 16 //!< The "Real Pixel" format.
00158 #define BMM_FLOAT_RGBA_32 17 //!< 32-bit floating-point per component (non-compressed), RGB with or without alpha
00159 #define BMM_FLOAT_GRAY_32 18 //!< 32-bit floating-point (non-compressed), monochrome/grayscale
00160
00161
00162
00163 #define BMM_TRUE_24 8 //!< 24-bit color: 8 bits each for Red, Green, and Blue. Cannot be written to.
00164 #define BMM_TRUE_48 9 //!< 48-bit color: 16 bits each for Red, Green, and Blue. Cannot be written to.
00165 #define BMM_YUV_422 10 //!< This is the YUV format - CCIR 601. Cannot be written to.
00166 #define BMM_BMP_4 11 //!< Windows BMP 16-bit color bitmap. Cannot be written to.
00167 #define BMM_PAD_24 12 //!< Padded 24-bit (in a 32 bit register). Cannot be written to.
00168
00171 #define BMM_FLOAT_RGB_32 19
00172
00175 #define BMM_FLOAT_A_32 20
00176
00177
00178
00179
00180 #define MAX_DESCRIPTION 256
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194 #define MINGAMMA 0.2f
00195 #define MAXGAMMA 5.0f
00196
00199 #define BMM_NOT_OPEN 0 //!< Not opened yet
00200 #define BMM_OPEN_R 1 //!< Read-only
00201 #define BMM_OPEN_W 2 //!< Write-only. No reads will occur.
00202
00203
00204
00205
00209 typedef unsigned short BMMRES;
00210
00211 #define BMMRES_SUCCESS 0 //!< Success - No error occurred.
00212 #define BMMRES_ERRORTAKENCARE 1 //!< Error - Function has already taken action to process the error.
00213 #define BMMRES_FILENOTFOUND 2 //!< The file being accessed was not found.
00214 #define BMMRES_MEMORYERROR 3 //!< Insufficient memory for the requested operation.
00215 #define BMMRES_NODRIVER 4 //!< Device driver responsible for image not present
00216 #define BMMRES_IOERROR 5 //!< Input / Output error.
00217 #define BMMRES_INVALIDFORMAT 6 //!< The file being access was not of the proper format for the requested operation.
00218 #define BMMRES_CORRUPTFILE 7 //!< The file being accessed was corrupt.
00219 #define BMMRES_SINGLEFRAME 8 //!< Results from a goto request on a single frame image
00220 #define BMMRES_INVALIDUSAGE 9 //!< Bad argument passed to function (Developer Mistake)
00221
00223 #define BMMRES_RETRY 10 //!< User selected "Retry" from error dialogue.
00224 #define BMMRES_NUMBEREDFILENAMEERROR 11 //!< This can be passed as an errorcode to BitmapIO::ProcessImageIOError().
00225 #define BMMRES_INTERNALERROR 12 //!< An internal error occurred.
00226 #define BMMRES_BADFILEHEADER 13 //!< A file header error occurred.
00227 #define BMMRES_CANTSTORAGE 14 //!< This is used internally.
00228 #define BMMRES_BADFRAME 15 //!< Invalid Frame Number Requested
00229
00230
00231
00235 #define BMMIO_NONE 0 //!< Not defined yet
00236
00237 #define BMMIO_READER (1<<0) //!< Reads image files
00238 #define BMMIO_WRITER (1<<1) //!< Writes image files
00239 #define BMMIO_EXTENSION (1<<2) //!< Uses file extension (File Filter Type)
00240 #define BMMIO_MULTIFRAME (1<<3) //!< "File" contains multiple frames (i.e. FLC, AVI)
00241
00242 #define BMMIO_THREADED (1<<4) //!< Not used. All plugin are expected to be "thread aware".
00243 #define BMMIO_RANDOM_ACCESS (1<<5) //!< Can read and/or write frames in any order
00244 #define BMMIO_NON_CONCURRENT_ACCESS (1<<6) //!< Device cannot handle multiple, concurrent requests (FLC, AVI, VTR's, etc)
00245
00246 #define BMMIO_OWN_VIEWER (1<<7) //!< Driver has its own image viewer for its image type as opposed to using the generic Virtual Frame Buffer.
00247
00248
00249
00250 #define BMMIO_FRAMEBUFFER (1<<7) //!< Frame Buffer Driver
00251 #define BMMIO_GRABBER (1<<8) //!< Device Grabs Video
00252
00255 #define BMMIO_INFODLG (1<<9) //!< Has Info Dialog
00256
00259 #define BMMIO_UNINTERRUPTIBLE (1<<10) //!< Uninterruptible Driver
00260
00263 #define BMMIO_EVALMATCH (1<<11) //!< EvalMatch() method has been implemented.
00264
00270 #define BMMIO_IFL (1<<28) //!< Special IFL device
00271
00275 #define BMMIO_CONTROLREAD (1<<29) //!< Device Driver has Control Panel for Read Operations
00276 #define BMMIO_CONTROLWRITE (1<<30) //!< Device Driver has Control Panel for Write Operations
00277 #define BMMIO_CONTROLGENERIC (1<<31) //!< Device Driver has a generic Control Panel
00278
00279
00280
00281
00286 #define BMM_CLOSE_COMPLETE 0 //!< Close and save the image.
00287
00291 #define BMM_CLOSE_ABANDON 1 //!< Close but abandon the image.
00292
00293
00294
00295
00312 #define BMM_FILTER_NONE 0 //!< Specifies no filtering should be performed.
00313 #define BMM_FILTER_DUMMY 1 //!< No longer used.
00314 #define BMM_FILTER_SUM 2 //!< Specifies summed area filtering.
00315 #define BMM_FILTER_PYRAMID 3 //!< Specifies pyramidal filtering.
00316
00317
00318
00319
00320 #define BMM_FILTER_NOFLAGS ((DWORD)0)
00321 #define BMM_FILTER_LERP_WRAP ((DWORD)(1<<0))
00322
00323 #define BMM_FILTER_BUILD_FAILED ((DWORD)(1<<1))
00324
00325
00326
00327 #define BMM_DITHER_NONE 0
00328 #define BMM_DITHER_FLOYD 1
00329
00330
00331
00332 #define MAX_PYRAMID_DEPTH 12
00333 #define LAYER_DIM MAX_PYRAMID_DEPTH+1
00334
00335 struct BMM_Pyramid: public MaxHeapOperators {
00336 WORD dmax;
00337 void *map[LAYER_DIM];
00338 void *alpha[LAYER_DIM];
00339 };
00340
00341
00342
00343 struct BMM_SAT: public MaxHeapOperators {
00344 DWORD *sat_r,*sat_g,*sat_b,*sat_a;
00345 };
00346
00349 #define COPY_IMAGE_CROP 0 //!< Copy image to current map size w/cropping if necessary
00350
00352 #define COPY_IMAGE_RESIZE_LO_QUALITY 1 //!< Resize source image to destination map size (draft)
00353
00355 #define COPY_IMAGE_RESIZE_HI_QUALITY 2 //!< Resize source image to destination map size (final)
00356 #define COPY_IMAGE_USE_CUSTOM 3 //!< Resize based on Image Input Options (BitmapInfo *)
00357
00358
00359
00360 typedef LinkedEntryT<MSTR> MSTREntry;
00361 typedef LinkedListT<MSTR,MSTREntry> MSTRList;
00362
00363
00364
00365 typedef BOOL (WINAPI* PBITMAP_FX_CALLBACK)( LPVOID lpparam, int done, int total, MCHAR* msg );
00366
00367
00368
00369
00370
00371
00376 class BMM_IOHandler : public MaxHeapOperators
00377 {
00378 private:
00379
00380
00381 MCHAR ioShortDesc[MAX_DESCRIPTION];
00382 MCHAR ioLongDesc[MAX_DESCRIPTION];
00383 DWORD ioCapabilities;
00384
00385
00386
00387 MSTRList ioExtension;
00388
00389
00390
00391 int dllNumber;
00392
00393 Class_ID mClassID;
00394
00395 SClass_ID mSuperID;
00396
00397 public:
00398
00401 BMMExport BMM_IOHandler();
00402
00408 BMMExport MCHAR* ShortDescription ( const MCHAR* d = NULL );
00414 BMMExport MCHAR* LongDescription ( const MCHAR* d = NULL );
00422 BMMExport MCHAR* Extension ( int index, const MCHAR* e = NULL );
00425 BMMExport int NumExtensions ( ) { return ioExtension.Count(); }
00426
00430 BMMExport void SetCD ( ClassDesc* dll );
00432 BMMExport ClassDesc* GetCD ( );
00433 BMMExport Class_ID GetClassID ( );
00434 BMMExport SClass_ID GetSuperID ( );
00435 BMMExport void SetDllNumber ( int num ) { dllNumber = num; }
00436 BMMExport int GetDllNum ( ) { return dllNumber; }
00437
00442 BMMExport void SetCapabilities ( DWORD cap ) { ioCapabilities |= cap;};
00445 BMMExport DWORD GetCapabilities ( ) { return (ioCapabilities);};
00453 BMMExport BOOL TestCapabilities ( DWORD cap ) { return ((ioCapabilities& cap) != 0);};
00455 BMMExport BMM_IOHandler& operator=(BMM_IOHandler& from);
00456 };
00457
00458
00459
00460
00461
00462
00463 typedef LinkedEntryT<BMM_IOHandler> BMM_IOHandlerEntry;
00464 typedef LinkedListT<BMM_IOHandler,BMM_IOHandlerEntry> BMM_IOHandlerList;
00465
00470 class BMM_IOList: public BMM_IOHandlerList {
00471
00472 BOOL listed;
00473
00474 public:
00475
00478 BMM_IOList ( ) { listed = FALSE; }
00479
00485 BOOL Listed ( BOOL f) { listed = f; return (listed);};
00488 BOOL Listed ( ) { return (listed);};
00489
00497 BMMExport int FindDevice ( const MCHAR *name);
00504 BMMExport int FindDeviceFromFilename ( const MCHAR *name);
00519 BMMExport int ResolveDevice ( BitmapInfo *bi );
00526 BMMExport DWORD GetDeviceCapabilities ( const MCHAR *name);
00527
00528
00529
00537 BMMExport BitmapIO *CreateDevInstance( const MCHAR *d );
00545 BMMExport BitmapIO *CreateDevInstance( int idx );
00546
00547 };
00548
00549
00550
00551
00552
00553
00554
00555 enum ProjectionType { ProjPerspective=0, ProjParallel=1 };
00556
00557
00558
00559
00593 class RenderInfo: public MaxHeapOperators {
00594 public:
00605 RenderInfo();
00606 ProjectionType projType;
00607 float kx,ky;
00608 float xc,yc;
00609 BOOL fieldRender;
00610 BOOL fieldOdd;
00611
00612
00613 TimeValue renderTime[2];
00614 Matrix3 worldToCam[2];
00615 Matrix3 camToWorld[2];
00616 Rect region;
00625 BMMExport Point2 MapWorldToScreen(Point3 p, int field=0) { return MapCamToScreen(worldToCam[field]*p);}
00631 BMMExport Point2 MapCamToScreen(Point3 p);
00637 BMMExport Ray MapScreenToCamRay(Point2 p);
00646 BMMExport Ray MapScreenToWorldRay(Point2 p, int field=0);
00647 };
00648
00649
00650
00651
00652
00656 #define MAP_NOFLAGS ((DWORD)0) //!< The bitmap has none of the characteristics below.
00657 #define MAP_READY ((DWORD)(1<<0)) //!< This bitmap has had memory allocated to it, or is accessible directly.
00658
00661 #define MAP_HAS_ALPHA ((DWORD)(1<<1)) //!< The bitmap has an alpha channel.
00662 #define MAP_ALPHA_PREMULTIPLIED ((DWORD)(1<<2)) //!< The bitmap has pre-multiplied alpha.
00663 #define MAP_PALETTED ((DWORD)(1<<3)) //!< The bitmap uses a palette (not true color).
00664 #define MAP_FRAME_SYSTEM_LOCKED ((DWORD)(1<<4)) //!< This flag is no longer used.
00665 #define MAP_DITHERED ((DWORD)(1<<5)) //!< The bitmap is dithered.
00666 #define MAP_FLIPPED ((DWORD)(1<<6)) //!< The bitmap is flipped horizontally
00667 #define MAP_INVERTED ((DWORD)(1<<7)) //!< The bitmap is flipped vertically
00668
00669
00670
00671
00672 #define MAP_USE_SCALE_COLORS ((DWORD)(1<<10)) //!< Scale colors when high dynamic range values are out of gamut
00673
00678 #define MAP_PROXY ((DWORD)(1<<11)) //!< Indicates a proxy bitmap, reduced from original size / bit depth
00679
00683 #define MAP_PROXYREQUEST ((DWORD)(1<<12)) //!< Indicates a request to load proxy bitmap, reduced from original size / bit depth
00684
00685 #ifdef _ENABLE_BITMAP_PRINTING_
00686 #define MAP_HAS_BGIMAGE ((DWORD)(1<<29)) //!< internal use only
00687 #endif
00688 #define MAP_LEGAL_DELETE ((DWORD)(1<<30)) //!< internal use only
00689 #define MAP_VIEW_FILTERED ((DWORD)(1<<31)) //!< Test stuff
00690
00691 #define MAP_ALL_FLAGS 0xFFFFFFFF
00692
00693
00694
00695
00696
00697
00698
00699
00700 #define BMM_PROGRESS WM_USER + 0x120 //-- wParam: Current lParam: Total
00701
00702
00703
00704
00705
00706 #define BMM_CHECKABORT WM_USER + 0x121 //-- wParam: 0 lParam: *BOOL
00707
00708
00709
00710
00711 #define BMM_TEXTMSG WM_USER + 0x122 //-- wParam: 0 lParam: LPCMSTR
00712
00723 class BitmapInfo: public MaxHeapOperators {
00724
00725
00726
00727 MaxSDK::Util::Path mFilename;
00728 MaxSDK::AssetManagement::AssetUser mAssetUser;
00729
00730
00731
00732 MCHAR device[MAX_DESCRIPTION];
00733
00734
00735
00736 HWND hWnd;
00737
00738
00739
00740 void *pidata;
00741 DWORD pisize;
00742
00743
00744
00746
00747 BitmapInfo *proxysubject;
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758 WORD width,height;
00759 float aspect,gamma;
00760 int fstart,fend;
00761 DWORD flags,type;
00762
00763
00764
00765
00766
00767
00768
00769 WORD cwidth,cheight;
00770 int custxpos,custypos;
00771 int start,end;
00772 int step,preset_al;
00773 float custgamma;
00774
00775 #define BMM_UNDEF_FRAME 0x7FFF0000
00776
00780 #define BMM_CUSTOM_GAMMA ((DWORD)(1 << 0)) //!< Custom gamma setting
00781 #define BMM_CUSTOM_SIZE ((DWORD)(1 << 1)) //!< Custom size setting
00782 #define BMM_CUSTOM_RESFIT ((DWORD)(1 << 2)) //!< Bitmap is to be resized
00783 #define BMM_CUSTOM_POS ((DWORD)(1 << 3)) //!< Bitmap has a custom positioning
00784 #define BMM_CUSTOM_FILEGAMMA ((DWORD)(1 << 4)) //!< Bitmap has a custom file gamma setting
00785 #define BMM_CUSTOM_IFLENUMFILES ((DWORD)(1 << 5)) //!<
00786 #define BMM_CUSTOM_HDR_TYPE ((DWORD)(1 << 6)) //!< Internal Use Only. Bitmap has custom hdr type that reads storage infor from BitMap Info and not from UI.
00787
00789
00795 #define BMM_CUSTOM_POSNW 0 //!< Top Left
00796 #define BMM_CUSTOM_POSN 1 //!< Top Center
00797 #define BMM_CUSTOM_POSNE 2 //!< Top Right
00798 #define BMM_CUSTOM_POSW 3 //!< Middle Left
00799 #define BMM_CUSTOM_POSCN 4 //!< Center
00800 #define BMM_CUSTOM_POSE 5 //!< Middle Right
00801 #define BMM_CUSTOM_POSSW 6 //!< Bottom Left
00802 #define BMM_CUSTOM_POSS 7 //!< Bottom Center
00803 #define BMM_CUSTOM_POSSE 8 //!< Bottom Right
00804
00805 DWORD customflags;
00806
00807 int fnumber;
00808
00809
00810
00811
00812
00813
00814 #define BMM_SEQ_WRAP 0 //-- Wraps around back to start point
00815 #define BMM_SEQ_ERROR 1 //-- Generates an error
00816 #define BMM_SEQ_HOLD 2 //-- Holds last frame when done
00817
00818 WORD loopflag;
00819
00820 void doConstruct ( );
00821
00822 public:
00823
00837 BMMExport BitmapInfo ( );
00843 BMMExport BitmapInfo ( const MCHAR *n );
00849 BMMExport BitmapInfo ( const MaxSDK::AssetManagement::AssetUser &asset );
00856 BMMExport BitmapInfo ( const BitmapInfo &bi );
00857 BMMExport ~BitmapInfo ( );
00858
00859
00860
00862 BMMExport DWORD Flags ( ) { return (flags); }
00869 BMMExport DWORD SetFlags ( DWORD f ) { flags |= f; return (flags); }
00870 BMMExport DWORD ResetFlags ( DWORD f ) { flags &= ~f; return (flags); }
00876 BMMExport BOOL TestFlags ( DWORD f ) { return (flags & f); }
00877
00878
00879
00882 BMMExport WORD Width ( ) { return (width); }
00885 BMMExport WORD Height ( ) { return (height); }
00887 BMMExport float Gamma ( ) { return (gamma); }
00889 BMMExport float Aspect ( ) { return (aspect);}
00891 BMMExport int Type ( ) { return (type); }
00895 BMMExport int FirstFrame ( ) { return (fstart); }
00897 BMMExport int LastFrame ( ) { return (fend); }
00900 BMMExport int NumberFrames ( ) { return (fend - fstart + 1); }
00902 BMMExport int CurrentFrame ( ) { return (fnumber); }
00917 BMMExport WORD SequenceOutBound ( ) { return (loopflag); }
00918
00926 BMMExport const MCHAR *Name ( ) const;
00927
00933 BMMExport MaxSDK::Util::Path GetPathEx() const;
00934
00935
00936
00939 BMMExport const MCHAR *Filename ( );
00940
00941
00942
00943
00944
00945
00946
00952 BMMExport const MCHAR *Device ( ) { return (const MCHAR *)device; }
00953
00954
00955
00965 BMMExport BOOL CompareName ( BitmapInfo *bi );
00966
00967
00968
00969
00982 BMMExport void CopyImageInfo ( BitmapInfo *from );
00983
00984
00985
00991 BMMExport int SetFirstFrame ( int m ) { int o = fstart; fstart = m; return (o);}
00997 BMMExport int SetLastFrame ( int s ) { int o = fend; fend = s; return (o);}
01003 BMMExport int SetCurrentFrame ( int v ) { int o = fnumber; fnumber = v; return (o);}
01020 BMMExport WORD SetSequenceOutBound ( WORD c ) { WORD o = loopflag; loopflag = c; return (o);}
01021
01028 BMMExport WORD SetWidth ( WORD s ) { WORD o = width; width = s; return (o);}
01035 BMMExport WORD SetHeight ( WORD u ) { WORD o = height; height = u; return (o);}
01042 BMMExport float SetGamma ( float c ) { float o = gamma; gamma = c; return (o);}
01049 BMMExport float SetAspect ( float k ) { float o = aspect; aspect = k; return (o);}
01056 BMMExport int SetType ( int s ) { int o = type; type = s; return (o);}
01057
01063 BMMExport void SetPath(const MaxSDK::Util::Path &path);
01064
01087 BMMExport const MCHAR *SetName ( const MCHAR *n );
01088
01090 BMMExport const MaxSDK::AssetManagement::AssetUser& GetAsset() const;
01091
01096 BMMExport void SetAsset( const MaxSDK::AssetManagement::AssetUser& assetUser ) ;
01097
01103 BMMExport const MCHAR *SetDevice ( const MCHAR *d );
01104
01105
01106
01108 BMMExport WORD CustWidth ( ) { return (cwidth); }
01110 BMMExport WORD CustHeight ( ) { return (cheight); }
01115 BMMExport void SetCustWidth ( WORD w ) { cwidth = w; }
01120 BMMExport void SetCustHeight ( WORD h ) { cheight = h; }
01123 BMMExport int StartFrame ( ) { return (start); }
01126 BMMExport int EndFrame ( ) { return (end); }
01132 BMMExport void SetStartFrame ( int s ) { start = s; }
01137 BMMExport void SetEndFrame ( int e ) { end = e; }
01144 BMMExport void SetCustomX ( int x ) { custxpos = x; }
01151 BMMExport void SetCustomY ( int y ) { custypos = y; }
01153 BMMExport int GetCustomX ( ) { return custxpos; }
01155 BMMExport int GetCustomY ( ) { return custypos; }
01161 BMMExport void SetCustomGamma ( float g ) { custgamma = g; }
01163 BMMExport float GetCustomGamma ( ) { return custgamma; }
01166 BMMExport float GetEffectiveGamma ( );
01172 BMMExport void SetCustomStep ( int s ) { step = s; }
01175 BMMExport int GetCustomStep ( ) { return step; }
01184 BMMExport void SetPresetAlignment ( int p ) { preset_al = p; }
01189 BMMExport int GetPresetAlignment ( ) { return preset_al; }
01190
01191
01192
01195 BMMExport DWORD GetCustomFlags ( ) { return (customflags); }
01200 BMMExport void SetCustomFlag ( DWORD f ) { customflags |= f; }
01205 BMMExport void ResetCustomFlag ( DWORD f ) { customflags &= ~f; }
01212 BMMExport BOOL TestCustomFlags ( DWORD f ) { return (customflags & f); }
01213
01214
01215
01216 BMMExport void* GetPiData ( ) { return pidata; }
01217 BMMExport void SetPiData ( void *ptr ) { pidata = ptr; }
01218 BMMExport DWORD GetPiDataSize ( ) { return pisize; }
01219 BMMExport void SetPiDataSize ( DWORD s ) { pisize = s; }
01220 BMMExport void ResetPiData ( );
01221 BMMExport BOOL AllocPiData ( DWORD size );
01222
01223
01224
01232
01233 BMMExport BitmapInfo* GetProxySubject ( BOOL create=FALSE );
01234 BMMExport void ResetProxySubject ( );
01235 BMMExport BOOL AllocProxySubject ( );
01236
01237
01238
01239
01260 BMMExport void* CreateFmtSpecBlock ( void );
01261
01263 BMMExport void Copy ( const BitmapInfo *from, BOOL copyProxySubject );
01264 BMMExport void Copy ( const BitmapInfo *from );
01270 BMMExport BitmapInfo &operator= ( const BitmapInfo &from );
01271
01272
01273
01274 BMMExport IOResult Save ( ISave *isave );
01275 BMMExport IOResult Load ( ILoad *iload );
01276
01277 BMMExport void EnumAuxFiles ( AssetEnumCallback& assetEnum, DWORD flags);
01278
01279
01280
01298 BMMExport BOOL Validate ( );
01301 BMMExport HWND GetUpdateWindow ( ) { return hWnd; }
01305 BMMExport void SetUpdateWindow ( HWND hwnd ) { hWnd = hwnd; }
01306 BMMExport DWORD GetGChannels ( );
01307 BMMExport DWORD GetDeviceFlags ( );
01308 BMMExport BOOL FixDeviceName ( );
01309
01310 };
01311
01312
01313
01314
01315
01316
01317
01318
01319
01360 #pragma warning(push)
01361 #pragma warning(disable:4100)
01362 class BitmapIO : public BaseInterfaceServer {
01363 private:
01364 UWORD* outputGammaTab;
01365 UWORD* privGammaTab;
01366
01367 protected:
01368 float gamma;
01369 Bitmap *map;
01370 BitmapStorage *storage;
01371
01372 int openMode;
01373
01374
01375
01376 BitmapIO *prevIO;
01377 BitmapIO *nextIO;
01378
01379 public:
01380
01381
01382
01401 BMMExport int GetOutputPixels ( int x,int y,int pixels,BMM_Color_64 *ptr, BOOL preMultAlpha=TRUE);
01402
01403
01404
01405 BMMExport int GetOutputPixels ( int x,int y,int pixels,BMM_Color_fl *ptr, BOOL preMultAlpha=TRUE);
01406
01407
01408
01428 BMMExport int GetDitheredOutputPixels ( int x,int y,int pixels,BMM_Color_32 *ptr, BOOL preMultAlpha=TRUE);
01429
01430
01431
01438 BMMExport PBITMAPINFO GetOutputDib ( int depth = 24 );
01439
01440
01441
01448 BMMExport PBITMAPINFO GetDitheredOutputDib ( int depth = 24 );
01449
01452 BMMExport float OutputGamma();
01453
01454
01455
01456
01463 BMMExport BOOL DitherTrueColor();
01468 BMMExport BOOL DitherPaletted();
01469
01470
01481 BMMExport int CalcOutputPalette(int palsize, BMM_Color_48 *pal);
01482
01483 BMMExport BitmapIO ( );
01484 BMMExport virtual ~BitmapIO ( );
01485
01486 BitmapInfo bi;
01487
01491 inline int OpenMode ( ) { return (openMode); }
01494 inline void SetPrev ( BitmapIO *prev) { prevIO = prev; };
01497 inline void SetNext ( BitmapIO *next) { nextIO = next; };
01500 inline BitmapIO *Prev ( ) { return prevIO; };
01503 inline BitmapIO *Next ( ) { return nextIO; };
01504
01507 BMMExport BitmapStorage *Storage ( );
01510 inline Bitmap *Map ( ) { return map; };
01511
01515 BMMExport virtual int ExtCount ( ) = 0;
01521 BMMExport virtual const MCHAR *Ext ( int n ) = 0;
01524 BMMExport virtual const MCHAR *LongDesc ( ) = 0;
01526 BMMExport virtual const MCHAR *ShortDesc ( ) = 0;
01528 BMMExport virtual const MCHAR *AuthorName ( ) = 0;
01530 BMMExport virtual const MCHAR *CopyrightMessage ( ) = 0;
01532 BMMExport virtual UINT Version ( ) = 0;
01533
01538 BMMExport virtual int Capability ( ) = 0;
01545 BMMExport virtual void ShowAbout ( HWND hWnd ) = 0;
01546
01547
01548
01549
01550
01551
01552
01565 BMMExport virtual BOOL ShowImage ( HWND hWnd, BitmapInfo *bi ) { return FALSE; }
01566
01567
01568
01569
01570
01571
01572
01573
01574
01575
01576
01577
01578
01579
01596 BMMExport virtual BOOL ShowControl ( HWND hWnd, DWORD flag ) { return FALSE; }
01597
01598
01599
01600
01601
01602
01603
01604
01605
01606
01607
01608
01609
01610
01611
01612
01617 BMMExport virtual DWORD EvaluateConfigure ( ) = 0;
01625 BMMExport virtual BOOL LoadConfigure ( void *ptr ) = 0;
01633 BMMExport virtual BOOL SaveConfigure ( void *ptr ) = 0;
01634
01635
01636
01637
01638
01641 BMMExport virtual void GetCfgFilename ( MCHAR *filename ) {}
01644 BMMExport virtual BOOL ReadCfg ( ) { return TRUE; }
01646 BMMExport virtual void WriteCfg ( ) {}
01647
01648
01649
01650
01651 BMMExport virtual BOOL ValidatePiData ( BitmapInfo *bi );
01652
01653
01654
01658 BMMExport BOOL SilentMode ( );
01659
01660
01661
01662
01663
01664
01665
01666
01667
01668
01669
01686 BMMExport BMMRES GetFrame ( BitmapInfo *fbi, int *frame);
01687
01688
01689
01716 BMMExport BMMRES ProcessImageIOError ( BitmapInfo *bi, MCHAR *string = NULL);
01765 BMMExport BMMRES ProcessImageIOError ( BitmapInfo *bi, int errorcode);
01766
01767
01768
01769
01770
01771
01772
01773
01774
01775
01776
01777
01778
01779
01780
01781
01782
01783
01793 BMMExport virtual DWORD ChannelsRequired ( ) { return BMM_CHAN_NONE; }
01794
01795
01796
01813 BMMExport virtual BMMRES GetImageInfoDlg ( HWND hWnd, BitmapInfo *bi, const MCHAR *filename = NULL ) {return BMMRES_NODRIVER;}
01837 BMMExport virtual BMMRES GetImageInfo ( BitmapInfo *bi ) = 0;
01838
01839
01840
01851 BMMExport virtual BMMRES GetImageName ( BitmapInfo *bi, MCHAR *filename) {filename[0]=0; return (BMMRES_SUCCESS);}
01852
01853
01854
01872 BMMExport virtual BitmapStorage *Load ( BitmapInfo *bi, Bitmap *map, BMMRES *status ) = 0;
01886 BMMExport virtual BMMRES OpenOutput ( BitmapInfo *bi, Bitmap *map );
01897 BMMExport virtual BMMRES Write ( int frame );
01907 BMMExport virtual int Close ( int flag );
01912 BMMExport virtual PAVIFILE GetPaviFile ( ) { return NULL; }
01913
01914
01915
01918 BMMExport void InitOutputGammaTable(BitmapInfo*bi);
01919
01920
01921
01961 BMMExport virtual void EvalMatch ( MCHAR *matchString ) { matchString[0] = 0; }
01962
01963
01964
01965
01966 };
01967
01968 #pragma warning(pop)
01969
01970
01971
01972
01973
01974
01975
01976
01977
01978 #define BMM_CHANNEL_RED 0 //-- Get/Put only Red
01979 #define BMM_CHANNEL_GREEN 1 //-- Get/Put only Green
01980 #define BMM_CHANNEL_BLUE 3 //-- Get/Put only Blue
01981 #define BMM_CHANNEL_ALPHA 4 //-- Get/Put only Alpha
01982 #define BMM_CHANNEL_Z 5 //-- Get/Put only Z
01983 #define BMM_CHANNEL_LUMINANCE 6 //-- Get (R+G+B)/3
01984
02003 class BitmapStorage : public BaseInterfaceServer {
02004
02005 friend class GcsBitmap;
02006
02007 protected:
02008
02009 int openMode;
02010 UINT usageCount;
02011 BitmapManager *manager;
02012
02013 int flags;
02014 int type;
02015
02016 BMM_Color_48 palette[256];
02017 int paletteSlots;
02018 UWORD *gammaTable;
02019
02020 RenderInfo *rendInfo;
02021 GBuffer *gbuffer;
02022 public:
02023
02024 BMMExport BitmapStorage ( );
02025 BMMExport virtual ~BitmapStorage ( );
02026
02027 BitmapInfo bi;
02028 MCHAR* evalString;
02029
02030
02036 BMMExport float SetGamma(float gam);
02039 inline int HasGamma ( ) { return (gammaTable!=NULL) ? 1:0; };
02045 BMMExport void SetHasGamma(BOOL onOff);
02046 void UpdateGammaTable();
02054 BMMExport UWORD *GetInputGammaTable();
02055
02058 inline BitmapManager *Manager ( ) { return manager; }
02062 inline int OpenMode ( ) { return openMode; }
02066 inline int Width ( ) { return bi.Width(); }
02070 inline int Height ( ) { return bi.Height(); }
02074 inline float Aspect ( ) { return bi.Aspect(); }
02078 inline float Gamma ( ) { return bi.Gamma(); }
02079
02083 inline int Paletted ( ) { return (flags & MAP_PALETTED) ? paletteSlots:0; }
02087 inline int IsDithered ( ) { return (flags & MAP_DITHERED) ? 1:0; };
02091 inline int PreMultipliedAlpha ( ) { return (flags & MAP_ALPHA_PREMULTIPLIED) ? 1:0; };
02095 inline int HasAlpha ( ) { return (flags & MAP_HAS_ALPHA) ? 1:0; };
02099 inline void UseScaleColors ( int on ) { flags &= ~MAP_USE_SCALE_COLORS; if (on) flags |= MAP_USE_SCALE_COLORS; };
02102 inline int ScaleColors ( ) { return (flags & MAP_USE_SCALE_COLORS) ? 1:0; };
02111 inline static void ClampColor (BMM_Color_64& out, const BMM_Color_fl& in) { out.r = in.clipColor(in.r); out.g = in.clipColor(in.g); out.b = in.clipColor(in.b); }
02119 inline static void ClampColorA (BMM_Color_64& out, const BMM_Color_fl& in) { ClampColor(out, in); out.a = in.clipColor(in.a); }
02128 BMMExport static void ScaleColor (BMM_Color_64& out, BMM_Color_fl in);
02136 inline static void ScaleColorA (BMM_Color_64& out, const BMM_Color_fl& in) { ScaleColor(out, in); out.a = in.clipColor(in.a); }
02145 inline void ClampScaleColor (BMM_Color_64& out, const BMM_Color_fl& in) { if (ScaleColors()) ScaleColor(out, in); else ClampColor(out, in); }
02154 inline void ClampScaleColorA (BMM_Color_64& out, const BMM_Color_fl& in) { if (ScaleColors()) ScaleColorA(out, in); else ClampColorA(out, in); }
02155
02158 inline int UsageCount ( ) { return usageCount; };
02161 inline int Type ( ) { return type; };
02164 inline int Flags ( ) { return flags; };
02170 inline void SetFlags ( DWORD f ) { flags |= f; }
02171 inline void ClearFlags ( DWORD f ) { flags &= (~f); }
02172
02176 BMMExport virtual int MaxRGBLevel ( ) = 0;
02179 BMMExport virtual int MaxAlphaLevel ( ) = 0;
02184 BMMExport virtual int IsHighDynamicRange ( ) = 0;
02185
02195 BMMExport virtual void *GetStoragePtr ( int *type ) { *type = BMM_NO_TYPE; return (NULL); }
02209 BMMExport virtual void *GetAlphaPtr ( int *type ) { *type = BMM_NO_TYPE; return (NULL); }
02210
02211
02212
02213 BMMExport virtual void Scale ( WORD *, int, WORD *, int );
02216 BMMExport virtual void Scale ( float *, int, float *, int );
02217 BMMExport virtual BOOL GetSRow ( WORD *, int, WORD *, int );
02220 BMMExport virtual BOOL GetSRow ( float *, int, float *, int );
02221 BMMExport virtual BOOL PutSRow ( WORD *, int, WORD *, int );
02224 BMMExport virtual BOOL PutSRow ( float *, int, float *, int );
02225 BMMExport virtual BOOL GetSCol ( WORD *, WORD *, int, int );
02228 BMMExport virtual BOOL GetSCol ( float *, float *, int, int );
02229 BMMExport virtual BOOL PutSCol ( WORD *, WORD *, int, int );
02232 BMMExport virtual BOOL PutSCol ( float *, float *, int, int );
02233 BMMExport virtual BOOL ScaleY ( Bitmap *, BMM_Color_64 *, WORD *, WORD *, HWND, int cw = 0, int ch = 0 );
02236 BMMExport virtual BOOL ScaleY ( Bitmap *, BMM_Color_fl *, float *, float *, HWND, int cw = 0, int ch = 0 );
02237 BMMExport virtual BOOL ScaleX ( Bitmap *, BMM_Color_64 *, WORD *, WORD *, HWND, int cw = 0, int ch = 0 );
02240 BMMExport virtual BOOL ScaleX ( Bitmap *, BMM_Color_fl *, float *, float *, HWND, int cw = 0, int ch = 0 );
02241 BMMExport virtual int StraightCopy ( Bitmap *from ) = 0;
02242
02243
02244
02258 BMMExport virtual int Get16Gray ( int x,int y,int pixels,WORD *ptr) = 0;
02273 BMMExport virtual int Put16Gray ( int x,int y,int pixels,WORD *ptr) = 0;
02287 BMMExport virtual int Get16Gray ( int x,int y,int pixels,float *ptr) = 0;
02302 BMMExport virtual int Put16Gray ( int x,int y,int pixels,float *ptr) = 0;
02317 BMMExport virtual int GetLinearPixels ( int x,int y,int pixels,BMM_Color_64 *ptr) = 0;
02333 BMMExport virtual int GetPixels ( int x,int y,int pixels,BMM_Color_64 *ptr) = 0;
02350 BMMExport virtual int PutPixels ( int x,int y,int pixels,BMM_Color_64 *ptr) = 0;
02365 BMMExport virtual int GetLinearPixels ( int x,int y,int pixels,BMM_Color_fl *ptr) = 0;
02380 BMMExport virtual int GetPixels ( int x,int y,int pixels,BMM_Color_fl *ptr) = 0;
02396 BMMExport virtual int PutPixels ( int x,int y,int pixels,BMM_Color_fl *ptr) = 0;
02411 BMMExport virtual int GetIndexPixels ( int x,int y,int pixels,unsigned char *ptr) = 0;
02425 BMMExport virtual int PutIndexPixels ( int x,int y,int pixels,unsigned char *ptr) = 0;
02426
02427 BMMExport virtual int Fill (const BMM_Color_fl& fillColor);
02428 BMMExport virtual int Fill (const BMM_Color_64& fillColor);
02429
02443 BMMExport virtual int CropImage ( int width,int height,BMM_Color_64 fillcolor) = 0;
02457 BMMExport virtual int CropImage ( int width,int height,BMM_Color_fl fillcolor) = 0;
02470 BMMExport virtual int CropImage ( int width,int height,int fillindex) = 0;
02472 BMMExport virtual int ResizeImage ( int width,int height,int newpalette) = 0;
02473
02482 BMMExport virtual int CopyCrop ( Bitmap *from, BMM_Color_64 fillcolor ) = 0;
02491 BMMExport virtual int CopyCrop ( Bitmap *from, BMM_Color_fl fillcolor ) = 0;
02503 BMMExport virtual int CopyScaleLow ( Bitmap *from ) = 0;
02511 BMMExport virtual int CopyScaleHigh ( Bitmap *from, HWND hWnd, BMM_Color_64 **buf = NULL, int w=0, int h=0 ) = 0;
02519 BMMExport virtual int CopyScaleHigh ( Bitmap *from, HWND hWnd, BMM_Color_fl **buf = NULL, int w=0, int h=0 ) = 0;
02520
02547 BMMExport virtual int CopyImage ( Bitmap *from,int operation,BMM_Color_64 fillcolor, BitmapInfo *bi = NULL) = 0;
02574 BMMExport virtual int CopyImage ( Bitmap *from,int operation,BMM_Color_fl fillcolor, BitmapInfo *bi = NULL) = 0;
02594 BMMExport virtual int CopyImage ( Bitmap *from,int operation,int fillindex) = 0;
02605 BMMExport virtual int GetPalette ( int start,int count,BMM_Color_48 *ptr) = 0;
02618 BMMExport virtual int SetPalette ( int start,int count,BMM_Color_48 *ptr) = 0;
02631 BMMExport virtual int GetFiltered ( float u,float v,float du,float dv,BMM_Color_64 *ptr) = 0;
02644 BMMExport virtual int GetFiltered ( float u,float v,float du,float dv,BMM_Color_fl *ptr) = 0;
02645
02646
02647
02659 BMMExport virtual int Allocate ( BitmapInfo *bi,BitmapManager *manager,int openMode) = 0;
02660 BMMExport virtual int Connect ( ) = 0;
02661 BMMExport virtual int Disconnect ( ) = 0;
02662 BMMExport virtual int MapReady ( ) = 0;
02663 BMMExport virtual int ClosestColor ( BMM_Color_48 color);
02664 BMMExport virtual int ClosestColor ( int r,int g,int b);
02665
02666
02667
02693 BMMExport virtual void* GetChannel(ULONG channelID, ULONG& chanType) { return gbuffer?gbuffer->GetChannel(channelID, chanType):NULL;}
02694
02697 GBuffer *GetGBuffer() { return gbuffer; }
02698
02699
02707 BMMExport virtual ULONG CreateChannels(ULONG channelIDs);
02708
02709
02714 BMMExport virtual void DeleteChannels(ULONG channelIDs) { if (gbuffer) gbuffer->DeleteChannels(channelIDs); }
02715
02716
02720 BMMExport virtual ULONG ChannelsPresent() { return gbuffer?gbuffer->ChannelsPresent():0; }
02721
02722
02723
02724
02725
02731 BMMExport RenderInfo* AllocRenderInfo();
02732
02735 BMMExport RenderInfo* GetRenderInfo();
02736
02737 };
02738
02739
02740
02741
02742
02743
02744
02745
02754 class BitmapStorageLDR : public BitmapStorage {
02755 public:
02756
02757 using BitmapStorage::Get16Gray;
02758 using BitmapStorage::Put16Gray;
02759 using BitmapStorage::GetLinearPixels;
02760 using BitmapStorage::GetPixels;
02761 using BitmapStorage::PutPixels;
02762
02763 using BitmapStorage::CropImage;
02764 using BitmapStorage::ResizeImage;
02765
02766 using BitmapStorage::CopyCrop;
02767 using BitmapStorage::CopyScaleLow;
02768
02769 using BitmapStorage::CopyImage;
02770 using BitmapStorage::GetFiltered;
02771
02777 BMMExport virtual int IsHighDynamicRange ( ) { return 0; }
02778
02779
02780
02786 BMMExport virtual int StraightCopy ( Bitmap *from );
02787
02788
02789
02803 BMMExport virtual int Get16Gray ( int x,int y,int pixels,float *ptr);
02818 BMMExport virtual int Put16Gray ( int x,int y,int pixels,float *ptr);
02833 BMMExport virtual int GetLinearPixels ( int x,int y,int pixels,BMM_Color_fl *ptr);
02848 BMMExport virtual int GetPixels ( int x,int y,int pixels,BMM_Color_fl *ptr);
02864 BMMExport virtual int PutPixels ( int x,int y,int pixels,BMM_Color_fl *ptr);
02879 BMMExport virtual int GetIndexPixels ( int x,int y,int pixels,unsigned char *ptr) = 0;
02893 BMMExport virtual int PutIndexPixels ( int x,int y,int pixels,unsigned char *ptr) = 0;
02894
02907 BMMExport virtual int CropImage ( int width,int height,BMM_Color_fl fillcolor);
02908
02917 BMMExport virtual int CopyCrop ( Bitmap *from, BMM_Color_64 fillcolor );
02926 BMMExport virtual int CopyCrop ( Bitmap *from, BMM_Color_fl fillcolor );
02938 BMMExport virtual int CopyScaleLow ( Bitmap *from );
02946 BMMExport virtual int CopyScaleHigh ( Bitmap *from, HWND hWnd, BMM_Color_64 **buf = NULL, int w=0, int h=0 );
02954 BMMExport virtual int CopyScaleHigh ( Bitmap *from, HWND hWnd, BMM_Color_fl **buf = NULL, int w=0, int h=0 );
02955
02981 BMMExport virtual int CopyImage ( Bitmap *from,int operation,BMM_Color_64 fillcolor, BitmapInfo *bi = NULL);
03007 BMMExport virtual int CopyImage ( Bitmap *from,int operation,BMM_Color_fl fillcolor, BitmapInfo *bi = NULL);
03027 BMMExport virtual int CopyImage ( Bitmap *from,int operation,int fillindex);
03039 BMMExport virtual int GetFiltered ( float u,float v,float du,float dv,BMM_Color_fl *ptr);
03040
03041 };
03042
03043
03044
03045
03046
03047
03048
03049
03056 class BitmapStorageHDR : public BitmapStorage {
03057 public:
03058
03059 using BitmapStorage::Get16Gray;
03060 using BitmapStorage::Put16Gray;
03061 using BitmapStorage::GetLinearPixels;
03062 using BitmapStorage::GetPixels;
03063 using BitmapStorage::PutPixels;
03064
03065 using BitmapStorage::CropImage;
03066 using BitmapStorage::ResizeImage;
03067
03068 using BitmapStorage::CopyCrop;
03069 using BitmapStorage::CopyScaleLow;
03070 using BitmapStorage::CopyScaleHigh;
03071
03072 using BitmapStorage::CopyImage;
03073 using BitmapStorage::GetFiltered;
03074
03080 BMMExport virtual int IsHighDynamicRange ( ) { return 1; }
03081
03082
03083
03089 BMMExport virtual int StraightCopy ( Bitmap *from );
03090
03091
03092
03106 BMMExport virtual int Get16Gray ( int x,int y,int pixels,WORD *ptr);
03121 BMMExport virtual int Put16Gray ( int x,int y,int pixels,WORD *ptr);
03136 BMMExport virtual int GetLinearPixels ( int x,int y,int pixels,BMM_Color_64 *ptr);
03147 BMMExport virtual int GetPixels ( int x,int y,int pixels,BMM_Color_64 *ptr);
03163 BMMExport virtual int PutPixels ( int x,int y,int pixels,BMM_Color_64 *ptr);
03164
03177 BMMExport virtual int CropImage ( int width,int height,BMM_Color_64 fillcolor);
03190 BMMExport virtual int CropImage ( int width,int height,int fillindex);
03191
03200 BMMExport virtual int CopyCrop ( Bitmap *from, BMM_Color_64 fillcolor );
03209 BMMExport virtual int CopyCrop ( Bitmap *from, BMM_Color_fl fillcolor );
03221 BMMExport virtual int CopyScaleLow ( Bitmap *from );
03229 BMMExport virtual int CopyScaleHigh ( Bitmap *from, HWND hWnd, BMM_Color_64 **buf = NULL, int w=0, int h=0 );
03237 BMMExport virtual int CopyScaleHigh ( Bitmap *from, HWND hWnd, BMM_Color_fl **buf = NULL, int w=0, int h=0 );
03238
03264 BMMExport virtual int CopyImage ( Bitmap *from,int operation,BMM_Color_64 fillcolor, BitmapInfo *bi = NULL);
03289 BMMExport virtual int CopyImage ( Bitmap *from,int operation,BMM_Color_fl fillcolor, BitmapInfo *bi = NULL);
03309 BMMExport virtual int CopyImage ( Bitmap *from,int operation,int fillindex);
03322 BMMExport virtual int GetFiltered ( float u,float v,float du,float dv,BMM_Color_64 *ptr);
03323
03324 };
03325
03326
03327
03328
03329
03330
03331
03332 class BitmapFilter: public MaxHeapOperators {
03333
03334 protected:
03335
03336 UINT usageCount;
03337 BitmapManager *manager;
03338 BitmapStorage *storage;
03339 DWORD flags;
03340 int dirty;
03341 UINT type;
03342
03343 public:
03344
03345 BMMExport BitmapFilter();
03346 BMMExport virtual ~BitmapFilter();
03347
03348 inline DWORD Flags ( ) { return flags; };
03349 inline void SetFlag ( DWORD flag) { flags |= flag; dirty = 1; };
03350 inline void ToggleFlag ( DWORD flag) { flags ^= flag; dirty = 1; };
03351 inline void ClearFlag ( DWORD flag) { flags &= (~flag); dirty = 1; };
03352 inline UINT Type ( ) { return type; };
03353 inline void SetType ( UINT t) { type = t; };
03354 BMMExport int Initialize ( BitmapManager *m,BitmapStorage *s);
03355
03356 virtual int GetFiltered ( float u,float v,float du,float dv,BMM_Color_64 *ptr) = 0;
03357 virtual int GetFiltered ( float u,float v,float du,float dv,BMM_Color_fl *ptr) = 0;
03358 virtual void Free ( ) {};
03359
03360 BMMExport int Connect ( );
03361 BMMExport int Disconnect ( );
03362 BMMExport int SetStorage ( BitmapStorage *storage);
03363 inline BitmapStorage *GetStorage ( ) { return storage; };
03364 inline void MakeDirty ( ) { dirty = 1; };
03365
03366 };
03367
03368
03369
03370
03371
03372
03373 class BitmapDither: public MaxHeapOperators {
03374
03375 protected:
03376
03377 BitmapStorage *storage;
03378 int type;
03379
03380 public:
03381
03382 BMMExport BitmapDither ( );
03383 BMMExport virtual ~BitmapDither ( );
03384 inline UINT Type ( ) { return type; };
03385 inline void SetType ( UINT t) { type = t; };
03386 BMMExport int Initialize ( BitmapStorage *s);
03387 virtual int PutPixels ( int x,int y,int pixels,BMM_Color_64 *ptr) = 0;
03388 virtual int PutPixels ( int x,int y,int pixels,BMM_Color_fl *ptr) = 0;
03389 virtual void Free ( ) {};
03390 BMMExport int SetStorage ( BitmapStorage *storage);
03391
03392 };
03393
03394
03395
03396
03397
03398
03399
03400
03401
03402
03403
03404
03405
03406
03407 #define BMNOTIFY_FLAG_STORAGE_CHANGE 0
03408
03409
03410
03411
03412 #define BMNOTIFY_FLAG_FILE_CHANGE 1
03413
03421 class BitmapNotify: public MaxHeapOperators{
03422 public:
03423
03424
03437 virtual int Changed(ULONG flags)=0;
03441 virtual void VFBClosed() {}
03442 };
03443
03444
03445
03446
03454 class CropCallback: public MaxHeapOperators {
03455 public:
03457 virtual float GetInitU()=0;
03459 virtual float GetInitV()=0;
03461 virtual float GetInitW()=0;
03463 virtual float GetInitH()=0;
03467 virtual BOOL GetInitMode()=0;
03482 virtual void SetValues(float u, float v, float w, float h, BOOL md)=0;
03485 virtual void OnClose()=0;
03486 };
03487
03488
03489
03490
03491
03492
03493 #define BMM_SINGLEFRAME -2000000L
03494
03521 class Bitmap : public BaseInterfaceServer
03522 {
03523 friend class BitmapManagerImp;
03524
03525 private:
03526
03527 DWORD flags;
03528
03529 BitmapManager *manager;
03530 BitmapIO *output;
03531 BitmapFilter *filter;
03532 BitmapDither *dither;
03533 BitmapStorage *storage;
03534 UINT filterType;
03535 UINT ditherType;
03536 DWORD modifyID;
03537 int Free();
03538
03539 void *vfbData;
03540
03541 BitmapNotify *bmNotify;
03542
03543 friend LRESULT CALLBACK InputWndProc ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
03544
03545
03546 BMMExport ~Bitmap ( );
03547
03548
03549 BMMExport Bitmap ( BitmapManager *manager = TheManager );
03550
03551 public:
03552
03554 inline BitmapManager *Manager ( ) { return manager; };
03555
03556
03557
03558 BMMExport int Create ( BitmapInfo *bi );
03559 BMMExport BOOL FixDeviceName ( BitmapInfo *bi );
03560 inline int MapReady ( ) { if (storage) return storage->MapReady(); return 0; };
03561 BMMExport void AddOutput ( BitmapIO *out );
03562 BMMExport void RemoveOutput ( BitmapIO *out, BOOL deleteOutput=TRUE );
03563 BMMExport BitmapIO * FindOutput ( BitmapInfo *bi );
03564 BMMExport PAVIFILE GetPaviFile ( BitmapInfo *bi );
03565
03566
03567 inline void *GetVFBData ( ) { return vfbData; }
03568 inline void SetVFBData (void *vfb ) { vfbData = vfb; }
03569
03570
03571
03572
03577 BMMExport void DeleteThis ( );
03581 inline DWORD Flags ( ) { return flags; };
03586 inline void SetFlag ( DWORD flag ) { flags |= flag; };
03591 inline void ToggleFlag ( DWORD flag ) { flags ^= flag; };
03596 inline void ClearFlag ( DWORD flag ) { flags &= (~flag); };
03597
03601 inline int Width ( ) { if (storage) return storage->Width(); return 0; };
03605 inline int Height ( ) { if (storage) return storage->Height(); return 0; };
03609 inline float Aspect ( ) { if (storage) return storage->Aspect(); return (float)0.0; };
03613 inline float Gamma ( ) { if (storage) return storage->Gamma(); return (float)0.0; };
03618 inline int Paletted ( ) { if (storage) return storage->Paletted(); return 0; };
03622 inline int IsDithered ( ) { if (storage) return storage->IsDithered(); return 0; };
03626 inline int PreMultipliedAlpha ( ) { if (storage) return storage->PreMultipliedAlpha(); return 0; };
03630 inline int HasAlpha ( ) { if (storage) return storage->HasAlpha(); return 0; };
03633 inline int IsHighDynamicRange ( ) { if (storage) return storage->IsHighDynamicRange(); return 0; };
03637 inline int MaxRGBLevel ( ) { if (storage) return storage->MaxRGBLevel(); return 0; };
03641 inline int MaxAlphaLevel ( ) { if (storage) return storage->MaxAlphaLevel(); return 0; };
03646 inline void UseScaleColors ( int on ) { if (storage) storage->UseScaleColors(on); };
03650 inline int ScaleColors ( ) { if (storage) return storage->ScaleColors(); return 0; };
03659 inline static void ClampColor (BMM_Color_64& out, const BMM_Color_fl& in) { BitmapStorage::ClampColor(out, in); }
03667 inline static void ClampColorA (BMM_Color_64& out, const BMM_Color_fl& in) { BitmapStorage::ClampColorA(out, in); }
03668
03677 inline static void ScaleColor (BMM_Color_64& out, const BMM_Color_fl& in) { BitmapStorage::ScaleColor(out, in);}
03685 inline static void ScaleColorA (BMM_Color_64& out, const BMM_Color_fl& in) { BitmapStorage::ScaleColorA(out, in);}
03695 inline void ClampScaleColor (BMM_Color_64& out, const BMM_Color_fl& in) { if (storage) storage->ClampScaleColor(out, in); else ClampColor(out, in); }
03705 inline void ClampScaleColorA (BMM_Color_64& out, const BMM_Color_fl& in) { if (storage) storage->ClampScaleColorA(out, in); else ClampColorA(out, in); }
03706
03707 int Put16Gray ( int x,int y,int pixels,WORD *ptr )
03708 { if (storage) return storage->Put16Gray(x,y,pixels,ptr); return 0; };
03724 int Put16Gray ( int x,int y,int pixels,float *ptr )
03725 { if (storage) return storage->Put16Gray(x,y,pixels,ptr); return 0; };
03726 inline void *GetStoragePtr ( int *type )
03727 { if (storage) return storage->GetStoragePtr(type); return NULL; };
03728 inline void *GetAlphaPtr ( int *type )
03729 { if (storage) return storage->GetAlphaPtr(type); return NULL; };
03730 inline int Get16Gray ( int x,int y,int pixels,WORD *ptr )
03731 { if (storage) return storage->Get16Gray(x,y,pixels,ptr); return 0; };
03746 inline int Get16Gray ( int x,int y,int pixels,float *ptr )
03747 { if (storage) return storage->Get16Gray(x,y,pixels,ptr); return 0; };
03748 inline int GetPixels ( int x,int y,int pixels,BMM_Color_64 *ptr )
03749 { if (storage) return storage->GetPixels(x,y,pixels,ptr); return 0; };
03765 inline int GetPixels ( int x,int y,int pixels,BMM_Color_fl *ptr )
03766 { if (storage) return storage->GetPixels(x,y,pixels,ptr); return 0; };
03767 BMMExport int PutPixels ( int x,int y,int pixels,BMM_Color_64 *ptr );
03784 BMMExport int PutPixels ( int x,int y,int pixels,BMM_Color_fl *ptr );
03801 inline int GetLinearPixels ( int x,int y,int pixels,BMM_Color_64 *ptr )
03802 { if (storage) return storage->GetLinearPixels(x,y,pixels,ptr); return 0; };
03803 inline int GetLinearPixels ( int x,int y,int pixels,BMM_Color_fl *ptr )
03804 { if (storage) return storage->GetLinearPixels(x,y,pixels,ptr); return 0; };
03819 inline int GetIndexPixels ( int x,int y,int pixels,BYTE *ptr )
03820 { if (storage) return storage->GetIndexPixels(x,y,pixels,ptr); return 0; };
03837 inline int PutIndexPixels ( int x,int y,int pixels,BYTE *ptr )
03838 { if (storage) return storage->PutIndexPixels(x,y,pixels,ptr); return 0; };
03839 inline int CropImage ( int width,int height,BMM_Color_64 fillcolor)
03840 { if (storage) return storage->CropImage(width,height,fillcolor); return 0; };
03841 inline int CropImage ( int width,int height,BMM_Color_fl fillcolor)
03842 { if (storage) return storage->CropImage(width,height,fillcolor); return 0; };
03843 inline int CropImage ( int width,int height,int fillindex)
03844 { if (storage) return storage->CropImage(width,height,fillindex); return 0; };
03846 inline int ResizeImage ( int width,int height,int newpalette)
03847 { if (storage) return storage->ResizeImage(width,height,newpalette);return 0; };
03848 inline int CopyImage ( Bitmap *from,int operation,BMM_Color_64 fillcolor, BitmapInfo *bi = NULL)
03849 { if (storage) return storage->CopyImage(from,operation,fillcolor,bi); return 0; };
03875 inline int CopyImage ( Bitmap *from,int operation,BMM_Color_fl fillcolor, BitmapInfo *bi = NULL)
03876 { if (storage) return storage->CopyImage(from,operation,fillcolor,bi); return 0; };
03888 inline int CopyImage ( Bitmap *from,int operation,int fillindex)
03889 { if (storage) return storage->CopyImage(from,operation,fillindex); return 0; };
03901 inline int GetPalette ( int start,int count,BMM_Color_48 *ptr)
03902 { if (storage) return storage->GetPalette(start,count,ptr); return 0; };
03913 inline int SetPalette ( int start,int count,BMM_Color_48 *ptr)
03914 { if (storage) return storage->SetPalette(start,count,ptr); return 0; };
03915
03916
03917
03918
03919
03920 BMMExport void FilmGrain ( float grain, BOOL mask, PBITMAP_FX_CALLBACK callback = NULL, void *param = NULL );
03921
03922
03923
03924
03925
03947 inline void *GetChannel ( ULONG channelID, ULONG& chanType )
03948 { if (storage) return storage->GetChannel(channelID, chanType); return NULL; }
03949
03951 inline GBuffer *GetGBuffer() { return storage? storage->GetGBuffer(): NULL; }
03952
03959 inline ULONG CreateChannels ( ULONG channelIDs )
03960 { if (storage) return storage->CreateChannels(channelIDs); return 0; }
03966 inline void DeleteChannels ( ULONG channelIDs )
03967 { if (storage) storage->DeleteChannels(channelIDs); }
03970 inline ULONG ChannelsPresent ( )
03971 { if (storage) return storage->ChannelsPresent(); return 0; }
03975 inline RenderInfo* GetRenderInfo() { if (storage) return storage->GetRenderInfo(); return NULL; }
03976
03980 inline RenderInfo* AllocRenderInfo() { if (storage) return storage->AllocRenderInfo(); return NULL; }
03981
03982
03983
03984
03985
03986
03987
03988
03989
03990
03991
03992
04003 BMMExport BOOL PrepareGChannels ( BitmapInfo *bi );
04004 BMMExport BOOL PrepareGChannels ( DWORD channels );
04005
04006
04007 BMMExport int GetFiltered ( float u,float v,float du,float dv,BMM_Color_64 *ptr );
04033 BMMExport int GetFiltered ( float u,float v,float du,float dv,BMM_Color_fl *ptr );
04043 BMMExport int SetDither ( UINT ditherType );
04049 BMMExport int SetFilter ( UINT filterType );
04052 inline int HasFilter ( ) { return (filter) ? 1:0; };
04055 inline BitmapFilter *Filter ( ) { return filter; };
04061 BMMExport int SetStorage ( BitmapStorage *storage);
04064 inline BitmapStorage *Storage ( ) { return storage; };
04066 inline void NullStorage ( ) { storage = NULL; };
04067
04068
04069
04070
04071
04072
04103 BMMExport PBITMAPINFO ToDib ( int depth = 24, UWORD *gam=NULL, BOOL dither=FALSE, BOOL displayGamma=FALSE );
04104
04105
04106
04114 BMMExport BOOL FromDib ( PBITMAPINFO pbmi );
04115
04116
04117
04118
04119
04120
04121
04122
04123
04124
04125
04126
04127
04128
04129
04130
04131
04132
04133
04134
04135
04136
04137
04138
04139
04140
04141
04142
04143
04144
04145
04146
04147
04148
04149
04150
04151
04152
04153
04154
04155
04156
04157
04158
04159
04160
04161
04162
04163
04164
04165
04166
04167
04168
04169
04170
04171
04172
04173
04174
04175
04176
04177
04178
04179
04180
04181
04182
04183
04184
04185
04186
04187
04188
04189
04190
04208 BMMExport BMMRES OpenOutput ( BitmapInfo *bi );
04231 BMMExport BMMRES Write ( BitmapInfo *bi, int frame = BMM_SINGLEFRAME );
04243 BMMExport BMMRES WriteAll ( int frame = BMM_SINGLEFRAME );
04253 BMMExport int Close ( BitmapInfo *bi, int flag = BMM_CLOSE_COMPLETE );
04260 BMMExport int CloseAll ( int flag = BMM_CLOSE_COMPLETE);
04261
04262
04263
04264 #define BMM_UL 1 //-- Upper Left
04265 #define BMM_LL 2 //-- Lower Left
04266 #define BMM_UR 3 //-- Upper Right
04267 #define BMM_LR 4 //-- Upper Left
04268 #define BMM_CN 5 //-- Center
04269
04270 #define BMM_RND 10 //-- Renderer (Save/Restore)
04271 #define BMM_VPP 11 //-- Video Post Primary (Save/Restore)
04272 #define BMM_VPS 12 //-- Video Post Secondary (Save/Restore)
04273
04304 BMMExport int Display ( MCHAR *title = NULL, int position = BMM_CN,
04305 BOOL autonomous = FALSE, BOOL savebutton = TRUE, CropCallback *crop=NULL, Bitmap *cloneMyVFB = NULL );
04309 BMMExport int UnDisplay ( );
04313 BMMExport HWND GetWindow ( );
04322 BMMExport void RefreshWindow ( RECT *rect = NULL );
04327 BMMExport void SetWindowTitle ( MCHAR *title );
04342 BMMExport void SetCroppingValues ( float u, float v, float w, float h, BOOL placeImage);
04343
04344
04345
04346
04347
04348
04349
04350
04351
04352
04353
04354
04355
04356
04357
04369 BMMExport BMMRES GoTo ( BitmapInfo *bi );
04370
04371
04372
04385 BMMExport int Fill ( int r,int g,int b,int alpha);
04390 BMMExport int Fill (const BMM_Color_fl& fillColor);
04394 BMMExport int Fill (const BMM_Color_64& fillColor);
04395
04396
04404 BMMExport void SetNotify( BitmapNotify *bmnot=NULL);
04409 BitmapNotify * GetNotify() { return bmNotify; }
04410
04416 BMMExport BOOL IsAutonomousVFB();
04417
04418
04434 BMMExport INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0);
04435
04436 DWORD GetModifyID() { return modifyID; }
04437 void SetModifyID(DWORD m) { modifyID = m; }
04438 BMMExport void IncrModifyID();
04439
04440
04442 BMMExport void Print(bool silent = false);
04443
04454 BMMExport void ShowProgressLine(int y);
04455 };
04456
04457
04458
04459 struct BMMStorageList: public MaxHeapOperators {
04460 BitmapStorage *ptr;
04461 BMMStorageList *next;
04462 };
04463
04464 struct BMMFilterList: public MaxHeapOperators {
04465 BitmapFilter *ptr;
04466 BMMFilterList *next;
04467 } ;
04468
04469 struct BMMBitmapList: public MaxHeapOperators {
04470 Bitmap *ptr;
04471 BMMBitmapList *next;
04472 };
04473
04474 struct BMMGammaSettings: public MaxHeapOperators {
04475 BitmapManager *mgr;
04476 BitmapInfo *bi;
04477 BOOL out;
04478 };
04479
04480 struct BMMVfbPalette: public MaxHeapOperators {
04481 BYTE r,g,b;
04482 };
04483
04484 class BitmapFileInputDialog: public MaxHeapOperators {
04485 public:
04486 virtual BOOL BrowseBitmapFilesInput(BitmapInfo* info, HWND hWnd, MCHAR* title, BOOL view) = 0;
04487 };
04488
04489 class BitmapFileOutputDialog: public MaxHeapOperators {
04490 public:
04491 virtual BOOL BrowseBitmapFilesOutput(BitmapInfo* info, HWND hWnd, MCHAR* title) = 0;
04492 };
04493
04494
04495
04496
04497
04519 #pragma warning(push)
04520 #pragma warning(disable:4100)
04521 class BitmapManager : public InterfaceServer{
04522
04523 public:
04524
04525 BMMVfbPalette *pal;
04526
04527
04528
04529 BitmapManager ( BMMInterface *i) { pal = NULL; }
04530 BitmapManager ( BMMInterface *i,const MCHAR *name) { pal = NULL; }
04531 BMMExport virtual ~BitmapManager ( );
04532 friend void DoConstruct ( BitmapManager *m, BMMInterface *i, const MCHAR *name);
04533
04534
04535
04536 virtual int DeleteAllMaps ( )=0;
04537 virtual int AddStorage ( BitmapStorage *s)=0;
04538 virtual int AddFilter ( BitmapFilter *a)=0;
04539 virtual int AddBitmap ( Bitmap *b)=0;
04540 virtual int DelStorage ( BitmapStorage *s)=0;
04541 virtual int DelFilter ( BitmapFilter *a)=0;
04542 virtual int DelBitmap ( Bitmap *b)=0;
04543 virtual BitmapFilter *FindFilter ( BitmapStorage *s,UINT type)=0;
04544 virtual BitmapStorage *FindStorage ( BitmapInfo *bi, int openMode)=0;
04545 virtual int FnametoBitMapInfo ( BitmapInfo *bi )=0;
04546 virtual void FixFileExt ( OPENFILENAME &ofn, const MCHAR *extension)=0;
04547 virtual void MakeVfbPalette ( )=0;
04548
04549 BMM_IOList ioList;
04550 virtual void ListIO ( )=0;
04551
04552
04553
04554
04555
04556
04559 virtual HINSTANCE AppInst ( )=0;
04561 virtual HWND AppWnd ( )=0;
04562 virtual DllDir *AppDllDir ( )=0;
04570 virtual const MCHAR *GetDir (int i)=0;
04573 virtual BOOL AddMapDir (const MCHAR *dir,int update)=0;
04577 virtual int GetMapDirCount ( )=0;
04584 virtual const MCHAR *GetMapDir (int i)=0;
04588 virtual Interface *Max ()=0;
04591 virtual Bitmap *NewBitmap ()=0;
04592
04593
04594 virtual void SetFileInputDialog(BitmapFileInputDialog* dlg = NULL)=0;
04595 virtual void SetFileOutputDialog(BitmapFileOutputDialog* dlg = NULL)=0;
04596
04597
04598
04599
04600
04601
04602
04603
04604
04605
04606
04607
04608
04609
04610
04611
04612
04613
04614
04615
04616 virtual int Status ( int *sCount, int *aCount, int *bCount)=0;
04617 virtual int Error ( const MCHAR *string)=0;
04618
04619
04620
04621
04622
04623
04624
04625 #define LG_NOLOG 0
04626
04627
04628
04629 #define LG_FATAL ((DWORD)(1 << 0))
04630 #define LG_INFO ((DWORD)(1 << 1))
04631 #define LG_DEBUG ((DWORD)(1 << 2))
04632 #define LG_WARN ((DWORD)(1 << 3))
04633
04634
04635
04641 virtual BOOL SilentMode ( )=0;
04643 virtual void SysLog ( int type, char *format, ... )=0;
04644
04645
04646
04648 virtual BOOL SetSilentMode ( BOOL s )=0;
04650 virtual void SetLogLevel ( DWORD level )=0;
04652 virtual DWORD GetLogLevel ( )=0;
04653
04654
04655
04656
04657
04658
04659
04660
04661
04662
04663
04664
04665
04666
04667
04668
04669
04670
04671
04672
04673
04674
04675
04676
04677
04678
04679
04680
04681
04682
04683
04694 BMMExport virtual Bitmap *Create ( BitmapInfo *bi )=0;
04695
04696
04697
04698
04699
04700
04713 BMMExport virtual Bitmap *Create ( PBITMAPINFO pbmi )=0;
04714
04715
04716
04717
04718
04719
04720
04721
04722
04723
04724
04725
04726
04727
04728
04729
04730
04731
04732
04733
04734
04735
04736
04737
04738
04739
04740
04741
04742
04743
04744
04745
04746
04747
04748
04749
04750
04771 BMMExport virtual Bitmap *Load ( BitmapInfo *bi, BMMRES *status = NULL)=0;
04772
04773
04774
04796 virtual BMMRES LoadInto ( BitmapInfo *bi, Bitmap **map, BOOL forceReload=FALSE )=0;
04797
04798
04799
04820 virtual BMMRES GetImageInfoDlg ( HWND hWnd, BitmapInfo *bi, const MCHAR *filename = NULL )=0;
04835 virtual BMMRES GetImageInfo ( BitmapInfo *bi, const MCHAR *filename = NULL )=0;
04850 virtual BOOL ImageInputOptions ( BitmapInfo *bi, HWND hWnd )=0;
04861 virtual BOOL SelectDeviceInput ( BitmapInfo *bi, HWND hWnd )=0;
04872 virtual BOOL SelectDeviceOutput ( BitmapInfo *bi, HWND hWnd )=0;
04873
04874
04875 #define BMM_ENABLE_SAVE_REGION 1
04876
04877 #define BMM_DO_SAVE_REGION 2
04878
04902 virtual BOOL SelectFileOutput ( BitmapInfo *bi,
04903 HWND hWnd,
04904 MCHAR *title = NULL,
04905 ULONG *pflags = NULL)=0;
04906
04919 virtual BOOL SelectFileInput ( BitmapInfo *bi,
04920 HWND hWnd,
04921 MCHAR *title = NULL)=0;
04922
04939 virtual BOOL SelectFileInputEx ( BitmapInfo *bi,
04940 HWND hWnd,
04941 MCHAR *title = NULL,
04942 BOOL viewonly = FALSE)=0;
04943
04946 virtual void RefreshAllVFBs()=0;
04947
04950 virtual void DeleteAllAutonomousVFBMaps()=0;
04951
04952
04953 #define BMM_STORE_GEOREF_DATA 0 // Used in VIZ only; arg1: const MCHAR*; arg2: GeoTableItem*; arg3: not used
04954 #define BMM_RETRIEVE_GEOREF_DATA 1 // Used in VIZ only; arg1: const MCHAR*; arg2: GeoTableItem**; arg3: not used
04955 #define BMM_USE_CUSTOM_FILTERLIST 2 // Used to pass a Filter list to the BitmapManager; arg1 MCHAR *, arg2,arg3 not used
04956 #define BMM_SET_FILE_INPUT_SEQUENCE_FLAG 3 // Used to set the sequence flag for file input
04957 #define BMM_GET_FILE_INPUT_SEQUENCE_FLAG 4 // Used to get the sequence flag for file input
04958 #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
04959
04960
04976 virtual INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0)=0;
04977
04982 virtual void BeginSavingLoadErrorFiles()=0;
04983
04987 virtual NameTab &GetLoadErrorFileList()=0;
04990 virtual void EndSavingLoadErrorFiles()=0;
04997 virtual BMMExport bool CanImport(const MCHAR* filename)=0;
04998
05000 inline void ClearInternalRelativePathResolutionCache() { Execute(BMM_FLUSH_RELATIVE_FILE_RESOLUTION_CACHE); }
05001
05002 };
05003
05004 #pragma warning(pop)
05005
05006
05007
05009 #define FPBITMAPPROXYMANAGER_INTERFACE_ID Interface_ID(0x24e22528, 0x601f3610)
05010
05012 class IBitmapProxyManager : public FPStaticInterface {
05013 public:
05014 virtual BOOL GetGlobalProxyEnable() = 0;
05015 virtual void SetGlobalProxyEnable( BOOL enable ) = 0;
05016
05019 enum RenderMode {
05021 kRenderMode_UseProxies,
05025 kRenderMode_UseFullRes_KeepInMemory,
05029 kRenderMode_UseFullRes_FlushFromMemory
05030 };
05032
05033 virtual RenderMode GetGlobalProxyRenderMode() = 0;
05037 virtual void SetGlobalProxyRenderMode( RenderMode renderMode ) = 0;
05038
05041 enum {
05042 proxySizeFactor_Full=1,
05043 proxySizeFactor_Half=2,
05044 proxySizeFactor_Third=3,
05045 proxySizeFactor_Quarter=4,
05046 proxySizeFactor_Eighth=8,
05047 };
05049 virtual int GetGlobalProxySizeFactor() = 0;
05050 virtual void SetGlobalProxySizeFactor( int factor ) = 0;
05051 virtual int GetGlobalProxySizeMin() = 0;
05052 virtual void SetGlobalProxySizeMin( int min ) = 0;
05053
05054 virtual int GetProxySizeFactor(const MCHAR* filename) = 0;
05055 virtual void SetProxySizeFactor(const MCHAR* filename, int factor) = 0;
05056 virtual BOOL GetProxyUseGlobal(const MCHAR* filename) = 0;
05057 virtual void SetProxyUseGlobal(const MCHAR* filename, BOOL global) =0 ;
05058 virtual BOOL GetProxyReady(const MCHAR* filename) = 0;
05059
05063 enum {
05064 proxyRequestRefresh_UpdateStale=1,
05065 proxyRequestRefresh_RefreshAll=2,
05066 proxyRequestRefresh_GenerateAll=4,
05067 };
05069 virtual void RefreshProxies( int requestRefresh ) = 0;
05070 virtual void GenerateProxies( int requestRefresh ) = 0;
05071
05073 virtual void ShowConfigDialog( Tab<MCHAR*>* bitmapFilenames ) = 0;
05074
05076 virtual void ShowPrecacheDialog( Tab<MCHAR*>* bitmapFilenames ) = 0;
05077
05081 enum {
05082 proxyRequestFlags_ForceProxyMode=0x40000000,
05083 };
05085
05089 enum {
05090 proxyRequestLoad_UseLoadedProxy=1,
05091 proxyRequestLoad_ReloadProxy=2,
05092
05095 proxyRequestLoad_UseLoadedSubject=3,
05096 proxyRequestLoad_ReloadSubject=4,
05097 };
05099
05100
05101 virtual BMMRES LoadInto( BitmapInfo* requestInfo, Bitmap** pbitmap, int requestLoad, int requestFlags=0 ) = 0;
05102 };
05103
05105 BMMExport IBitmapProxyManager* GetBitmapProxyManager();
05106
05108
05116 class BitmapProxyTemporaryDisableGuard: public MaxHeapOperators {
05117 public:
05123 BMMExport explicit BitmapProxyTemporaryDisableGuard(bool doDisable = true);
05125 BMMExport ~BitmapProxyTemporaryDisableGuard();
05126 private:
05127 static int m_numInstances;
05128 bool m_doDisable;
05129 };
05130
05131
05133 #define BMM_ASSET_GROUP 1 //!< The declared bitmap represents a group. You must call EndGroup on the enum callback after you are finished grouping assets.
05134 #define BMM_ASSET_PROXY 2 //!< The declared bitmap is proxy enabled.
05135
05137
05148 BMMExport void DeclareBitmapAsset(IEnumAuxAssetsCallback &enumCallback, IAssetAccessor &anAccessor, BitmapInfo* bitmapInfo, int flags=0);
05149
05150
05151
05152
05153
05154
05155
05156 extern int ValidBitmapType ( int type );
05197 extern BMMExport BitmapStorage* BMMCreateStorage ( BitmapManager *manager,UINT type );
05198 extern BMMExport BitmapFilter* BMMCreateFilter ( BitmapManager *manager,UINT type );
05199 extern BMMExport BitmapDither* BMMCreateDither ( BitmapManager *manager,UINT type );
05200 extern BMMExport int BMMCalcPalette ( Bitmap *map,int colors,BMM_Color_48 *palette );
05201 extern BMMExport BYTE BMMClosestColor ( BMM_Color_64 *color,BMM_Color_48 *palette,int colors );
05202
05203
05204
05212 extern BMMExport const MCHAR* BMMGetBitmapTypeDescription(int bitmapType, DWORD bitmapFlags);
05213
05214 extern BMMExport void OpenBMM ( BMMInterface *i );
05215 extern BMMExport void CloseBMM ( );
05216 extern INT_PTR CALLBACK BMMGammaDlgProc (HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
05217
05218 extern void ExtractExtension ( MCHAR *string, MCHAR *ext );
05219
05220
05221
05222
05233 BMMExport int BMMCreateNumberedFilename ( const MCHAR *namein,int frame,MCHAR *nameout );
05234
05244 BMMExport int BMMFindNumberedFilenames ( const MaxSDK::Util::Path &baseFilename, MaxSDK::Array<MaxSDK::Util::Path> &foundFiles);
05245
05258 BMMExport int BMMGetFullFilename ( BitmapInfo *bi );
05259 BMMExport BOOL BMMGetFullFilename ( const MCHAR *namein, MCHAR* nameout );
05261
05262 BMMExport BOOL BMMIsFile ( const MCHAR *filename );
05263 BMMExport void BMMSplitFilename ( const MCHAR *name,MCHAR *p,MCHAR *f,MCHAR *e );
05264 BMMExport LPTSTR BMMGetLastErrorText ( LPTSTR lpszBuf, DWORD dwSize );
05265 BMMExport Quantizer* BMMNewQuantizer ();
05266
05269
05270 BMMExport void BMMAppendSlash ( MCHAR *path );
05271
05274
05275 BMMExport void BMMRemoveSlash ( MCHAR *path );
05276
05279
05280 BMMExport void BMMAppendSlash ( MSTR &path );
05281
05284
05285 BMMExport void BMMRemoveSlash ( MSTR &path );
05286
05287
05288
05289
05290
05291
05292
05293
05294
05295
05296
05297
05298
05299
05300
05301
05302
05303
05304
05305
05306
05307
05308
05309
05310
05311
05312
05313
05314
05315
05316
05317
05318
05319
05320
05321
05322 BMMExport BOOL BMMGetUniversalName ( MCHAR *out_uncname, const MCHAR* in_path);
05323 BMMExport BOOL BMMFindNetworkShare ( const MCHAR* in_localpath, MCHAR* out_sharename, MCHAR* out_sharepath);
05324 BMMExport BOOL BMMGetLocalShare ( const MCHAR *local_path, MCHAR *share );
05325
05326
05327
05328
05329 BMMExport ColorPacker *BMMNewColorPacker(
05330 int w,
05331 BMM_Color_48 *pal,
05332 int npal,
05333 BYTE* remap=NULL
05334 );
05335
05336
05337
05338
05339
05340
05355 BMMExport void FixPaletteForWindows(BMM_Color_48 *pal, BMM_Color_48 *newpal,int ncols, BYTE *remap=NULL);
05356
05357
05358
05359
05360
05361
05362 #define BITMAP_IOLAYER_CLASS Interface_ID(0x296b79ec,0x73e11944)
05363
05364 class BitmapIOLayer : public BaseInterface {
05365 public:
05366 virtual BOOL Init (const MCHAR* filename)=0;
05367 virtual int LayerCount ()=0;
05368 virtual const MCHAR* LayerName (int index)=0;
05369 virtual BOOL SetLayer (int index, BitmapInfo* bi, BOOL fulframe = TRUE)=0;
05370 };
05371
05372
05373
05374
05375
05376 #define LAYER_INTERFACE Interface_ID(0x1563269c,0x7ec41d89)
05377 #define I_LAYER_INTERFACE 0x000A1001
05378
05379 class BitmapLayerUtl : public FPStaticInterface {
05380 public:
05381 virtual int LayerCount (const MCHAR* filename)=0;
05382 virtual const MCHAR* LayerName (const MCHAR* filename, int index)=0;
05383 virtual PBBitmap* LoadLayer (const MCHAR* filename, int index, BOOL fulframe = TRUE)=0;
05384 };
05385
05386
05387
05388
05389
05390
05392 #define IBITMAPPAGER_INTERFACE_ID Interface_ID(0x48e1041f, 0x34c86c51)
05393
05403 class IBitmapPager : public FPStaticInterface {
05404 public:
05405 DECLARE_DESCRIPTOR( IBitmapPager );
05406
05407
05408
05409
05411
05413 virtual BOOL IsPagerEnabled() = 0;
05415
05419 virtual void SetPagerEnabled( BOOL b ) = 0;
05420
05427
05428 virtual const MCHAR* GetPageFilePath() = 0;
05430
05432 virtual void SetPageFilePath(const MCHAR* path) = 0;
05434
05444
05445 virtual float GetMemoryLimitPercent() = 0;
05447
05448 virtual void SetMemoryLimitPercent( float percent ) = 0;
05450
05457
05458 virtual float GetMemoryPaddingPercent() = 0;
05460
05461 virtual void SetMemoryPaddingPercent( float percent ) = 0;
05463
05464
05472
05473 virtual BOOL GetMemoryLimitAutoMode() = 0;
05475 virtual void SetMemoryLimitAutoMode( BOOL onOff ) = 0;
05477
05478
05480
05482 virtual size_t GetMemoryLimit() = 0;
05483 virtual size_t GetMemoryUsedForPager() = 0;
05484 virtual size_t GetMemoryPadding() = 0;
05485 virtual size_t GetMemoryAvailablePadded() = 0;
05486
05487 virtual LONGLONG GetMemoryTotalForPager() = 0;
05488 };
05489
05491 inline IBitmapPager* GetIBitmapPager()
05492 { return (IBitmapPager*)GetCOREInterface(IBITMAPPAGER_INTERFACE_ID); }
05493