Hello,
Attempting to add a B/W image built in memory using PXC_AddImageFromMemory using MemType_8bpp. According to the documentation: "The image has a maximum of 256 colors, and the pal (which must be valid) contains up to 256 entries. Each pixel in the image is represented by one byte, the value of which is an index in the palette."
The API returns S_OK, but the _PXCImage* is still 0 (as initialized before the call) and a PXC_PlaceImage using that identifier returns invalid object id. The question is: what supposed error in the data might get PXC_AddImageFromMemory to say it succeeded when it failed returning a image object id?
I have a very simple memory structure. A square image of 174x174 pixels. The buffer is 174x174 bytes (1 byte per pixel). These pixel bytes are 0 for white and 1 for black and the palette is defined as : RGBQUAD pal[256] = { { 0xff, 0xff, 0xff, 0 }, { 0, 0, 0, 0 } };
The code is similar to this:
// bmsize is 174, pbitmap points to the first byte of the array 174x174 bytes, the lDelta is then positive and equal to bmsize (174)
_PXCImage* imageid = 0;
HRESULT hres = PXC_AddImageFromMemory(page, MemType_8bpp, pbitmap, bmsize,
&pal[0], 256, bmsize, bmsize, bmsize*bmsize, &imageid);
if (IS_DS_FAILED(hres))
...
hres is S_OK and yet imageid == 0
What trivial thing have I misunderstood from the documentation?
Thanks !
PXC_AddImageFromMemory returning S_OK but _PXCImage* is 0
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
-
- User
- Posts: 48
- Joined: Thu Mar 11, 2010 7:07 pm
-
- User
- Posts: 48
- Joined: Thu Mar 11, 2010 7:07 pm
Re: PXC_AddImageFromMemory returning S_OK but _PXCImage* is
Hum, err, huh...
Do not pass _PXCPage to AddImage... but _PXCDocument.What trivial thing have I misunderstood from the documentation?
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: PXC_AddImageFromMemory returning S_OK but _PXCImage* is
Hello omascia,
So did you manage to resolve the issue between your two posts?
(I am not too sure if the second one says that the problem is solved)
Regards,
Stefan
So did you manage to resolve the issue between your two posts?
(I am not too sure if the second one says that the problem is solved)
Regards,
Stefan
-
- User
- Posts: 48
- Joined: Thu Mar 11, 2010 7:07 pm
Re: PXC_AddImageFromMemory returning S_OK but _PXCImage* is
Oh yes, this topic is resolved. My terse comment meant that.So did you manage to resolve the issue between your two posts?
(I am not too sure if the second one says that the problem is solved)
I'm making an habit of having some problem, post about it in last resort, then finding the solution within minutes of posting.
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: PXC_AddImageFromMemory returning S_OK but _PXCImage* is
Hi omascia,
It usually works like this! (to find the solution the moment you ask for help with it!)
Glad this one is resolved!
Cheers,
Stefan
It usually works like this! (to find the solution the moment you ask for help with it!)
Glad this one is resolved!
Cheers,
Stefan