From f912b5deb5e0db286d6d203b73c189d67cf7534f Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 22 May 2018 14:27:29 +0000 Subject: [PATCH] Add FPDFPageObj_GetStrokeWidth() API It was already possible to set the stroke width of a page object, this is the other direction. Change-Id: I5c4681b232768fc928bc7a169f223877284d4812 Reviewed-on: https://pdfium-review.googlesource.com/32770 Reviewed-by: dsinclair Commit-Queue: dsinclair --- fpdfsdk/fpdf_editpage.cpp | 10 ++++++++++ public/fpdf_edit.h | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp index 1a98f3d7c..83703c3e0 100644 --- a/fpdfsdk/fpdf_editpage.cpp +++ b/fpdfsdk/fpdf_editpage.cpp @@ -593,6 +593,16 @@ FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width) { return true; } +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) diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h index fa9902ee9..49018df05 100644 --- a/public/fpdf_edit.h +++ b/public/fpdf_edit.h @@ -678,6 +678,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); + // Set the line join of |page_object|. // // page_object - handle to a page object. -- 2.16.4