From 62e509e9c90d728c9f65145947276f79112ab48c Mon Sep 17 00:00:00 2001 From: "Christian A. Weber" Date: Tue, 2 Nov 1993 18:53:33 +0000 Subject: Initial revision --- BMapSupport.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 BMapSupport.c (limited to 'BMapSupport.c') diff --git a/BMapSupport.c b/BMapSupport.c new file mode 100644 index 0000000..569cdf3 --- /dev/null +++ b/BMapSupport.c @@ -0,0 +1,90 @@ +/* +** Bobi - The Ultimate Amiga Bob Manipulator +** +** BMapSupport.c - Erstellen und Vernichten von BitMaps und ByteMaps +** +** COPYRIGHT (C) 1989-1993 BY CHRISTIAN A. WEBER, ZUERICH, SWITZERLAND. +** ALL RIGHTS RESERVED. NO PART OF THIS SOFTWARE MAY BE COPIED, REPRODUCED, +** OR TRANSMITTED IN ANY FORM OR BY ANY MEANS, WITHOUT THE PRIOR WRITTEN +** PERMISSION OF THE AUTHOR. NO WARRANTY. USE AT YOUR OWN RISK. +*/ + +#include +#include +#include +#include +#include "ByteMap.h" + + +struct BitMap *MakeBitMap(WORD width, WORD height, WORD depth) +{ + register long i; + register struct BitMap *b; + register WORD planesize; + + if(b = AllocMem(sizeof(struct BitMap),MEMF_CLEAR)) + { + InitBitMap(b,depth,width,height); + planesize=b->BytesPerRow*b->Rows; + + if(b->Planes[0]=AllocMem(planesize*depth,MEMF_CHIP|MEMF_CLEAR)) + { + for(i=1; iPlanes[i] = b->Planes[0]+i*planesize; + } + else + { + FreeMem(b,sizeof(*b)); + b=0; + } + } + return(b); +} + + +/*************************************************************************/ + +void MyFreeBitMap(struct BitMap *b) +{ + FreeMem(b->Planes[0],b->BytesPerRow*b->Rows*b->Depth); + FreeMem(b,sizeof(*b)); +} + + +/*************************************************************************/ + +struct ByteMap *MakeByteMap(register WORD width,register WORD height) +{ + register struct ByteMap *b; + register long planesize; + + planesize = width*height; + + if(b = AllocMem(sizeof(struct ByteMap),MEMF_CLEAR)) + { + if(b->Plane = AllocMem(planesize,MEMF_CLEAR)) + { + b->Width = width; + b->Height = height; + b->PlaneSize = planesize; + } + else + { + FreeMem(b,sizeof(*b)); + b=0; + } + } + return b; +} + + +/*************************************************************************/ + +void FreeByteMap(struct ByteMap *b) +{ + if(b->Plane) + { + FreeMem(b->Plane,b->PlaneSize); + } + FreeMem(b,sizeof(*b)); +} -- cgit v1.2.3