summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-09-20 22:52:43 +0200
committerChromium commit bot <commit-bot@chromium.org>2017-09-20 21:04:08 +0000
commit36eed87d19e741be9909500c45dd12e50ff6a1ab (patch)
tree7311bbf0ba29245308ca79b34acb22086d6cbdd0 /public
parent0c2e705f8d8dec68c1afc8344872fe8bee527c48 (diff)
downloadpdfium-36eed87d19e741be9909500c45dd12e50ff6a1ab.tar.xz
Add FPDFPath_GetPoint() APIchromium/3221
Combined with the previously added FPDFPath_CountPoint(), this allows getting the coordinates of all points of a path. Change-Id: Ic969723d4b01ee427498d38ce323c74147b87a9c Reviewed-on: https://pdfium-review.googlesource.com/14111 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'public')
-rw-r--r--public/fpdf_edit.h46
-rw-r--r--public/fpdfview.h1
2 files changed, 47 insertions, 0 deletions
diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
index 9ee11cb5ec..d73a740efd 100644
--- a/public/fpdf_edit.h
+++ b/public/fpdf_edit.h
@@ -42,6 +42,12 @@
#define FPDF_PAGEOBJ_SHADING 4
#define FPDF_PAGEOBJ_FORM 5
+// The path segment constants.
+#define FPDF_SEGMENT_UNKNOWN -1
+#define FPDF_SEGMENT_LINETO 0
+#define FPDF_SEGMENT_BEZIERTO 1
+#define FPDF_SEGMENT_MOVETO 2
+
#define FPDF_FILLMODE_ALTERNATE 1
#define FPDF_FILLMODE_WINDING 2
@@ -552,6 +558,7 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetFillColor(FPDF_PAGEOBJECT path,
unsigned int* B,
unsigned int* A);
+// Experimental API.
// Get number of point objects inside |path|.
//
// path - handle to a path.
@@ -562,6 +569,45 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetFillColor(FPDF_PAGEOBJECT path,
// Returns the number of objects in |path| or -1 on failure.
FPDF_EXPORT int FPDF_CALLCONV FPDFPath_CountPoint(FPDF_PAGEOBJECT path);
+// Experimental API.
+// Get segment in |path| at |index|.
+//
+// path - handle to a path.
+// index - the index of a segment.
+//
+// Returns the handle to the segment, or NULL on faiure.
+FPDF_EXPORT FPDF_PATHSEGMENT FPDF_CALLCONV
+FPDFPath_GetPathSegment(FPDF_PAGEOBJECT path, int index);
+
+// Experimental API.
+// Get coordinates of |segment|.
+//
+// segment - handle to a segment.
+// x - the horizontal position of the segment.
+// y - the vertical position of the segment.
+//
+// Returns TRUE on success, otherwise |x| and |y| is not set.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPathSegment_GetPoint(FPDF_PATHSEGMENT segment, float* x, float* y);
+
+// Experimental API.
+// Get type of |segment|.
+//
+// segment - handle to a segment.
+//
+// Returns one of the FPDF_SEGMENT_* values on success,
+// FPDF_SEGMENT_UNKNOWN on error.
+FPDF_EXPORT int FPDF_CALLCONV FPDFPathSegment_GetType(FPDF_PATHSEGMENT segment);
+
+// Experimental API.
+// Gets if the |segment| closes the current subpath of a given path.
+//
+// segment - handle to a segment.
+//
+// Returns close flag for non-NULL segment, FALSE otherwise.
+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
+FPDFPathSegment_GetClose(FPDF_PATHSEGMENT segment);
+
// Move a path's current point.
//
// path - the handle to the path object.
diff --git a/public/fpdfview.h b/public/fpdfview.h
index 135d00a8f4..3f180335d3 100644
--- a/public/fpdfview.h
+++ b/public/fpdfview.h
@@ -52,6 +52,7 @@ typedef void* FPDF_SCHHANDLE;
typedef void* FPDF_STRUCTELEMENT;
typedef void* FPDF_STRUCTTREE;
typedef void* FPDF_TEXTPAGE;
+typedef void const* FPDF_PATHSEGMENT;
#ifdef PDF_ENABLE_XFA
typedef void* FPDF_STRINGHANDLE;