Filter plug-in: How to mix my RGB image with source document image properly?
Hi All,
My problem seems to be very common, but I can't find any answers in documentation.
I made Filter plug-in. It composes RGB image and mixes it with user source image in the document.
Now I load FilterRecord->
inData to byte array and recode each pixel with HostCSConvertColor function.
My code looks like that:
byte
*input = (byte*)filter_record->inData;
int
width = filter_record->inRect.right - filter_record->inRect.left;
int height = filter_record->inRect.bottom - filter_record->inRect.top;
byte
*transfer_buffer;
int size = width * height * 4;
transfer_buffer = new byte[size];
byte *output = transfer_buffer;
int
planes = CSPlanesFromMode(fpb->imageMode, 3);
int16 color[4];
for(j = 0; j < height; j++)
{
for(i = 0; i < width; i++)
{
for(k = 0; k < planes; k++)
{
color[k] = input[i * align + k];
}
HostCSConvertColor(filter_record->colorServices, space, plugIncolorServicesRGBSpace, color);
*
output = (byte)color[0]; output++;
*
output = (byte)color[1]; output++;
*
output = (byte)color[2]; output++;
*
output = 255; output++;
}
// for width
input += line;
} // for height
After that I mix my RGB image with output buffer and make back transition via
HostCSConvertColor to the document Color Space.
It works very slow and looks ugly.
But I can't find any other way to mix my RGB image with photoshop image which can be not RGB Color Mode.
Your help will be very appreciated.
Sofia
