@peceha, post #1
#define WordWidth(w) (((w)+15)>>4) /* Szerokość w słowach */
UWORD *BitMapToImageData(struct BitMap *bm)
{
struct BitMap auxbm; /* Pomocnicza bitmapa */
UWORD *ImageData, *cur;
WORD width = GetBitMapAttr(bm, BMA_WIDTH);
WORD height = GetBitMapAttr(bm, BMA_HEIGHT);
WORD depth = GetBitMapAttr(bm, BMA_DEPTH);
LONG planesize = WordWidth(width) * height; /* Rozmiar bitplanu w słowach */
WORD p;
if (ImageData = AllocVec(planesize * depth * sizeof(UWORD), MEMF_CHIP))
{
InitBitMap(&auxbm, depth, width, height);
auxbm.Planes[0] = (PLANEPTR)(cur = ImageData);
for (p = 1; p < depth; p++)
{
auxbm.Planes[i] = (PLANEPTR)(cur += planesize);
}
BltBitMap(bm, 0, 0, &auxbm, 0, 0, width, height, 0xc0, 0xff, NULL);
WaitBlit();
return(ImageData);
}
return(NULL);
}