Basic APIs and tests for extracting and setting annotation paths

1. Added APIs for retrieving existing annotation paths and setting
annotation paths.
    * Added an embedder test testing all the new functions.

Bug=pdfium:737

Change-Id: Ic451bcd3be488261baf2182549c4238b887b219e
Reviewed-on: https://pdfium-review.googlesource.com/6676
Commit-Queue: Jane Liu <janeliulwq@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
diff --git a/public/fpdf_annot.h b/public/fpdf_annot.h
index 9e349bd..89edd01 100644
--- a/public/fpdf_annot.h
+++ b/public/fpdf_annot.h
@@ -55,10 +55,9 @@
   FPDFANNOT_TEXTTYPE_Author
 } FPDFANNOT_TEXTTYPE;
 
-// Check if an annotation subtype is currently supported for creating and
-// displaying. The supported subtypes must be consistent with the ones supported
-// by AP generation - see the list of calls to CPVT_GenerateAP::Generate*AP() in
-// CPDF_Annot::GenerateAPIfNeeded().
+// Check if an annotation subtype is currently supported for creation.
+// Currently supported subtypes: circle, highlight, ink, popup, square,
+// squiggly, stamp, strikeout, text, and underline.
 //
 //   subtype   - the subtype to be checked.
 //
@@ -68,6 +67,8 @@
 
 // Create an annotation in |page| of the subtype |subtype|. If the specified
 // subtype is illegal or unsupported, then a new annotation will not be created.
+// Must call FPDFPage_CloseAnnot() when the annotation returned by this
+// function is no longer needed.
 //
 //   page      - handle to a page.
 //   subtype   - the subtype of the new annotation.
@@ -83,7 +84,8 @@
 // Returns the number of annotations in |page|.
 DLLEXPORT int STDCALL FPDFPage_GetAnnotCount(FPDF_PAGE page);
 
-// Get annotation in |page| at |index|.
+// Get annotation in |page| at |index|. Must call FPDFPage_CloseAnnot() when the
+// annotation returned by this function is no longer needed.
 //
 //   page  - handle to a page.
 //   index - the index of the annotation.
@@ -114,6 +116,49 @@
 DLLEXPORT FPDF_ANNOTATION_SUBTYPE STDCALL
 FPDFAnnot_GetSubtype(FPDF_ANNOTATION annot);
 
+// Experimental API.
+// Update |path| in |annot|. |path| must be in |annot| already and must have
+// been retrieved by FPDFAnnot_GetPathObject(). Only ink and stamp annotations
+// are supported currently.
+//
+//   annot  - handle to an annotation.
+//   path   - handle to the path that |annot| needs to update.
+//
+// Return true if successful.
+DLLEXPORT FPDF_BOOL STDCALL FPDFAnnot_UpdatePathObject(FPDF_ANNOTATION annot,
+                                                       FPDF_PAGEOBJECT path);
+
+// Experimental API.
+// Add |path| to |annot|. |path| must have been created by
+// FPDFPageObj_CreateNewPath(), and will be owned by |annot|. Note that a |path|
+// cannot belong to more than one |annot|. Only ink and stamp annotations
+// are supported currently.
+//
+//   annot  - handle to an annotation.
+//   path   - handle to the path that is to be added to |annot|.
+//
+// Return true if successful.
+DLLEXPORT FPDF_BOOL STDCALL FPDFAnnot_AppendPathObject(FPDF_ANNOTATION annot,
+                                                       FPDF_PAGEOBJECT path);
+
+// Experimental API.
+// Get the number of path objects in |annot|.
+//
+//   annot  - handle to an annotation.
+//
+// Returns the number of path objects in |annot|.
+DLLEXPORT int STDCALL FPDFAnnot_GetPathObjectCount(FPDF_ANNOTATION annot);
+
+// Experimental API.
+// Get the path object in |annot| at |index|.
+//
+//   annot  - handle to an annotation.
+//   index  - the index of the path object.
+//
+// Return a handle to the path object, or NULL on failure.
+DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFAnnot_GetPathObject(FPDF_ANNOTATION annot,
+                                                          int index);
+
 // Set the color of an annotation. Fails when called on annotations with
 // appearance streams already defined; instead use
 // FPDFPath_Set{Stroke|Fill}Color().