Maybe you're skipping a step. Are you rasterizing other kinds of art
straight to disk using the AIImageOptSuite? I've never used that suite,
so maybe you're doing skipping a step I assumed you had to do. If so,
it might be that the step I'm doing is the one you want You are totally right. This is exactly what I do. For any kind of AIArtHandle, AllImageOptSuite is used. Here it is this method (still to be imporved): AIErr AIArtHandleModifier::RasterizeArtToPNG(std::string path, const AIArtHandle &art, const AIRealRect& crop) { AIErr result =kNoErr; AIDataFilter* dstFilter = 0; AIDataFilter* filter = 0; ai::UnicodeString file(path.c_str()); ai::FilePath fileP(file); try { AIRealRect bounds; sAIArt->GetArtBounds(art, &bounds); AIReal width = bounds.right - bounds.left; AIReal height = bounds.top - bounds.bottom; if(width == 0 ||height == 0) return kBadParameterErr; result = sAIDataFilter->NewFileDataFilter(fileP, "write", 'prw', 'PNGf', &filter); aisdk::check_ai_error(result); result = sAIDataFilter->LinkDataFilter(dstFilter, filter); aisdk::check_ai_error(result); dstFilter = filter; AIImageOptPNGParams2 params; params.versionOneSuiteParams.interlaced = ConfigurationManager::GetInterlacedProperty(); params.versionOneSuiteParams.numberOfColors = ConfigurationManager::GetNumberOfColors(); params.versionOneSuiteParams.transparentIndex = ConfigurationManager::GetTransparentIndex(); params.versionOneSuiteParams.resolution = ConfigurationManager::GetResolution(); params.versionOneSuiteParams.outAlpha = ConfigurationManager::GetOutAlpha(); params.versionOneSuiteParams.outWidth = (ASInt32)width; params.versionOneSuiteParams.outHeight = (ASInt32)height; //We assume that the basic resolution of illustrator is 72 dpi AIReal resolutionRatio = ConfigurationManager::GetResolution() / 72; if(resolutionRatio == 0) return kBadParameterErr; AIReal minDim = min(width,height) * resolutionRatio; AIReal maxDim = max(width,height) * resolutionRatio; AIReal ratio = 1; if(minDim < ConfigurationManager::minRasterizationDimension) { ratio = ConfigurationManager::minRasterizationDimension / minDim; minDim *= ratio; maxDim *= ratio; } if(maxDim > ConfigurationManager::maxRasterizationDimension) { ratio *= ConfigurationManager::maxRasterizationDimension / maxDim; } //Here we tune the resolution parameter to comply to minRasterizationDimension and //maxRasterizationDimension constraints //We assume that the basic resolution of illustrator is 72 dpi params.versionOneSuiteParams.resolution *= ratio; params.antialias = ConfigurationManager::GetAntialias(); /* A cropping box for the art. If empty or degenerate, do not crop. */ params.cropBox = crop; params.backgroundIsTransparent = ConfigurationManager::GetBackgroundIsTransparentProperty(); /* When backgroundIsTransparent is false, rasterize against this matte color. */ /*params.matteColor.red = 1.0f; params.matteColor.green = 1.0f; params.matteColor.blue = 1.0f; */ result = sAIImageOpt->MakePNG24 (art, dstFilter, params, MyRasterizeProgressProc); aisdk::check_ai_error(result); if (dstFilter) { result = sAIDataFilter->UnlinkDataFilter (dstFilter, &dstFilter); aisdk::check_ai_error(result); } } catch(ai::Error& ex) { result = ex; } return result; } So the only thing, I have to do is to pass the AIArtHandle as parameter. May be this is too generic, and I would have write a method to handle embedded raster. I will fixed this later. I get an AIArtHandle ('AIArtHandle *raster' is the parameter name)
which represents a raster object on the artboard. We then crack that
open using AIRasterSuite::GetRasterInfo() the same for me. and use GetRasterTile....... I think that's what you want to know how to do? If so, the code I have
is a little ugly, but maybe I get permission from my boss to share it Excatly. This would be great. Thanks for your help Regards, Thomas.
... View more