DeviceN: _ASExceptionInfo at memory location
i'm problem in creating devicen color space:
error: first-chance exception @ 0x000007fefdcbaa7d in test.exe: microsoft c++ exception: _asexceptioninfo @ memory location 0x0012e620.
testing devicergb, works normally, devicen not. idea why error occurring?
following code:
pddoc = pddoccreate(); /* create new document */
mediabox.left = fixedzero; /* dimensions of page */
mediabox.top = int16tofixed(4*72); /* in case 5" x 4" */
mediabox.right = int16tofixed(5*72);
mediabox.bottom = fixedzero;
/* create page dimensions , insert first page */
pdpage = pddoccreatepage(pddoc, pdbeforefirstpage, mediabox);
/* acquire pdecontent container page */
pdecontent = pdpageacquirepdecontent(pdpage, null);
memset(&pdefontattrs, 0, sizeof(pdefontattrs));
pdefontattrs.name = asatomfromstring("times-roman"); /* font name */
pdefontattrs.type = asatomfromstring("type1"); /* font type */
pdefont = pdefontcreate(&pdefontattrs, sizeof(pdefontattrs),
0, 255, 0, /* widths */
0, asatomnull, /* encoding */
0, 0, 0, 0); /* font embedding */
/* following code sets default graphics state. that
* can free pdecolorspace objects
*/
memset(&fillclrvalue, 0, sizeof(pdecolorvalue));
memset(&gstate, 0, sizeof(pdegraphicstate));
// -------------------------------------------------------
char inks_process[] = "cyan";
char inks_spot[] = "spot1";
char functext[] = "{pop pop 0.0 0.0}"; // tests
asatom inks_process_a = asatomfromstring("cyan");
asatom inks_spot_a = asatomfromstring("spot1");
asfixed valuesc1inkspot[] =
{
floattoasfixed(0.0), floattoasfixed(0.5), floattoasfixed(1.0), floattoasfixed(0.0)
};
cosdoc cosdoc = pddocgetcosdoc(pddoc);
//
cosobj newcscolorants = cosnewarray (cosdoc, false, 2);
cosarrayput (newcscolorants, 0, cosnewname (cosdoc, false, inks_process_a));
cosarrayput (newcscolorants, 1, cosnewname (cosdoc, false, inks_spot_a));
//
int domaincount = 2;
cosobj domain = cosnewarray (cosdoc, false, domaincount * 2);
for(int = 0; < domaincount; i++)
{
cosarrayput (domain, * 2, cosnewfloat (cosdoc, false, 0.0f));
cosarrayput (domain, (i * 2) + 1, cosnewfloat (cosdoc, false, 1.0f));
}
int rangecount = 4;
cosobj range = cosnewarray (cosdoc, false, rangecount * 2);
for(int = 0; < rangecount; i++)
{
cosarrayput (range, * 2, cosnewfloat (cosdoc, false, 0.0f));
cosarrayput (range, (i * 2) + 1, cosnewfloat (cosdoc, false, 1.0f));
}
cosobj funcdict = cosnewdict (cosdoc, false, 4);
cosdictput (funcdict, asatomfromstring ("functiontype"), cosnewinteger (cosdoc, false, 4));
cosdictput (funcdict, asatomfromstring ("domain"), domain);
cosdictput (funcdict, asatomfromstring ("range"), range);
asstm stm = asmemstmrdopen(functext, strlen (functext));
cosobj function = cosnewstream (cosdoc, true, stm, 0, true, funcdict, cosnewnull (), -1);
asstmclose (stm);
//
cosobj components = cosnewarray (cosdoc, false, 1);
cosarrayput (components, 0, cosnewname (cosdoc, false, inks_process_a));
//
cosobj process = cosnewdict (cosdoc, false, 2);
cosdictput (process, asatomfromstring ("colorspace"), cosnewname (cosdoc, false, asatomfromstring ("devicecmyk")));
cosdictput (process, asatomfromstring ("components"), components);
//
cosobj spotseparationcs;
createseparationcolorcos_2(pddoc, inks_spot, valuesc1inkspot, spotseparationcs);
//
cosobj colorants = cosnewdict (cosdoc, false, 1);
cosdictput (colorants, inks_spot_a, spotseparationcs);
//
cosobj attributes = cosnewdict (cosdoc, false, 3);
cosdictput (attributes, asatomfromstring ("subtype"), cosnewname (cosdoc, false, asatomfromstring ("nchannel")));
cosdictput (attributes, asatomfromstring ("process"), process);
cosdictput (attributes, asatomfromstring ("colorants"), colorants);
//
cosobj newcolorspace = cosnewarray (cosdoc, true, 5);
cosarrayput (newcolorspace, 0, cosnewname (cosdoc, false, asatomfromstring ("devicen")));
cosarrayput (newcolorspace, 1, newcscolorants);
cosarrayput (newcolorspace, 2, cosnewname (cosdoc, false, asatomfromstring ("devicecmyk")));
cosarrayput (newcolorspace, 3, function);
cosarrayput (newcolorspace, 4, attributes);
pdecolorspace = pdecolorspacecreatefromcosobj (&newcolorspace);
//pdecolorspace = pdecolorspacecreatefromname(asatomfromstring("devicergb")); // rgb works, devicen not
fillclrvalue.color[0] = floattoasfixed(0.91f);
fillclrvalue.color[1] = floattoasfixed(0.73f);
// fillclrvalue.color[2] = floattoasfixed(0.0f); // rgb
// -------------------------------------------------------
// example sdk samples
fillclrspec.space = pdecolorspace;
fillclrspec.value = fillclrvalue;
gstate.fillcolorspec = fillclrspec;
gstate.miterlimit = fixedten;
gstate.flatness = fixedone;
gstate.linewidth = fixedone;
memset(&textmatrix, 0, sizeof(textmatrix)); /* clear structure */
textmatrix.a = int16tofixed(24); /* set font width , height */
textmatrix.d = int16tofixed(24); /* 24 point size */
textmatrix.h = int16tofixed(1*72); /* x,y coordinate on page */
textmatrix.v = int16tofixed(2*72); /* in case, 1" x 2" */
pdetext = pdetextcreate(); /* create new text run */
pdetextadd(pdetext, /* text container add to */
kpdetextrun, /* kpdetextrun, kpdetextchar */
0, /* index */
(asuns8 *)messagestr, /* text add */
strlen(messagestr), /* length of text */
pdefont, /* font apply text */
&gstate, sizeof(gstate), /* graphic state apply text */
null, 0, /* text state , size of structure*/
&textmatrix, /* transformation matrix text */
null); /* stroke matrix */
/* insert text page content */
pdecontentaddelem(pdecontent, kpdeafterlast, (pdeelement) pdetext);
/* set pdecontent page */
b = pdpagesetpdecontent(pdpage, null); // error!!
error: first-chance exception @ 0x000007fefdcbaa7d in test.exe: microsoft c++ exception: _asexceptioninfo @ memory location 0x0012e620
More discussions in Acrobat SDK
adobe
Comments
Post a Comment