Highlighted

Apply color to Compound Path

Community Beginner ,
Jun 07, 2020

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 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!!

TOPICS
SDK

Views

270

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Apply color to Compound Path

Community Beginner ,
Jun 07, 2020

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 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!!

TOPICS
SDK

Views

271

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 07, 2020 0
Adobe Community Professional ,
Jun 08, 2020

Copy link to clipboard

Copied

XCode or other programming language?, please provide details when asking, thanks.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 08, 2020 0
Community Beginner ,
Jun 08, 2020

Copy link to clipboard

Copied

Sorry! I used XCode programming in MAC OS.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 08, 2020 0
New Here ,
Jun 10, 2020

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!!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 10, 2020 0