When referencing an indexed image, HPDF_DICT_ITEM_UNEXPECTED_TYPE is
returned because the ColorSpace is stored as an Array instead of as a Name.
Here's the repair:
HPDF_EXPORT(const char*)
HPDF_Image_GetColorSpace (HPDF_Image image)
{
HPDF_Name n;
HPDF_PTRACE ((" HPDF_Image_GetColorSpace\n"));
n = HPDF_Dict_GetItem (image, "ColorSpace", HPDF_OCLASS_NAME);
if (!n) {
// If there's no item, we need to check for paletted a colorspace,
// which is stored as an array rather than as a name.
HPDF_Array a;
// We have an active error flag that'll haunt us if we don't reset
HPDF_Error_Reset(image->error);
// For paletted images, we actually have an array instead with the
// colorspace name in the first slot.
a = HPDF_Dict_GetItem (image, "ColorSpace", HPDF_OCLASS_ARRAY);
n = HPDF_Array_GetItem (a, 0, HPDF_OCLASS_NAME);
}
if (!n) {
HPDF_CheckError (image->error);
return NULL;
}
return n->value;
}
Nobody/Anonymous
None
None
Public
| Field | Old Value | Date | By |
|---|---|---|---|
| status_id | Open | 2008-04-22 11:04 | tony2001 |
| close_date | - | 2008-04-22 11:04 | tony2001 |