From c891034694394dda17687a46f319c917f68b2a71 Mon Sep 17 00:00:00 2001
From: Kent Barber <kent@gamelogicdesign.com>
Date: Mon, 21 May 2018 11:07:16 +1200
Subject: [PATCH] Added 3D transparent background flag

---
 include/hpdf.h            | 1 +
 include/hpdf_annotation.h | 1 +
 src/hpdf_annotation.c     | 4 ++++
 src/hpdf_pages.c          | 3 ++-
 4 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/hpdf.h b/include/hpdf.h
index 1cf0dd9..ef37280 100644
--- a/include/hpdf.h
+++ b/include/hpdf.h
@@ -476,6 +476,7 @@ HPDF_Page_Create3DAnnot    (HPDF_Page       page,
 							HPDF_Rect       rect,
                             HPDF_BOOL       tb,
                             HPDF_BOOL       np,
+                            HPDF_BOOL       tr,
                             HPDF_U3D        u3d,
                             HPDF_Image      ap);
 
diff --git a/include/hpdf_annotation.h b/include/hpdf_annotation.h
index 66e28e6..b5fa1fd 100644
--- a/include/hpdf_annotation.h
+++ b/include/hpdf_annotation.h
@@ -59,6 +59,7 @@ HPDF_3DAnnot_New  (HPDF_MMgr        mmgr,
                    HPDF_Rect        rect,
                    HPDF_BOOL        tb,
                    HPDF_BOOL        np,
+                   HPDF_BOOL        tr,
                    HPDF_U3D         u3d,
                    HPDF_Image       ap);
 
diff --git a/src/hpdf_annotation.c b/src/hpdf_annotation.c
index 4bb9e13..e6d9dd9 100644
--- a/src/hpdf_annotation.c
+++ b/src/hpdf_annotation.c
@@ -416,6 +416,7 @@ HPDF_3DAnnot_New    (HPDF_MMgr        mmgr,
                      HPDF_Rect        rect,
                      HPDF_BOOL        tb,
                      HPDF_BOOL        np,
+                     HPDF_BOOL        tr,
                      HPDF_U3D         u3d,
                      HPDF_Image       ap)
 {
@@ -458,6 +459,9 @@ HPDF_3DAnnot_New    (HPDF_MMgr        mmgr,
     // enable visibility of Navigation Panel
     ret += HPDF_Dict_AddBoolean(action, "NP", np);
 
+    // enable transparent background
+    ret += HPDF_Dict_AddBoolean(action, "Transparent", tr);
+
     // Set behavior of Annotation on Disabling
     ret += HPDF_Dict_AddName(action, "DIS", "U");
 
diff --git a/src/hpdf_pages.c b/src/hpdf_pages.c
index 1dc2da0..25c2962 100644
--- a/src/hpdf_pages.c
+++ b/src/hpdf_pages.c
@@ -1687,6 +1687,7 @@ HPDF_Page_Create3DAnnot    (HPDF_Page       page,
                             HPDF_Rect       rect,
                             HPDF_BOOL       tb,
                             HPDF_BOOL       np,
+                            HPDF_BOOL       tr,
                             HPDF_U3D        u3d,
                             HPDF_Image      ap)
 {
@@ -1700,7 +1701,7 @@ HPDF_Page_Create3DAnnot    (HPDF_Page       page,
 
     attr = (HPDF_PageAttr)page->attr;
 
-    annot = HPDF_3DAnnot_New (page->mmgr, attr->xref, rect, tb, np, u3d, ap);
+    annot = HPDF_3DAnnot_New (page->mmgr, attr->xref, rect, tb, np, tr, u3d, ap);
     if (annot) {
         if (AddAnnotation (page, annot) != HPDF_OK) {
             HPDF_CheckError (page->error);
-- 
2.21.1 (Apple Git-122.3)

