Copy link to clipboard
Copied
HI, I am trying to use DrawArt to generate thumbnails for display in CEP panels
This relevant part of my code:
int dimen = 48;
AIDrawArtAGMPort port;
if(error = sAIDrawArt->CreateImagePort(dimen, dimen, &port.port))
return error;
AIRealRect bounds;
if(error = sAIArt->GetArtBounds(art, &bounds))
return error;
AIDrawArtData artData;
artData.version = kAIDrawArtSuiteVersion;
artData.output.port = port;
artData.origin.v = bounds.top;
artData.origin.h = bounds.left;
artData.destClipRect.left = artData.destClipRect.top = 0;
artData.destClipRect.right = dimen;
artData.destClipRect.bottom = -dimen; // tried + and -
artData.eraseDestClipRect = 1;
artData.matrix.Init();
artData.matrix.a = artData.matrix.d = dimen / max(bounds.right-bounds.left, bounds.top-bounds.bottom);
artData.flags = kAIDrawArtPreviewBit;
artData.type = kAIDrawArtAGMPortOutput;
artData.doSrcClip = 0;
artData.art = art;
const AIColorConvertOptions options;
if(error = sAIDrawArt->BeginDrawArt(&artData, options, artData.flags))
return error;
if(error = sAIDrawArt->DrawArt(&artData, options))
return error;
if(error = sAIDrawArt->EndDrawArt(&artData, options))
return error;
const ai::uint8* pixelData = NULL;
if(error = sAIDrawArt->GetImagePixelData(port.port, &pixelData, &length, NULL, NULL))
return error;
. When this finishes, I get data all zeroes
My understanding is that the AIDrawArt suite is not really meant for public consumption. It has one or two methods in it that are useful (DrawHilite for example). I'm not saying it can't work, but I was sort of warned away from it years ago.
If you need a thumbnail of some art there are other ways to do it. You can use the AIRasterizeSuite to render any artwork on the artboard and get the pixel data that way. If you don't want to do it for art that exists on the artboard, there are a few tricks f
Copy link to clipboard
Copied
My understanding is that the AIDrawArt suite is not really meant for public consumption. It has one or two methods in it that are useful (DrawHilite for example). I'm not saying it can't work, but I was sort of warned away from it years ago.
If you need a thumbnail of some art there are other ways to do it. You can use the AIRasterizeSuite to render any artwork on the artboard and get the pixel data that way. If you don't want to do it for art that exists on the artboard, there are a few tricks for rendering it off screen that involve dictionaries but it's doable.