Skip to main content
May 6, 2011
Question

AdjustObjectAIColors bug

  • May 6, 2011
  • 1 reply
  • 1342 views

It seems that when the object passed to AdjustObjectAIColors uses the Registration color, the AIAdjustColorFunc is not called. For example, I have one object on my document that uses Registration for its fill color. When I call AdjustObjectAIColors passing that object, the callback is not called. If I set the stroke on the object to Black, but leave the fill as Registration, the callback is called once, with Black as the passed color. If I change both the stroke and fill to Black, then the callback is called twice.

Is this a bug, or is this the way its supposed to work?

This topic has been closed for replies.

1 reply

Inspiring
May 17, 2011

I've just overcome that very problem today! Reading your post prompted me to check the colour-related code I'd been writing for the past week, and lo and behold, anything in registration wasn't triggering the callback.

It took me a while or so to come up with a solution but what I have seems to work.  I get the current registration colour from the Custom Color Suite and fill in an AIColor structure, using kCustomColor, the registration colour handle and a tint of 1. Then I call sAIPathStyle->ObjectUsesAIColor(),passing the art handle and False for matchTint.  The AIColorUsedHow value coming back appears to be accurate so that'll do for me

Surprisingly easy in the end but it did stump me for a while.

-W

May 18, 2011

That's a good workaround. I've actually used something similar in other places. What's nice about AdjustObjectAIColors is that it handles all the iteration for you. This workaround kind of forces you to iterate twice.

Inspiring
May 25, 2011

Sorry, I didn't mean to leave it so long before replying.

Whilst AdjustObjectAIColors can iterate for you, I am iterating through an AIArtSet manually having filtered out a handful of elements that I'm not interested in, passing each element to AdjustObjectAIColors.  So I am only iterating the once (least I hope I am!).

I find that working with colours in general is quite clunky.  There are a number methods of collecting colour information from various different suites, each one having it's own set of quirks.  Your mileage may be different.

-W.