Rename some of the content APIs for consistency.

This commit is contained in:
Michael R Sweet 2021-06-10 19:41:39 -04:00
parent 5533408c09
commit 0aea9c5439
No known key found for this signature in database
GPG Key ID: BE67C75EC81F3244
3 changed files with 32 additions and 28 deletions

View File

@ -1126,7 +1126,7 @@ pdfioContentTextShowJustified(
//
pdfio_obj_t * // O - Font object
pdfioFileCreateBaseFontObj(
pdfioFileCreateFontObjFromBase(
pdfio_file_t *pdf, // I - PDF file
const char *name) // I - Font name
{
@ -1150,11 +1150,11 @@ pdfioFileCreateBaseFontObj(
//
// 'pdfioFileCreateFontObj()' - Add a font object to a PDF file.
// 'pdfioFileCreateFontObjFromFile()' - Add a font object to a PDF file.
//
pdfio_obj_t * // O - Font object
pdfioFileCreateFontObj(
pdfioFileCreateFontObjFromFile(
pdfio_file_t *pdf, // I - PDF file
const char *filename, // I - Filename
bool unicode) // I - Unicode font?
@ -1177,11 +1177,11 @@ pdfioFileCreateFontObj(
//
// 'pdfioFileCreateICCObj()' - Add an ICC profile object to a PDF file.
// 'pdfioFileCreateICCObjFromFile()' - Add an ICC profile object to a PDF file.
//
pdfio_obj_t * // O - Object
pdfioFileCreateICCObj(
pdfioFileCreateICCObjFromFile(
pdfio_file_t *pdf, // I - PDF file
const char *filename, // I - Filename
size_t num_colors) // I - Number of color components (1, 3, or 4)
@ -1257,13 +1257,17 @@ pdfioFileCreateICCObj(
//
// 'pdfioFileCreateImageObj()' - Add an image object to a PDF file.
// 'pdfioFileCreateImageObjFromFile()' - Add an image object to a PDF file.
//
// Currently only GIF, JPEG, and PNG files are supported.
// This function creates an image object in a PDF file from a JPEG or PNG file.
//
// > Note: Currently PNG support is limited to grayscale, RGB, or indexed files
// > without interlacing or alpha. Transparency (masking) based on color/index
// > is supported.
//
pdfio_obj_t * // O - Object
pdfioFileCreateImageObj(
pdfioFileCreateImageObjFromFile(
pdfio_file_t *pdf, // I - PDF file
const char *filename, // I - Filename
bool interpolate) // I - Interpolate image data?

View File

@ -144,10 +144,10 @@ extern bool pdfioContentTextShowf(pdfio_stream_t *st, const char *format, ...)
extern bool pdfioContentTextShowJustified(pdfio_stream_t *st, size_t num_fragments, const double *offsets, const char * const *fragments) PDFIO_PUBLIC;
// Resource helpers...
extern pdfio_obj_t *pdfioFileCreateBaseFontObj(pdfio_file_t *pdf, const char *name) PDFIO_PUBLIC;
extern pdfio_obj_t *pdfioFileCreateFontObj(pdfio_file_t *pdf, const char *filename, bool unicode) PDFIO_PUBLIC;
extern pdfio_obj_t *pdfioFileCreateICCObj(pdfio_file_t *pdf, const char *filename, size_t num_colors) PDFIO_PUBLIC;
extern pdfio_obj_t *pdfioFileCreateImageObj(pdfio_file_t *pdf, const char *filename, bool interpolate) PDFIO_PUBLIC;
extern pdfio_obj_t *pdfioFileCreateFontObjFromBase(pdfio_file_t *pdf, const char *name) PDFIO_PUBLIC;
extern pdfio_obj_t *pdfioFileCreateFontObjFromFile(pdfio_file_t *pdf, const char *filename, bool unicode) PDFIO_PUBLIC;
extern pdfio_obj_t *pdfioFileCreateICCObjFromFile(pdfio_file_t *pdf, const char *filename, size_t num_colors) PDFIO_PUBLIC;
extern pdfio_obj_t *pdfioFileCreateImageObjFromFile(pdfio_file_t *pdf, const char *filename, bool interpolate) PDFIO_PUBLIC;
// Image object helpers...
extern size_t pdfioImageGetBytesPerLine(pdfio_obj_t *obj) PDFIO_PUBLIC;

View File

@ -212,21 +212,21 @@ do_unit_tests(void)
return (1);
// Create some image objects...
fputs("pdfioFileCreateImageObj(\"testfiles/color.jpg\"): ", stdout);
if ((color_jpg = pdfioFileCreateImageObj(outpdf, "testfiles/color.jpg", true)) != NULL)
fputs("pdfioFileCreateImageObjFromFile(\"testfiles/color.jpg\"): ", stdout);
if ((color_jpg = pdfioFileCreateImageObjFromFile(outpdf, "testfiles/color.jpg", true)) != NULL)
puts("PASS");
else
return (1);
fputs("pdfioFileCreateImageObj(\"testfiles/gray.jpg\"): ", stdout);
if ((gray_jpg = pdfioFileCreateImageObj(outpdf, "testfiles/gray.jpg", true)) != NULL)
fputs("pdfioFileCreateImageObjFromFile(\"testfiles/gray.jpg\"): ", stdout);
if ((gray_jpg = pdfioFileCreateImageObjFromFile(outpdf, "testfiles/gray.jpg", true)) != NULL)
puts("PASS");
else
return (1);
// Create fonts...
fputs("pdfioFileCreateBaseFontObj(\"Helvetica\"): ", stdout);
if ((helvetica = pdfioFileCreateBaseFontObj(outpdf, "Helvetica")) != NULL)
fputs("pdfioFileCreateFontObjFromBase(\"Helvetica\"): ", stdout);
if ((helvetica = pdfioFileCreateFontObjFromBase(outpdf, "Helvetica")) != NULL)
puts("PASS");
else
return (1);
@ -727,8 +727,8 @@ write_color_test(pdfio_file_t *pdf, // I - PDF file
pdfio_array_t *cs; // Color space array
pdfio_obj_t *prophoto; // ProPhotoRGB ICC profile object
fputs("pdfioFileCreateICCObj(ProPhotoRGB): ", stdout);
if ((prophoto = pdfioFileCreateICCObj(pdf, "testfiles/iso22028-2-romm-rgb.icc", 3)) != NULL)
fputs("pdfioFileCreateICCObjFromFile(ProPhotoRGB): ", stdout);
if ((prophoto = pdfioFileCreateICCObjFromFile(pdf, "testfiles/iso22028-2-romm-rgb.icc", 3)) != NULL)
puts("PASS");
else
return (1);
@ -1429,20 +1429,20 @@ write_png(pdfio_file_t *pdf, // I - PDF file
// Import the PNG test images
fputs("pdfioFileCreateImageObj(\"testfiles/pdfio-color.png\"): ", stdout);
if ((color = pdfioFileCreateImageObj(pdf, "testfiles/pdfio-color.png", false)) != NULL)
fputs("pdfioFileCreateImageObjFromFile(\"testfiles/pdfio-color.png\"): ", stdout);
if ((color = pdfioFileCreateImageObjFromFile(pdf, "testfiles/pdfio-color.png", false)) != NULL)
puts("PASS");
else
return (1);
fputs("pdfioFileCreateImageObj(\"testfiles/pdfio-gray.png\"): ", stdout);
if ((gray = pdfioFileCreateImageObj(pdf, "testfiles/pdfio-gray.png", false)) != NULL)
fputs("pdfioFileCreateImageObjFromFile(\"testfiles/pdfio-gray.png\"): ", stdout);
if ((gray = pdfioFileCreateImageObjFromFile(pdf, "testfiles/pdfio-gray.png", false)) != NULL)
puts("PASS");
else
return (1);
fputs("pdfioFileCreateImageObj(\"testfiles/pdfio-indexed.png\"): ", stdout);
if ((indexed = pdfioFileCreateImageObj(pdf, "testfiles/pdfio-indexed.png", false)) != NULL)
fputs("pdfioFileCreateImageObjFromFile(\"testfiles/pdfio-indexed.png\"): ", stdout);
if ((indexed = pdfioFileCreateImageObjFromFile(pdf, "testfiles/pdfio-indexed.png", false)) != NULL)
puts("PASS");
else
return (1);
@ -1654,8 +1654,8 @@ write_text(pdfio_file_t *pdf, // I - PDF file
// Create text font...
fputs("pdfioFileCreateBaseFontObj(\"Courier\"): ", stdout);
if ((courier = pdfioFileCreateBaseFontObj(pdf, "Courier")) != NULL)
fputs("pdfioFileCreateFontObjFromBase(\"Courier\"): ", stdout);
if ((courier = pdfioFileCreateFontObjFromBase(pdf, "Courier")) != NULL)
puts("PASS");
else
return (1);