From ed4705b4db1405a5abef99ad1b2725eee65fedf8 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 5 Apr 2017 09:24:50 +0200 Subject: Add public method FPDFPath_GetFillColor to get fill color of a path object. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was already possible to set the fill color, this is the other direction. Change-Id: Id53f3c9969ca036ec1f9383a2cdbaf224395215f Reviewed-on: https://pdfium-review.googlesource.com/3690 Commit-Queue: Nicolás Peña Reviewed-by: Nicolás Peña --- fpdfsdk/fpdfeditpath.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'fpdfsdk/fpdfeditpath.cpp') diff --git a/fpdfsdk/fpdfeditpath.cpp b/fpdfsdk/fpdfeditpath.cpp index f085ed3481..155dda5c7d 100644 --- a/fpdfsdk/fpdfeditpath.cpp +++ b/fpdfsdk/fpdfeditpath.cpp @@ -66,6 +66,24 @@ DLLEXPORT FPDF_BOOL FPDFPath_SetFillColor(FPDF_PAGEOBJECT path, return true; } +DLLEXPORT FPDF_BOOL FPDFPath_GetFillColor(FPDF_PAGEOBJECT path, + unsigned int* R, + unsigned int* G, + unsigned int* B, + unsigned int* A) { + if (!path || !R || !G || !B || !A) + return false; + + auto* pPathObj = reinterpret_cast(path); + uint32_t fillRGB = pPathObj->m_ColorState.GetFillRGB(); + *R = FXSYS_GetRValue(fillRGB); + *G = FXSYS_GetGValue(fillRGB); + *B = FXSYS_GetBValue(fillRGB); + *A = static_cast(pPathObj->m_GeneralState.GetFillAlpha() * + 255.f); + return true; +} + DLLEXPORT FPDF_BOOL FPDFPath_MoveTo(FPDF_PAGEOBJECT path, float x, float y) { if (!path) return false; -- cgit v1.2.3