Hi everybody,
I am struggling on what I thought it was a simple task. I need to be able to pick a brush and apply it to a stroke. In the particular case I need to be a repeated pattern. I am in the dark at the moment. I have managed to do it from the GUI but I am not able to get almost anything working.
Summarizing I need to:
- create a pattern from group of paths (the same I would do in the GUI as showed in the images below)
- apply this pattern brush to a path
- (optional) save this brush into a brush file
I think AIBeautifulStrokes is the key to get this done but I cannot make it work. I have tried something like this to create a pattern brush with a polygon drawn previously, and set it to a path named "art":
error = sAIPattern->NewPattern(&sPatternHandle);
error = sAIPattern->SetPatternArt(sPatternHandle, polygon);
ai::UnicodeString newName;
error = sAIPattern->NewPatternName(newName);
error = sAIPattern->SetPatternName(sPatternHandle, newName);
error = sAIBeautifulStrokes->CreateParamsDict(NULL, advStrokeParams);
error = sAIBeautifulStrokes->SetArtPaint(advStrokeParams, polygon);
error = sAIBeautifulStrokes->GetArtStrokeParams(art, paramDict, &strokeStyle,& hasBrush, &scaleFactor, &canAccept);
error = sAIBeautifulStrokes->SetArtPatternPaint(paramDict, polygon, polygon, polygon, NULL, NULL, kAddSpace, 1, kAutoCentered, kAutoCentered);
It doesn't work. Also, if I set it from the GUI and I do GetArtPatternPaint, I get that all the AIPatternHandle are NULL.
Please can you help me? it is getting frustrating and I cannot find anywhere examples nor explanations.
Thanks in advance,
G.