mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-08-29 23:32:15 +02:00
Fix some issues with the core file writing code.
Add test images to the unit tests.
This commit is contained in:
@@ -827,11 +827,35 @@ pdfioPageDictAddImage(
|
||||
const char *name, // I - Image name
|
||||
pdfio_obj_t *obj) // I - Image object
|
||||
{
|
||||
(void)dict;
|
||||
(void)name;
|
||||
(void)obj;
|
||||
pdfio_dict_t *resources; // Resource dictionary
|
||||
pdfio_dict_t *xobject; // XObject dictionary
|
||||
|
||||
return (false);
|
||||
|
||||
// Range check input...
|
||||
if (!dict || !name || !obj)
|
||||
return (false);
|
||||
|
||||
// Get the images dictionary...
|
||||
if ((resources = pdfioDictGetDict(dict, "Resources")) == NULL)
|
||||
{
|
||||
if ((resources = pdfioDictCreate(dict->pdf)) == NULL)
|
||||
return (false);
|
||||
|
||||
if (!pdfioDictSetDict(dict, "Resources", resources))
|
||||
return (false);
|
||||
}
|
||||
|
||||
if ((xobject = pdfioDictGetDict(resources, "XObject")) == NULL)
|
||||
{
|
||||
if ((xobject = pdfioDictCreate(dict->pdf)) == NULL)
|
||||
return (false);
|
||||
|
||||
if (!pdfioDictSetDict(resources, "XObject", xobject))
|
||||
return (false);
|
||||
}
|
||||
|
||||
// Now set the image reference in the images resource dictionary and return...
|
||||
return (pdfioDictSetObject(xobject, name, obj));
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user