summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwileyrya <wileyrr@gmail.com>2017-05-26 12:27:40 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-05-26 19:03:59 +0000
commitf1697fa06b9fae75dd1c0782f5a721795cfc4a0c (patch)
tree3398b273dfc2b3eb0e6e383b42e9a4b5a61ef314
parent169b30187bf5798a6106b5ab16288c9d86861f8b (diff)
downloadpdfium-f1697fa06b9fae75dd1c0782f5a721795cfc4a0c.tar.xz
Add public API for getting the bounds of a page object.
BUG=pdfium:721 R=npm@chromium.org Change-Id: I71b6281346b3ed67f6b8703eccd7794588559819 Reviewed-on: https://pdfium-review.googlesource.com/6013 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
-rw-r--r--fpdfsdk/fpdfeditpage.cpp17
-rw-r--r--public/fpdf_edit.h15
2 files changed, 32 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp
index 2c58caf6db..37469ed23a 100644
--- a/fpdfsdk/fpdfeditpage.cpp
+++ b/fpdfsdk/fpdfeditpage.cpp
@@ -320,3 +320,20 @@ FPDF_BOOL FPDFPageObj_SetFillColor(FPDF_PAGEOBJECT page_object,
CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3);
return true;
}
+
+DLLEXPORT FPDF_BOOL STDCALL FPDFPageObj_GetBounds(FPDF_PAGEOBJECT pageObject,
+ float* left,
+ float* bottom,
+ float* right,
+ float* top) {
+ if (!pageObject)
+ return false;
+
+ CPDF_PageObject* pPageObj = static_cast<CPDF_PageObject*>(pageObject);
+ CFX_FloatRect bbox = pPageObj->GetRect();
+ *left = bbox.left;
+ *bottom = bbox.bottom;
+ *right = bbox.right;
+ *top = bbox.top;
+ return true;
+}
diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
index 904231f09f..677bdb28d3 100644
--- a/public/fpdf_edit.h
+++ b/public/fpdf_edit.h
@@ -296,6 +296,21 @@ DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_CreateNewRect(float x,
float w,
float h);
+// Get the bounding box of |pageObject|.
+//
+// pageObject - handle to a page object.
+// left - pointer where the left coordinate will be stored
+// bottom - pointer where the bottom coordinate will be stored
+// right - pointer where the right coordinate will be stored
+// top - pointer where the top coordinate will be stored
+//
+// Returns TRUE on success.
+DLLEXPORT FPDF_BOOL STDCALL FPDFPageObj_GetBounds(FPDF_PAGEOBJECT pageObject,
+ float* left,
+ float* bottom,
+ float* right,
+ float* top);
+
// Set the stroke RGBA of a path. Range of values: 0 - 255.
//
// path - the handle to the path object.