Copy link to clipboard
Copied
Dear Sir/ Madam.
Please teach us how to apply one AIColor to one Compound path?
Regards,
T.Selvakkani
The below should work. I've only recently started using the SDK myself, but this works in my project:
#include "IllustratorSDK.h" //this is required for aisdk::check_ai_error
#include "Suites.h" //this should be your Suites acquisition file
AIPathStyle pathStyle;
AIPathStyleMap pathStyleMap;
AIDictionaryRef advStrokeParams = NULL;
//this line requires that art is currently selected
result = sAIPathStyle->GetCurrentPathStyle( &pathStyle, &pathStyleMap, &advStrokeParams, nullptr);
//you might be
...
Copy link to clipboard
Copied
XCode or other programming language?, please provide details when asking, thanks.
Copy link to clipboard
Copied
Sorry! I used XCode programming in MAC OS.
Copy link to clipboard
Copied
The below should work. I've only recently started using the SDK myself, but this works in my project:
#include "IllustratorSDK.h" //this is required for aisdk::check_ai_error
#include "Suites.h" //this should be your Suites acquisition file
AIPathStyle pathStyle;
AIPathStyleMap pathStyleMap;
AIDictionaryRef advStrokeParams = NULL;
//this line requires that art is currently selected
result = sAIPathStyle->GetCurrentPathStyle( &pathStyle, &pathStyleMap, &advStrokeParams, nullptr);
//you might be able to use this instead, as it does not require art to be selected, but I have not checked that it works as expected
result = sAIPathStyle->GetInitialPathStyle(&pathStyle); //will set pathStyle to the default values
aisdk::check_ai_error(result);
//set your options using the following lines as a template
pathStyle.fillPaint = true;
pathStyle.fill.color.kind = kGrayColor;
pathStyle.fill.color.c.g.gray = kAIRealOne; //set colour to black
pathStyle.strokePaint = true;
pathStyle.stroke.color.kind = kGrayColor;
pathStyle.stroke.color.c.g.gray = kAIRealOne; //set colour to black
pathStyle.stroke.width = kAIRealOne;
result = sAIPathStyle->SetPathStyle( YOUR_COMPOUND_PATH_ART_HANDLE, &pathStyle );
aisdk::check_ai_error(result);
Note that sAIPathStyle is a suite that must first be acquired. If you're using the SDK templates, which I think is a good idea, then that means you need to add AIPathStyleSuite to your Suites.h and Suites.cpp files. Good luck!!