• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Apply color to Compound Path

Community Beginner ,
Jun 07, 2020 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

TOPICS
SDK

Views

576

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
community guidelines

correct answers 1 Correct answer

New Here , Jun 10, 2020 Jun 10, 2020

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

Votes

Translate

Translate
Adobe
LEGEND ,
Jun 08, 2020 Jun 08, 2020

Copy link to clipboard

Copied

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

Votes

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
community guidelines
Community Beginner ,
Jun 08, 2020 Jun 08, 2020

Copy link to clipboard

Copied

Sorry! I used XCode programming in MAC OS.

Votes

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
community guidelines
New Here ,
Jun 10, 2020 Jun 10, 2020

Copy link to clipboard

Copied

LATEST

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

Votes

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
community guidelines