home *** CD-ROM | disk | FTP | other *** search
- #include "sysi2.h"
-
- struct BitMap *MyAllocBM(LONG Width, LONG Height, LONG Depth, LONG Flags, struct BitMap *Friend)
- {
- if(IntuitionBase->LibNode.lib_Version>=39)
- {
- return(AllocBitMap(Width,Height,Depth,Flags,Friend));
- }
- else
- {
- struct BitMap *bm;
- LONG l,fail=0;
-
-
- if(bm=AllocVec(sizeof(struct BitMap),MEMF_PUBLIC|MEMF_CLEAR))
- {
- InitBitMap(bm,Depth,Width,Height);
- Width=bm->BytesPerRow * 8;
- for(l=0;l<Depth;l++)
- {
- if((bm->Planes[l]=AllocRaster(Width,Height))==0)
- fail=1;
- }
-
- if(fail)
- {
- MyFreeBM(bm);
- return(0);
- }
- return(bm);
- }
- }
- }
-
- void MyFreeBM(struct BitMap *BM)
- {
- LONG l;
-
- if(BM)
- {
- if(IntuitionBase->LibNode.lib_Version>=39)
- {
- FreeBitMap(BM);
- }
- else
- {
- for(l=0;l<BM->Depth;l++)
- {
- if(BM->Planes[l])
- FreeRaster(BM->Planes[l],BM->BytesPerRow,BM->Rows);
- }
- FreeVec(BM);
- }
- }
- }
-
-