The Illustrator SDK sets the tint value in spot color, it is possible to change the color tone.
In the Acrobat, I want to set the tint in the same way.
I created a color in the Acrobat plugin, and I painted the color to an art path.The Acrobat plugin create a color to CosObject as a spot color.
Then, I do not know how to set the tint to this color.
I have created a color in the following code, but I do not know how to set the tint value.
I do not care about the LAB.
Please tell me how to set the tint value as the Illustrator.
====
PluginMain(){
(…omitted…)
PDEContent volatile pdeContent = NULL;
PDEPath path = PDEPathCreate();
ASInt32 paintOp = 0x00;
paintOp = kPDEFill | kPDEStroke;
PDEPathSetPaintOp(path, paintOp);
(…omitted…)
PDEColorSpec pdeColorSpec;
pdeColorSpec = createColorSpec(pdDoc);
PDEGraphicState gstate;
memset(&gstate, 0, sizeof(PDEGraphicState));
gstate.strokeColorSpec = gstate.fillColorSpec = pdeColorSpec;
(…omitted…)
PDEContentAddElem(pdeContent, kPDEAfterLast, (PDEElement)path);
updateDocument(pdeContent, pdPage);
(…omitted…)
}
createColorSpec(PDDoc pdDoc)
{
PDEColorSpace colorSpace = createSampleColor(pdDoc);
PDEColorValue pdeColorvalue;
memset(&pdeColorvalue, 0, sizeof(PDEColorValue));
pdeColorvalue.color[0] = ASInt32ToFixed(0);
pdeColorvalue.color[1] = ASInt32ToFixed(1);
pdeColorvalue.color[2] = ASInt32ToFixed(0);
PDEColorSpec pdeColorSpec;
pdeColorSpec.space = colorSpace;
pdeColorSpec.value = pdeColorvalue;
return pdeColorSpec;
}
createColorSpec(){
PDEColorSpace spotColorSpace;
CosDoc cosDoc = PDDocGetCosDoc(pdDoc);
char *functionText = "{50.0 -128.0 -128.0}";
// Domain
CosObj domain = CosNewArray(cosDoc, false, 2);
CosArrayPut(domain, 0, CosNewFloat(cosDoc, false, 0.0f));
CosArrayPut(domain, 1, CosNewFloat(cosDoc, false, 1.0f));
// Range
CosObj range = CosNewArray(cosDoc,false,6);
CosArrayPut(range, 0, CosNewFloat(cosDoc, false, 0.0f));
CosArrayPut(range, 1, CosNewFloat(cosDoc, false, 100.0f));
CosArrayPut(range, 2, CosNewFloat(cosDoc, false, -128.0f));
CosArrayPut(range, 3, CosNewFloat(cosDoc, false, 127.0f));
CosArrayPut(range, 4, CosNewFloat(cosDoc, false, -128.0f));
CosArrayPut(range, 5, CosNewFloat(cosDoc, false, 127.0f));
// create dictionary
CosObj tintTransform = CosNewDict(cosDoc, false, 4);
CosDictPut(tintTransform,ASAtomFromString("FunctionType"),CosNewInteger(cosDoc,false,4));
CosDictPut(tintTransform, ASAtomFromString("Domain"), domain);
CosDictPut(tintTransform, ASAtomFromString("Range"), range);
ASStm asStm = ASMemStmRdOpen(functionText, strlen(functionText));
CosObj function = CosNewStream(cosDoc, true, asStm, 0, true, tintTransform, CosNewNull(), -1);
ASStmClose(asStm);
// create Lab
PDEColorSpace altSpace = createLab(pdDoc);
PDESeparationColorData data;
data.alt = altSpace;
data.name = ASAtomFromString("MyColor");
data.size = sizeof(data);
data.tintTransform = function;
PDEColorSpaceStruct clrStruct;
clrStruct.sep = &data;
spotColorSpace = PDEColorSpaceCreate(ASAtomFromString("Separation"), &clrStruct);
}
PDEColorSpace createLab(PDDoc pdDoc)
{
PDEColorSpace labColorSpace;
CosDoc cosDoc = PDDocGetCosDoc(pdDoc);
// Lab
CosObj csLab = CosNewArray(cosDoc, false, 2L);
CosObj csLabDic = CosNewDict(cosDoc, false, 3L);
// WhitePoint
CosObj csWhitePoint = CosNewArray(cosDoc, false, 3);
CosArrayPut(csWhitePoint, 0, CosNewFloat(cosDoc, false, 0.964203f));
CosArrayPut(csWhitePoint, 1, CosNewFloat(cosDoc, false, 1.0f));
CosArrayPut(csWhitePoint, 2, CosNewFloat(cosDoc, false, 0.824905f));
CosDictPutKeyString(csLabDic, "WhitePoint", csWhitePoint);
// Range
CosObj csRange = CosNewArray(cosDoc, false, 4L);
CosArrayPut(csRange, 0, CosNewFloat(cosDoc, false, -128.0f));
CosArrayPut(csRange, 1, CosNewFloat(cosDoc, false, 127.0f));
CosArrayPut(csRange, 2, CosNewFloat(cosDoc, false, -128.0f));
CosArrayPut(csRange, 3, CosNewFloat(cosDoc, false, 127.0f));
CosDictPutKeyString(csLabDic, "Range", csRange);
// BlackPoint
CosObj csBlackPoint = CosNewArray(cosDoc, false, 3);
CosArrayPut(csBlackPoint, 0, CosNewFloat(cosDoc, false, 0.0f));
CosArrayPut(csBlackPoint, 1, CosNewFloat(cosDoc, false, 0.0f));
CosArrayPut(csBlackPoint, 2, CosNewFloat(cosDoc, false, 0.0f));
CosDictPutKeyString(csLabDic, "BlackPoint", csBlackPoint);
CosArrayPut(csLab, 0L, CosNewNameFromString(cosDoc, false, "Lab"));
CosArrayPut(csLab, 1L, csLabDic);
labColorSpace = PDEColorSpaceCreateFromCosObj(&csLab);
return labColorSpace;
}
====