Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Plugin and Companion App SDK
Viewing all articles
Browse latest Browse all 54282

Alpha channel data with layered format plugin

$
0
0

I have a layered format plugin and I am trying to write the alpha channel information separately. I have set up channelPortProcs and I am attempting to read the pixel data with readPixelsProc. The issue is that even though the readPixelsProc function doesn't return any errors the rectangle that is supposed to store the rectangle that was actually read is a 0x0 rectangle. I can't seem to find why this would be or what I might be doing wrong. Here's what I have so far:

// set up the pixel buffer
int32 bufferSize = imSize.h*imSize.v;
Ptr pixelData = sPSBuffer->New( &bufferSize, bufferSize );
if (pixelData == NULL)
{     *gResult = memFullErr;     return;
}

// Define the source and destination rectangles
ReadChannelDesc *alphaChannel = gFormatRecord->documentInfo->alphaChannels;
PIChannelPort port = alphaChannel->port;
PSScaling scale;
scale.sourceRect = scale.destinationRect = alphaChannel->bounds;
VRect destRect = scale.sourceRect;

// Set up the descriptor for reading pixel data
VRect wroteRect = {0};
PixelMemoryDesc dest = {0};
dest.rowBits = imSize.h*alphaChannel->depth;
dest.colBits = alphaChannel->depth;
dest.depth = alphaChannel->depth;
dest.data = pixelData;

// Put the pixel data into the buffer
*gResult = gFormatRecord->channelPortProcs->readPixelsProc(port,&scale, &destRect, &dest, &wroteRect);
if(*gResult != noErr)     return;

 

The alpha channel gives me the proper name, but I just can't get the data associated with it. Thanks.


Viewing all articles
Browse latest Browse all 54282

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>