コード例 #1
0
ファイル: ColorFuncs.cpp プロジェクト: befey/SafeguardTools
void RemoveWhiteOverprint()
{
    AIColor whiteColor;
    AIArtHandle currArtHandle;
    AIBoolean altered = FALSE;

    AICustomColorHandle hWhite = NULL;
    sAICustomColor->GetCustomColorByName(ai::UnicodeString("White"), &hWhite);

    whiteColor.kind = kCustomColor;
    whiteColor.c.c.tint = 1;
    whiteColor.c.c.color = hWhite;

    //CREATE THE ART SET
    AIArtSet artSet;
    sAIArtSet->NewArtSet(&artSet);

    //FILL THE ART SET
    AIArtSpec artSpecs[] = { { kPathArt , 0 , 0 },
        { kCompoundPathArt , 0 , 0 },
        { kPlacedArt , 0 , 0 },
        { kRasterArt , 0 , 0 },
        { kPluginArt , 0 , 0 },
        { kMeshArt , 0 , 0 },
        { kTextFrameArt , 0 , 0 },
        { kSymbolArt , 0 , 0 },
    };
    sAIArtSet->MatchingArtSet(artSpecs , 8 , artSet );

    //LOOP THE ART SET
    size_t count;
    sAIArtSet->CountArtSet( artSet, &count );
    for ( int i=0 ; i < count ; i++ )
    {
        sAIArtSet->IndexArtSet(artSet, i, &currArtHandle);
        AdjustOverprint(currArtHandle, whiteColor, TRUE, FALSE, ColorToolsUIController::ApplyTo::FillsAndStrokes, &altered);
    }
    //DISPOSE THE ART SET
    sAIArtSet->DisposeArtSet(&artSet);
}
コード例 #2
0
static void ASAPI changeButtonUp( ADMItemRef item, ADMNotifierRef notifier) {

	
	int ApplyTo; //0 = Strokes , 1 = Fills , 2 = Strokes and Fills
	ApplyTo = sADMEntry->GetIndex(sADMList->GetActiveEntry(sADMItem->GetList(ghApplyToList)));
	
	AIBoolean flag = FALSE;
	int numChanged = 0;
	
	//CREATE THE ART SET
	AIArtSet artSet;
	sAIArtSet->NewArtSet(&artSet);
	
	//SET UP AND INITIALIZE WHAT SCOPE WE'RE DEALING WITH
	int ChangeIn;	
	ChangeIn = sADMEntry->GetIndex(sADMList->GetActiveEntry(sADMItem->GetList(ghChangeInList)));
	
	//FILL THE ART SET BASED ON THE "CHANGE IN" LIST
	fillArtSet( artSet , ChangeIn );
	
	//Set the VisitFlags based on the apply to and whatnot
	VisitAIColorFlags controlFlags = kVisitColorsNullFlags; //change universally to direct only
	if ( ApplyTo == 0 ) {	controlFlags = kVisitColorsUniversally | /*kVisitColorsSolidOnly |*/ kVisitColorsStrokesOnly | kVisitGlobalObjectsOnceOnly;  }
	if ( ApplyTo == 1 ) {	controlFlags = kVisitColorsUniversally | /*kVisitColorsSolidOnly |*/ kVisitColorsFillsOnly | kVisitGlobalObjectsOnceOnly;  }
	if ( ApplyTo == 2 ) {	controlFlags = kVisitColorsUniversally | /*kVisitColorsSolidOnly |*/ kVisitGlobalObjectsOnceOnly;  }
	
	//LOOP THROUGH THE SET AND CHECK THE STROKES AND FILLS FOR THE COLOR WE're CHANGING from

	
	long count;		sAIArtSet->CountArtSet( artSet, &count );
	
	for ( int i=0 ; i < count ; i++ ) {
		AIArtHandle currArtObj;
		sAIArtSet->IndexArtSet( artSet, i, &currArtObj );
		
		/*// TEMP STUFF TO CHECK THE SELECTED OBJECTS COLOR
		AIPathStyle tempstyle; AICustomColor tempcolor;
		sAIPathStyle->GetPathStyle( currArtObj, &tempstyle);
		tempstyle.fill.color.kind;
		tempstyle.fill.color.c.c.tint;
		sAICustomColor->GetCustomColor(tempstyle.fill.color.c.c.color, &tempcolor);
		tempcolor.kind;
		tempcolor.c;*/ 
		

/*********** FIND AND REPLACE COLORS *************/
		if ( sADMEntry->GetIndex(sADMList->GetActiveEntry(sADMItem->GetList(ghAttributeList))) == 0) {
			
			//CREATE THE HANDLES and color specs FOR THE TO AND FROM COLORS
			COLORS FromToColors;
			char name[30];
			//initialize the colors
			sADMEntry->GetText( sADMList->GetActiveEntry(sADMItem->GetList(ghFromList)), name, 30 );
			setColorByName( name , FromToColors.FromColor );
			sADMEntry->GetText( sADMList->GetActiveEntry(sADMItem->GetList(ghToList)), name, 30 );
			setColorByName( name , FromToColors.ToColor );
			
			//do the color replacing
			sAIPathStyle->AdjustObjectAIColors( currArtObj , adjustColor , &FromToColors , controlFlags , &flag );
			
			//increment counter if a switch was made
			if (flag) { numChanged++; }
			flag = FALSE;
		}


/*********** FIND AND REPLACE OVERPRINTING *************/
		if ( sADMEntry->GetIndex(sADMList->GetActiveEntry(sADMItem->GetList(ghAttributeList))) == 1) {		
		
			//Get the AIColor from the color in the drop down
			char name[30];
			//initialize the colors
			AIColor fcolor;
			sADMEntry->GetText( sADMList->GetActiveEntry(sADMItem->GetList(ghFromList)), name, 30 );
			setColorByName( name , fcolor );
			
			//Get whether we're including tints or not
			AIBoolean ignoreTints = ( sADMItem->GetBooleanValue(ghIncludeTintsCheckBox) && sADMItem->IsEnabled(ghIncludeTintsCheckBox) );
			
			//Get whether we're turning overprint off or on
			AIBoolean overprint = sADMEntry->GetIndex(sADMList->GetActiveEntry(sADMItem->GetList(ghAddRemoveList)));
			
			//Get whether we're doing strokes or fills
			int replaceIn = sADMEntry->GetIndex(sADMList->GetActiveEntry(sADMItem->GetList(ghApplyToList)));
			
			AdjustOverprint(currArtObj, fcolor, ignoreTints, overprint, replaceIn, &flag);
			
			if (flag) { numChanged++; }
			flag = FALSE;
		}
	}
	
	//Show the counter
	char buffer[100];
	sprintf(buffer,"Changed %d items",numChanged);
	sADMItem->SetText(ghNumberChangedLabel, buffer);
	
	//DISPOSE OF THE ART SET
	sAIArtSet->DisposeArtSet(&artSet);
}