Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

bitmap.__h

Go to the documentation of this file.
00001 #ifndef GE_BITMAP____H
00002 #define GE_BITMAP____H
00003 
00004 /****************************************************************************************/
00005 /*  Bitmap.__h                                                                          */
00006 /*                                                                                      */
00007 /*  Author: Charles Bloom                                                               */
00008 /*  Description:  Bitmap*.c Internal Header (contains the Bitmap Struct)                */
00009 /*                                                                                      */
00010 /*  The contents of this file are subject to the Genesis3D Public License               */
00011 /*  Version 1.01 (the "License"); you may not use this file except in                   */
00012 /*  compliance with the License. You may obtain a copy of the License at                */
00013 /*  http://www.genesis3d.com                                                            */
00014 /*                                                                                      */
00015 /*  Software distributed under the License is distributed on an "AS IS"                 */
00016 /*  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See                */
00017 /*  the License for the specific language governing rights and limitations              */
00018 /*  under the License.                                                                  */
00019 /*                                                                                      */
00020 /*  The Original Code is Genesis3D, released March 25, 1999.                            */
00021 /*  Copyright (C) 1999 WildTangent, Inc. All Rights Reserved           */
00022 /*                                                                                      */
00023 /****************************************************************************************/
00024 
00025 #include "bitmap.h"
00026 #include "bitmap._h"
00027 
00028 // Hey ! 
00029 // this is bitmap.__h : for inclusion by bitmap friends ONLY!
00030 //      included by bitmap.c , bitmap_blitdata.c
00031 
00032 /*}{ *********** the bitmap type *******************/
00033 
00034 // the Version Major indicates an incompatibility
00035 
00036 #define GEBM_VERSION_MAJOR              (0x0004)
00037 #define GEBM_VERSION_MINOR              (0x0000)
00038 
00039 #define MAXMIPLEVELS                    (8)
00040 
00041 #define PALETTE_FORMAT_DEFAULT  (GE_PIXELFORMAT_24BIT_RGB)
00042 
00043 #define ALPHA_TO_TRANSPARENCY_THRESHOLD         (80)
00044 
00045 struct geBitmap_Palette
00046 {
00047         int                             LockCount,RefCount;
00048         gePixelFormat   Format;
00049         int                             Size;
00050         geBoolean               HasColorKey;
00051         uint32                  ColorKey;               // the color which is the colorkey
00052         int                             ColorKeyIndex;  // the palette index which is the color;
00053                                                                         // Bitmap->CK == Bitmap->Pal->CK_Index
00054 
00055         // we have EITHER Data or DriverHandle
00056         void                    *Data;          //Size * BytesPerPixel(Format)
00057         DRV_Driver              *Driver;
00058         geRDriver_THandle*DriverHandle;
00059         void                    *DriverBits;    //only non-null inside a Lock/UnLock
00060 };
00061 
00062 struct geBitmap
00063 {
00064         int                             RefCount;
00065         geBitmap_Info           Info;
00066         void *                          Data[MAXMIPLEVELS];
00067         geBoolean                       Modified[MAXMIPLEVELS];
00068                                                         // modified tells whether a mip != a scaledown of mip 0
00069                                                         // modified[0] is ignored
00070         geBitmap *                      Alpha;
00071 
00072         int                                     LockCount;      // -Nmips for 'write' , > 0 for 'read's
00073         geBitmap *                      LockOwner;      // this points to our owner and doubles as boolean 'islocked'
00074         geBitmap *                      DataOwner;      // if this is set, then my Data is not mine to free
00075 
00076         gePixelFormat           PreferredFormat;        // user's favorite
00077         int                                     SeekMipCount;           // when we attach to driver, ask for this many mips
00078 
00079                 // must support any number of locks for read
00080                 // a lock for read can be a pointer to my raw bits, or a whole different bitmap
00081 
00082         geBitmap_Info           DriverInfo;                     // all the driver mess..
00083         uint32                          DriverFlags;
00084         DRV_Driver *            Driver;
00085         geRDriver_THandle *     DriverHandle;
00086         int                                     DriverMipLock;          // which mip to lock on GetBits
00087         geBoolean                       DriverBitsLocked;
00088         geBoolean                       DriverDataChanged;      // relative to system copy
00089         geFloat                         DriverGamma;
00090         geFloat                         DriverGammaLast;
00091         geBoolean                       DriverGammaSet;
00092 };
00093 
00094 
00095 /*}{ ************* internal protos *****************/
00096 
00097 //geBitmap * geBitmap_CreateXerox(geBitmap *BmpSrc);
00098 
00099 geBoolean geBitmap_IsValid(const geBitmap *Bmp);
00100 geBoolean geBitmap_Info_IsValid(const geBitmap_Info *Info);
00101 geBoolean geBitmap_Palette_IsValid(const geBitmap_Palette *Pal);
00102 
00103 geBoolean geBitmap_BlitMipRect(const geBitmap * Src, int SrcMip, int SrcX,int SrcY,
00104                                                                          geBitmap * Dst, int DstMip, int DstX,int DstY,
00105                                                         int SizeX,int SizeY);
00106 
00107 geBitmap * geBitmap_CreateLock_CopyInfo(geBitmap *BmpSrc,int LockCnt,int mip);
00108 geBitmap * geBitmap_CreateLockFromMip(geBitmap *Src,int mip,
00109         gePixelFormat Format,geBoolean HasColorKey,uint32 ColorKey,int LockCnt);
00110 geBitmap * geBitmap_CreateLockFromMipSystem(geBitmap *Src,int mip,int LockCnt);
00111 geBitmap * geBitmap_CreateLockFromMipOnDriver(geBitmap *Src,int mip,int LockCnt);
00112 
00113 geBoolean geBitmap_UnLock_NoChange(geBitmap *Bmp);
00114 geBoolean geBitmap_UnLockArray_NoChange(geBitmap **Locks,int Size);
00115 
00116 geBoolean geBitmap_Update_SystemToDriver(geBitmap *Bmp);
00117 geBoolean geBitmap_Update_DriverToSystem(geBitmap *Bmp);
00118 
00119 geBoolean geBitmap_MakeSystemMips(geBitmap *Bmp,int low,int high);
00120 geBoolean geBitmap_UpdateMips_Data(     geBitmap_Info * FmInfo,void * FmBits,
00121                                                                         geBitmap_Info * ToInfo,void * ToBits);
00122 geBoolean geBitmap_UpdateMips_System(geBitmap *Bmp,int fm,int to);
00123 
00124 geBoolean geBitmap_UsesColorKey(const geBitmap * Bmp);
00125 
00126 void      geBitmap_MakeMipInfo(  geBitmap_Info *Src,int mip,geBitmap_Info *Into);
00127 geBoolean geBitmap_MakeDriverLockInfo(geBitmap *Bmp,int mip,geBitmap_Info *Into);
00128                                         // MakeDriverLockInfo also doesn't full out the full info, so it must be a valid info first!
00129                                         // Bmp also gets some crap written into him.
00130 
00131 geBoolean geBitmap_AllocSystemMip(geBitmap *Bmp,int mip);
00132 geBoolean geBitmap_AllocPalette(geBitmap *Bmp,gePixelFormat Format,DRV_Driver * Driver);
00133 
00134 geBoolean geBitmap_ReadInfo( geBitmap *Bmp,geVFile * F);
00135 geBoolean geBitmap_WriteInfo(const geBitmap *Bmp,geVFile * F);
00136 
00137 geBoolean geBitmap_FixDriverFlags(uint32 *pFlags);
00138 
00139 /*}{ ************* end *****************/
00140 
00141 #endif

Generated on Tue Sep 30 12:35:16 2003 for GTestAndEngine by doxygen 1.3.2