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 pdfio_obj_t * // O - Font object
pdfioFileCreateBaseFontObj( pdfioFileCreateFontObjFromBase(
pdfio_file_t *pdf, // I - PDF file pdfio_file_t *pdf, // I - PDF file
const char *name) // I - Font name 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 pdfio_obj_t * // O - Font object
pdfioFileCreateFontObj( pdfioFileCreateFontObjFromFile(
pdfio_file_t *pdf, // I - PDF file pdfio_file_t *pdf, // I - PDF file
const char *filename, // I - Filename const char *filename, // I - Filename
bool unicode) // I - Unicode font? 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 pdfio_obj_t * // O - Object
pdfioFileCreateICCObj( pdfioFileCreateICCObjFromFile(
pdfio_file_t *pdf, // I - PDF file pdfio_file_t *pdf, // I - PDF file
const char *filename, // I - Filename const char *filename, // I - Filename
size_t num_colors) // I - Number of color components (1, 3, or 4) 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 pdfio_obj_t * // O - Object
pdfioFileCreateImageObj( pdfioFileCreateImageObjFromFile(
pdfio_file_t *pdf, // I - PDF file pdfio_file_t *pdf, // I - PDF file
const char *filename, // I - Filename const char *filename, // I - Filename
bool interpolate) // I - Interpolate image data? 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; extern bool pdfioContentTextShowJustified(pdfio_stream_t *st, size_t num_fragments, const double *offsets, const char * const *fragments) PDFIO_PUBLIC;
// Resource helpers... // Resource helpers...
extern pdfio_obj_t *pdfioFileCreateBaseFontObj(pdfio_file_t *pdf, const char *name) PDFIO_PUBLIC; extern pdfio_obj_t *pdfioFileCreateFontObjFromBase(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 *pdfioFileCreateFontObjFromFile(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 *pdfioFileCreateICCObjFromFile(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 *pdfioFileCreateImageObjFromFile(pdfio_file_t *pdf, const char *filename, bool interpolate) PDFIO_PUBLIC;
// Image object helpers... // Image object helpers...
extern size_t pdfioImageGetBytesPerLine(pdfio_obj_t *obj) PDFIO_PUBLIC; extern size_t pdfioImageGetBytesPerLine(pdfio_obj_t *obj) PDFIO_PUBLIC;

View File

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