Pixels and ADMImageRef

Comments and discussions about 8bf plugins which can be use in various applications like Photoshop, Paint Shop Pro or Photo-Paint
Post Reply
bogho
Plugin Expert
Plugin Expert
Posts: 15
Joined: Mon Jun 28, 2004 9:13 am
Location: Romania
Contact:

Pixels and ADMImageRef

Post by bogho »

Hi!
Me again!
Right now I try something else and it started to show something that looks with my image, but not very correct.
The function i use i now is:

ADMImageRef GetImage()
{
int16 tileHeight = filterRecord->outTileHeight;
int16 tileWidth = filterRecord->outTileWidth;

if (tileWidth == 0 || tileHeight == 0 || filterRecord->advanceState == NULL)
{
return 0;
}

uint8 *red, *green, *blue, *alpha;

VRect outRect = GetOutRect();
VRect filterRect = GetFilterRect();

int32 imageVert = filterRect.bottom - filterRect.top;
int32 imageHor = filterRect.right - filterRect.left;

uint32 tilesVert = (tileHeight - 1 + imageVert) / tileHeight;
uint32 tilesHoriz = (tileWidth - 1 + imageHor) / tileWidth;

int16 layerPlanes = 0;
if (filterRecord->filterCase > 2)
layerPlanes = filterRecord->outLayerPlanes;
else
layerPlanes = filterRecord->planes;

int32 progress_total = layerPlanes * tilesVert;
int32 progress_complete = 0;

ADMImageRef imageRef = sADMImage->Create(imageHor, imageVert);
ASByte* theImage = sADMImage->BeginBaseAddressAccess(imageRef);
ASRGBColor **color = (ASRGBColor**)malloc(sizeof(ASRGBColor)*imageVert*imageHor);
long jjj = 0;
long aaa = 0;
long i = 0;
for(int16 planeCount = 0; planeCount < layerPlanes; planeCount++)
{
filterRecord->outLoPlane = 0;
filterRecord->outHiPlane = planeCount;
for(uint16 vertTile = 0; vertTile < tilesVert; vertTile++)
{
for(uint16 horizTile = 0; horizTile < tilesHoriz; horizTile++)
{
outRect.top = 0;//vertTile * tileHeight;
outRect.left = 0;//horizTile * tileWidth;
outRect.bottom = 100;//imageVert/5;//outRect.top + tileHeight;
outRect.right = 500;//imageHor/5;//outRect.left + tileWidth;
if (outRect.bottom > imageVert)
outRect.bottom = imageVert;
if (outRect.right > imageHor)
outRect.right = imageHor;

SetOutRect(outRect);
filterRecord->advanceState();
outRect = GetOutRect();
long bitDepth = 8;
long len = imageHor * imageVert * bitDepth;
//
// I tried the for in here
// aaa = strlen((char*)filterRecord->outData);
// for(i=0; i<53248;i++)
// {
// theImage[jjj++] = ((ASByte*)filterRecord->outData);
// }
//
//
//
}
//
// And here
//

filterRecord->progressProc(++progress_complete, progress_total);

if (filterRecord->abortProc())
{
goto done;
}

}
//
// End finally here.
//
aaa = strlen((char*)filterRecord->outData);
for(i=0; i<53248;i++)
{
theImage[jjj++] = ((ASByte*)filterRecord->outData);
}
}
done:
outRect.top = 0;
outRect.left = 0;
outRect.bottom = 0;
outRect.right = 0;
SetOutRect(outRect);

return imageRef;
}
...................................................................

How can I create this ADMImageRef, because right now I do not have any more ideas.

Bogdan!

Post Reply