Bug#893921: libharu: add support for free-form triangle shading objects

2018-03-23 Thread Kyle Edwards
We have not submitted this patch to any other distros, and none that we 
know of have included it (I don't see it in Ubuntu or RedHat.) Would it 
be acceptable for us to create a "For Debian" branch on our Gitlab 
libharu repository so you can pull from that?



On 03/23/2018 03:41 PM, Johan Van de Wauw wrote:

Pull request with discussion here:
https://github.com/libharu/libharu/pull/157

Has this been implemented by other distro's?

If kitware can support VTK, perhaps they can invest some time in 
proposing a new release with some of the other pull requests? I think 
this is a better way forward for the community than having maintainers 
of different distro's having to add patches to support features.


On Fri, Mar 23, 2018 at 8:19 PM, Kyle Edwards 
> wrote:


Source: libharu
Severity: wishlist
Tags: patch

Dear Maintainer,

I am working on an official Kitware-supported Debian/Ubuntu
package for
the upcoming VTK 9. We are using a custom shading feature developed
in-house for libharu. We have submitted our changes upstream, but the
project has been abandoned and the patch will most likely never be
accepted. Please backport the included patch so that we can bring
VTK 9
to Debian. Thank you for your support.


***
patches/0001-Add-support-for-free-form-triangle-Shading-objects.patch
From 9e8ba2f5453552909e52fde5ec30856004a616d0 Mon Sep 17 00:00:00 2001
From: "David C. Lonie" >
Date: Wed, 10 May 2017 11:07:28 -0400
Subject: [PATCH] Add support for free-form triangle Shading objects.

---
 include/hpdf.h           |  24 -
 include/hpdf_error.h     |   3 +
 include/hpdf_objects.h   |   2 +
 include/hpdf_pages.h     |   5 +
 include/hpdf_types.h     |  14 +++
 src/CMakeLists.txt       |   1 +
 src/hpdf_page_operator.c |  31 +++
 src/hpdf_pages.c         |  55 ++-
 src/hpdf_shading.c       | 231
+++
 9 files changed, 362 insertions(+), 4 deletions(-)
 create mode 100644 src/hpdf_shading.c

diff --git a/include/hpdf.h b/include/hpdf.h
index e369f67..40e3c41 100644
--- a/include/hpdf.h
+++ b/include/hpdf.h
@@ -77,6 +77,7 @@ typedef HPDF_HANDLE   HPDF_Dict;
 typedef HPDF_HANDLE   HPDF_EmbeddedFile;
 typedef HPDF_HANDLE   HPDF_OutputIntent;
 typedef HPDF_HANDLE   HPDF_Xref;
+typedef HPDF_HANDLE   HPDF_Shading;

 #else

@@ -1171,6 +1172,11 @@ HPDF_EXPORT(HPDF_STATUS)
 HPDF_Page_SetExtGState  (HPDF_Page        page,
                          HPDF_ExtGState   ext_gstate);

+/* sh */
+HPDF_EXPORT(HPDF_STATUS)
+HPDF_Page_SetShading  (HPDF_Page    page,
+                       HPDF_Shading shading);
+

 /*--- Special graphic state operator
--*/

@@ -1450,7 +1456,23 @@ HPDF_Page_SetCMYKStroke  (HPDF_Page page,

 /*--- Shading patterns
---*/

-/* sh --not implemented yet */
+/* Notes for docs:
+ * - ShadingType must be HPDF_SHADING_FREE_FORM_TRIANGLE_MESH
(the only
+ *   defined option...)
+ * - colorSpace must be HPDF_CS_DEVICE_RGB for now.
+ */
+HPDF_EXPORT(HPDF_Shading)
+HPDF_Shading_New  (HPDF_Doc         pdf,
+                   HPDF_ShadingType type,
+                   HPDF_ColorSpace  colorSpace,
+                   HPDF_REAL xMin, HPDF_REAL xMax,
+                   HPDF_REAL yMin, HPDF_REAL yMax);
+
+HPDF_EXPORT(HPDF_STATUS)
+HPDF_Shading_AddVertexRGB(HPDF_Shading shading,
+                         
HPDF_Shading_FreeFormTriangleMeshEdgeFlag edgeFlag,
+                          HPDF_REAL x, HPDF_REAL y,
+                          HPDF_UINT8 r, HPDF_UINT8 g, HPDF_UINT8 b);

 /*--- In-line images
-*/

diff --git a/include/hpdf_error.h b/include/hpdf_error.h
index b04e2cd..ef4fa61 100644
--- a/include/hpdf_error.h
+++ b/include/hpdf_error.h
@@ -145,6 +145,9 @@ extern "C" {
 #define HPDF_INVALID_U3D_DATA                     0x1083
 #define HPDF_NAME_CANNOT_GET_NAMES                0x1084
 #define HPDF_INVALID_ICC_COMPONENT_NUM            0x1085
+/*                                                0x1086 */
+/*                                                0x1087 */
+#define HPDF_INVALID_SHADING_TYPE                 0x1088

 
/*---*/

diff --git a/include/hpdf_objects.h b/include/hpdf_objects.h
index 525adda..b16de02 100644
--- a/include/hpdf_objects.h
+++ b/include/hpdf_objects.h
@@ -61,6 +61,7 @@ extern "C" {
 #define  HPDF_OSUBCLASS_EXT_GSTATE_R  0x0B00  /* read only 

Bug#893921: libharu: add support for free-form triangle shading objects

2018-03-23 Thread Johan Van de Wauw
Pull request with discussion here:
https://github.com/libharu/libharu/pull/157

Has this been implemented by other distro's?

If kitware can support VTK, perhaps they can invest some time in proposing
a new release with some of the other pull requests? I think this is a
better way forward for the community than having maintainers of different
distro's having to add patches to support features.

On Fri, Mar 23, 2018 at 8:19 PM, Kyle Edwards 
wrote:

> Source: libharu
> Severity: wishlist
> Tags: patch
>
> Dear Maintainer,
>
> I am working on an official Kitware-supported Debian/Ubuntu package for
> the upcoming VTK 9. We are using a custom shading feature developed
> in-house for libharu. We have submitted our changes upstream, but the
> project has been abandoned and the patch will most likely never be
> accepted. Please backport the included patch so that we can bring VTK 9
> to Debian. Thank you for your support.
>
>
> *** patches/0001-Add-support-for-free-form-triangle-Shading-objects.patch
> From 9e8ba2f5453552909e52fde5ec30856004a616d0 Mon Sep 17 00:00:00 2001
> From: "David C. Lonie" 
> Date: Wed, 10 May 2017 11:07:28 -0400
> Subject: [PATCH] Add support for free-form triangle Shading objects.
>
> ---
>  include/hpdf.h   |  24 -
>  include/hpdf_error.h |   3 +
>  include/hpdf_objects.h   |   2 +
>  include/hpdf_pages.h |   5 +
>  include/hpdf_types.h |  14 +++
>  src/CMakeLists.txt   |   1 +
>  src/hpdf_page_operator.c |  31 +++
>  src/hpdf_pages.c |  55 ++-
>  src/hpdf_shading.c   | 231 ++
> +
>  9 files changed, 362 insertions(+), 4 deletions(-)
>  create mode 100644 src/hpdf_shading.c
>
> diff --git a/include/hpdf.h b/include/hpdf.h
> index e369f67..40e3c41 100644
> --- a/include/hpdf.h
> +++ b/include/hpdf.h
> @@ -77,6 +77,7 @@ typedef HPDF_HANDLE   HPDF_Dict;
>  typedef HPDF_HANDLE   HPDF_EmbeddedFile;
>  typedef HPDF_HANDLE   HPDF_OutputIntent;
>  typedef HPDF_HANDLE   HPDF_Xref;
> +typedef HPDF_HANDLE   HPDF_Shading;
>
>  #else
>
> @@ -1171,6 +1172,11 @@ HPDF_EXPORT(HPDF_STATUS)
>  HPDF_Page_SetExtGState  (HPDF_Pagepage,
>   HPDF_ExtGState   ext_gstate);
>
> +/* sh */
> +HPDF_EXPORT(HPDF_STATUS)
> +HPDF_Page_SetShading  (HPDF_Pagepage,
> +   HPDF_Shading shading);
> +
>
>  /*--- Special graphic state operator --
> */
>
> @@ -1450,7 +1456,23 @@ HPDF_Page_SetCMYKStroke  (HPDF_Page  page,
>
>  /*--- Shading patterns --
> -*/
>
> -/* sh --not implemented yet */
> +/* Notes for docs:
> + * - ShadingType must be HPDF_SHADING_FREE_FORM_TRIANGLE_MESH (the only
> + *   defined option...)
> + * - colorSpace must be HPDF_CS_DEVICE_RGB for now.
> + */
> +HPDF_EXPORT(HPDF_Shading)
> +HPDF_Shading_New  (HPDF_Doc pdf,
> +   HPDF_ShadingType type,
> +   HPDF_ColorSpace  colorSpace,
> +   HPDF_REAL xMin, HPDF_REAL xMax,
> +   HPDF_REAL yMin, HPDF_REAL yMax);
> +
> +HPDF_EXPORT(HPDF_STATUS)
> +HPDF_Shading_AddVertexRGB(HPDF_Shading shading,
> +  HPDF_Shading_FreeFormTriangleMeshEdgeFlag
> edgeFlag,
> +  HPDF_REAL x, HPDF_REAL y,
> +  HPDF_UINT8 r, HPDF_UINT8 g, HPDF_UINT8 b);
>
>  /*--- In-line images --
> ---*/
>
> diff --git a/include/hpdf_error.h b/include/hpdf_error.h
> index b04e2cd..ef4fa61 100644
> --- a/include/hpdf_error.h
> +++ b/include/hpdf_error.h
> @@ -145,6 +145,9 @@ extern "C" {
>  #define HPDF_INVALID_U3D_DATA 0x1083
>  #define HPDF_NAME_CANNOT_GET_NAMES0x1084
>  #define HPDF_INVALID_ICC_COMPONENT_NUM0x1085
> +/*0x1086 */
> +/*0x1087 */
> +#define HPDF_INVALID_SHADING_TYPE 0x1088
>
>  /*--
> -*/
>
> diff --git a/include/hpdf_objects.h b/include/hpdf_objects.h
> index 525adda..b16de02 100644
> --- a/include/hpdf_objects.h
> +++ b/include/hpdf_objects.h
> @@ -61,6 +61,7 @@ extern "C" {
>  #define  HPDF_OSUBCLASS_EXT_GSTATE_R  0x0B00  /* read only object */
>  #define  HPDF_OSUBCLASS_NAMEDICT  0x0C00
>  #define  HPDF_OSUBCLASS_NAMETREE  0x0D00
> +#define  HPDF_OSUBCLASS_SHADING   0x0E00
>
>
>
> @@ -595,6 +596,7 @@ typedef HPDF_Array HPDF_Destination;
>  typedef HPDF_Dict  HPDF_U3D;
>  typedef HPDF_Dict  HPDF_OutputIntent;
>  typedef HPDF_Dict  HPDF_JavaScript;
> +typedef HPDF_Dict  HPDF_Shading;
>
>  #ifdef __cplusplus
>  }
> diff --git a/include/hpdf_pages.h b/include/hpdf_pages.h
> index 44b816c..60b1d84 100644
> --- a/include/hpdf_pages.h
> +++ b/include/hpdf_pages.h
> @@ -55,6 +55,7 

Bug#893921: libharu: add support for free-form triangle shading objects

2018-03-23 Thread Kyle Edwards
Source: libharu
Severity: wishlist
Tags: patch

Dear Maintainer,

I am working on an official Kitware-supported Debian/Ubuntu package for
the upcoming VTK 9. We are using a custom shading feature developed
in-house for libharu. We have submitted our changes upstream, but the
project has been abandoned and the patch will most likely never be
accepted. Please backport the included patch so that we can bring VTK 9
to Debian. Thank you for your support.


*** patches/0001-Add-support-for-free-form-triangle-Shading-objects.patch
>From 9e8ba2f5453552909e52fde5ec30856004a616d0 Mon Sep 17 00:00:00 2001
From: "David C. Lonie" 
Date: Wed, 10 May 2017 11:07:28 -0400
Subject: [PATCH] Add support for free-form triangle Shading objects.

---
 include/hpdf.h   |  24 -
 include/hpdf_error.h |   3 +
 include/hpdf_objects.h   |   2 +
 include/hpdf_pages.h |   5 +
 include/hpdf_types.h |  14 +++
 src/CMakeLists.txt   |   1 +
 src/hpdf_page_operator.c |  31 +++
 src/hpdf_pages.c |  55 ++-
 src/hpdf_shading.c   | 231 +++
 9 files changed, 362 insertions(+), 4 deletions(-)
 create mode 100644 src/hpdf_shading.c

diff --git a/include/hpdf.h b/include/hpdf.h
index e369f67..40e3c41 100644
--- a/include/hpdf.h
+++ b/include/hpdf.h
@@ -77,6 +77,7 @@ typedef HPDF_HANDLE   HPDF_Dict;
 typedef HPDF_HANDLE   HPDF_EmbeddedFile;
 typedef HPDF_HANDLE   HPDF_OutputIntent;
 typedef HPDF_HANDLE   HPDF_Xref;
+typedef HPDF_HANDLE   HPDF_Shading;
 
 #else
 
@@ -1171,6 +1172,11 @@ HPDF_EXPORT(HPDF_STATUS)
 HPDF_Page_SetExtGState  (HPDF_Pagepage,
  HPDF_ExtGState   ext_gstate);
 
+/* sh */
+HPDF_EXPORT(HPDF_STATUS)
+HPDF_Page_SetShading  (HPDF_Pagepage,
+   HPDF_Shading shading);
+
 
 /*--- Special graphic state operator --*/
 
@@ -1450,7 +1456,23 @@ HPDF_Page_SetCMYKStroke  (HPDF_Page  page,
 
 /*--- Shading patterns ---*/
 
-/* sh --not implemented yet */
+/* Notes for docs:
+ * - ShadingType must be HPDF_SHADING_FREE_FORM_TRIANGLE_MESH (the only
+ *   defined option...)
+ * - colorSpace must be HPDF_CS_DEVICE_RGB for now.
+ */
+HPDF_EXPORT(HPDF_Shading)
+HPDF_Shading_New  (HPDF_Doc pdf,
+   HPDF_ShadingType type,
+   HPDF_ColorSpace  colorSpace,
+   HPDF_REAL xMin, HPDF_REAL xMax,
+   HPDF_REAL yMin, HPDF_REAL yMax);
+
+HPDF_EXPORT(HPDF_STATUS)
+HPDF_Shading_AddVertexRGB(HPDF_Shading shading,
+  HPDF_Shading_FreeFormTriangleMeshEdgeFlag edgeFlag,
+  HPDF_REAL x, HPDF_REAL y,
+  HPDF_UINT8 r, HPDF_UINT8 g, HPDF_UINT8 b);
 
 /*--- In-line images -*/
 
diff --git a/include/hpdf_error.h b/include/hpdf_error.h
index b04e2cd..ef4fa61 100644
--- a/include/hpdf_error.h
+++ b/include/hpdf_error.h
@@ -145,6 +145,9 @@ extern "C" {
 #define HPDF_INVALID_U3D_DATA 0x1083
 #define HPDF_NAME_CANNOT_GET_NAMES0x1084
 #define HPDF_INVALID_ICC_COMPONENT_NUM0x1085
+/*0x1086 */
+/*0x1087 */
+#define HPDF_INVALID_SHADING_TYPE 0x1088
 
 /*---*/
 
diff --git a/include/hpdf_objects.h b/include/hpdf_objects.h
index 525adda..b16de02 100644
--- a/include/hpdf_objects.h
+++ b/include/hpdf_objects.h
@@ -61,6 +61,7 @@ extern "C" {
 #define  HPDF_OSUBCLASS_EXT_GSTATE_R  0x0B00  /* read only object */
 #define  HPDF_OSUBCLASS_NAMEDICT  0x0C00
 #define  HPDF_OSUBCLASS_NAMETREE  0x0D00
+#define  HPDF_OSUBCLASS_SHADING   0x0E00
 
 
 
@@ -595,6 +596,7 @@ typedef HPDF_Array HPDF_Destination;
 typedef HPDF_Dict  HPDF_U3D;
 typedef HPDF_Dict  HPDF_OutputIntent;
 typedef HPDF_Dict  HPDF_JavaScript;
+typedef HPDF_Dict  HPDF_Shading;
 
 #ifdef __cplusplus
 }
diff --git a/include/hpdf_pages.h b/include/hpdf_pages.h
index 44b816c..60b1d84 100644
--- a/include/hpdf_pages.h
+++ b/include/hpdf_pages.h
@@ -55,6 +55,7 @@ typedef struct _HPDF_PageAttr_Rec {
 HPDF_Dict  fonts;
 HPDF_Dict  xobjects;
 HPDF_Dict  ext_gstates;
+HPDF_Dict  shadings;
 HPDF_GStategstate;
 HPDF_Point str_pos;
 HPDF_Point cur_pos;
@@ -101,6 +102,10 @@ const char*
 HPDF_Page_GetExtGStateName  (HPDF_Page   page,
  HPDF_ExtGState  gstate);
 
+const char*
+HPDF_Page_GetShadingName  (HPDF_Pagepage,
+   HPDF_Shading shading);
+
 
 HPDF_Box
 HPDF_Page_GetMediaBox  (HPDF_Pagepage);
diff --git a/include/hpdf_types.h b/include/hpdf_types.h
index 8b3e0a8..a2e2157 100644
--- a/include/hpdf_types.h