summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/fpdf_edit_embeddertest.cpp5
-rw-r--r--fpdfsdk/fpdf_editpage.cpp10
-rw-r--r--fpdfsdk/fpdf_view_c_api_test.c1
-rw-r--r--public/fpdf_edit.h10
4 files changed, 26 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index a20faeba80..2a3a7768ff 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -755,6 +755,11 @@ TEST_F(FPDFEditEmbeddertest, AddStrokedPaths) {
EXPECT_TRUE(FPDFPath_SetFillColor(rect, 255, 0, 0, 255));
EXPECT_TRUE(FPDFPath_SetStrokeColor(rect, 0, 255, 0, 255));
EXPECT_TRUE(FPDFPath_SetStrokeWidth(rect, 15.0f));
+
+ float width = 0;
+ EXPECT_TRUE(FPDFPageObj_GetStrokeWidth(rect, &width));
+ EXPECT_EQ(15.0f, width);
+
EXPECT_TRUE(FPDFPath_SetDrawMode(rect, 0, 1));
FPDFPage_InsertObject(page, rect);
{
diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
index 1a9198b291..ea4659f54a 100644
--- a/fpdfsdk/fpdf_editpage.cpp
+++ b/fpdfsdk/fpdf_editpage.cpp
@@ -592,6 +592,16 @@ FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width) {
}
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_GetStrokeWidth(FPDF_PAGEOBJECT page_object, float* width) {
+ auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object);
+ if (!pPageObj || !width)
+ return false;
+
+ *width = pPageObj->m_GraphState.GetLineWidth();
+ return true;
+}
+
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDFPageObj_SetLineJoin(FPDF_PAGEOBJECT page_object, int line_join) {
if (!page_object)
return false;
diff --git a/fpdfsdk/fpdf_view_c_api_test.c b/fpdfsdk/fpdf_view_c_api_test.c
index 15d893d77c..946e415077 100644
--- a/fpdfsdk/fpdf_view_c_api_test.c
+++ b/fpdfsdk/fpdf_view_c_api_test.c
@@ -170,6 +170,7 @@ int CheckPDFiumCApi() {
CHK(FPDFPath_GetStrokeColor);
CHK(FPDFPageObj_GetStrokeColor);
CHK(FPDFPath_SetStrokeWidth);
+ CHK(FPDFPageObj_GetStrokeWidth);
CHK(FPDFPageObj_SetStrokeWidth);
CHK(FPDFPath_SetFillColor);
CHK(FPDFPageObj_SetFillColor);
diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
index 6eca64fde1..c950e2fa72 100644
--- a/public/fpdf_edit.h
+++ b/public/fpdf_edit.h
@@ -687,6 +687,16 @@ FPDFPath_SetStrokeWidth(FPDF_PAGEOBJECT path, float width);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width);
+// Experimental API.
+// Get the stroke width of a page object.
+//
+// path - the handle to the page object.
+// width - the width of the stroke.
+//
+// Returns TRUE on success
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPageObj_GetStrokeWidth(FPDF_PAGEOBJECT page_object, float* width);
+
// DEPRECATED as of May 2018. This API will be removed in the future. Please
// use FPDFPageObj_SetLineJoin instead.
//