summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorJane Liu <janeliulwq@google.com>2017-08-03 16:33:40 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-03 21:20:23 +0000
commit548334e57cae1039824d3db97bab5348fbe674e2 (patch)
tree5c547cc35c48fe5703fde77afd208f1bd1d01029 /public
parent6a5b7872c838ba9e24ea6e1f9a306bb95a80ae6c (diff)
downloadpdfium-548334e57cae1039824d3db97bab5348fbe674e2.tar.xz
APIs and tests for retrieving raw/decoded data from image objects
Added FPDFImageObj_GetImageDataDecoded() for retrieving the uncompressed data of an image, and FPDFImageObj_GetImageDataRaw() for retrieving the raw data of an image. * Refactored out DecodeStreamMaybeCopyAndReturnLength(), which is used to decode both attachment data and image data. * Within DecodeStreamMaybeCopyAndReturnLength(), used a different decoder function which takes care of multiple filters if exist. As a result, CPDF_StreamParser::DecodeInlineStream() which was made static previously is now moved back into namespace. Bug=pdfium:677 Change-Id: I22a22c99acaca98ef8c15f88911f2646a2c854d5 Reviewed-on: https://pdfium-review.googlesource.com/9811 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'public')
-rw-r--r--public/fpdf_edit.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
index e5607d1716..dc710b5f52 100644
--- a/public/fpdf_edit.h
+++ b/public/fpdf_edit.h
@@ -298,6 +298,35 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,
DLLEXPORT FPDF_BITMAP STDCALL
FPDFImageObj_GetBitmap(FPDF_PAGEOBJECT image_object);
+// Get the decoded image data of |image_object|. The decoded data is the
+// uncompressed image data, i.e. the raw image data after having all filters
+// applied. |buffer| is only modified if |buflen| is longer than the length of
+// the decoded image data.
+//
+// image_object - handle to an image object.
+// buffer - buffer for holding the decoded image data in raw bytes.
+// buflen - length of the buffer.
+//
+// Returns the length of the decoded image data.
+DLLEXPORT unsigned long STDCALL
+FPDFImageObj_GetImageDataDecoded(FPDF_PAGEOBJECT image_object,
+ void* buffer,
+ unsigned long buflen);
+
+// Get the raw image data of |image_object|. The raw data is the image data as
+// stored in the PDF without applying any filters. |buffer| is only modified if
+// |buflen| is longer than the length of the raw image data.
+//
+// image_object - handle to an image object.
+// buffer - buffer for holding the raw image data in raw bytes.
+// buflen - length of the buffer.
+//
+// Returns the length of the raw image data.
+DLLEXPORT unsigned long STDCALL
+FPDFImageObj_GetImageDataRaw(FPDF_PAGEOBJECT image_object,
+ void* buffer,
+ unsigned long buflen);
+
// Create a new path object at an initial position.
//
// x - initial horizontal position.