From 55e026b7b6eec17b012c819c4a7d39e63094b5c4 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Tue, 7 Feb 2017 14:59:23 -0500 Subject: Add APIs for path construction and painting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added methods to create paths, set their colors, determine whether they will be stroked and/or filled. FPDFPage_InsertObject should be used to add a path to a page. BUG=pdfium:661 Change-Id: I8fd17b33a09c5126e517bfd1a69a893216c160e8 Reviewed-on: https://pdfium-review.googlesource.com/2534 Reviewed-by: Tom Sepez Commit-Queue: Nicolás Peña --- core/fpdfapi/page/cpdf_path.cpp | 10 ++++++++++ core/fpdfapi/page/cpdf_path.h | 1 + 2 files changed, 11 insertions(+) (limited to 'core/fpdfapi/page') diff --git a/core/fpdfapi/page/cpdf_path.cpp b/core/fpdfapi/page/cpdf_path.cpp index 8151ae46d7..96d6b72abb 100644 --- a/core/fpdfapi/page/cpdf_path.cpp +++ b/core/fpdfapi/page/cpdf_path.cpp @@ -67,3 +67,13 @@ void CPDF_Path::AppendRect(FX_FLOAT left, FX_FLOAT top) { m_Ref.GetPrivateCopy()->AppendRect(left, bottom, right, top); } + +void CPDF_Path::AppendPoint(FX_FLOAT x, + FX_FLOAT y, + FXPT_TYPE type, + bool close) { + CFX_PathData data; + data.SetPointCount(1); + data.SetPoint(0, x, y, type, close); + Append(&data, nullptr); +} diff --git a/core/fpdfapi/page/cpdf_path.h b/core/fpdfapi/page/cpdf_path.h index 252be2673c..21a94becac 100644 --- a/core/fpdfapi/page/cpdf_path.h +++ b/core/fpdfapi/page/cpdf_path.h @@ -38,6 +38,7 @@ class CPDF_Path { void Append(const CPDF_Path& other, const CFX_Matrix* pMatrix); void Append(const CFX_PathData* pData, const CFX_Matrix* pMatrix); void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top); + void AppendPoint(FX_FLOAT x, FX_FLOAT y, FXPT_TYPE type, bool close); // TODO(tsepez): Remove when all access thru this class. const CFX_PathData* GetObject() const { return m_Ref.GetObject(); } -- cgit v1.2.3