[latex3-commits] [l3svn] branch master updated: Support for image decode arrays

noreply at latex-project.org noreply at latex-project.org
Thu Jun 29 10:51:32 CEST 2017


This is an automated email from the git hooks/post-receive script.

joseph pushed a commit to branch master
in repository l3svn.

The following commit(s) were added to refs/heads/master by this push:
       new  b9a148e   Support for image decode arrays
b9a148e is described below

commit b9a148e76874edde591730729edbad8dc343950b
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Thu Jun 29 09:50:28 2017 +0100

    Support for image decode arrays
    
    We might want to have some validation here: a regex?
---
 l3kernel/l3drivers.dtx      |   34 ++++++++++++++++++++++++++++++----
 l3trial/l3image/l3image.dtx |   14 +++++++++++++-
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/l3kernel/l3drivers.dtx b/l3kernel/l3drivers.dtx
index 059f4cf..27542fc 100644
--- a/l3kernel/l3drivers.dtx
+++ b/l3kernel/l3drivers.dtx
@@ -1415,6 +1415,8 @@
     \tl_clear:N \l__image_pagebox_tl
     \tl_set:Nx \l_@@_image_attr_tl
       {
+        \tl_if_empty:NF \l__image_decode_tl
+          { :D \l__image_decode_tl }
         \bool_if:NT \l__image_interpolate_bool
           { :I }
       }
@@ -1424,6 +1426,7 @@
 \cs_new_eq:NN \@@_image_getbb_png:n \@@_image_getbb_jpg:n
 \cs_new_protected:Npn \@@_image_getbb_pdf:n #1
   {
+    \tl_clear:N \l__image_decode_tl
     \bool_set_false:N \l__image_interpolate_bool
     \tl_set:Nx \l_@@_image_attr_tl
       {
@@ -1455,8 +1458,18 @@
 \cs_new_protected:Npn \@@_image_getbb_auxii:n #1
   {
     \tex_immediate:D \pdftex_pdfximage:D
-      \bool_if:NT \l__image_interpolate_bool
-        { attr ~ { /Interpolate~true } }
+      \bool_lazy_or:nnT
+        { \l__image_interpolate_bool }
+        { ! \tl_if_empty_p:N \l__image_decode_tl }
+        {
+          attr ~
+            {
+              \tl_if_empty:NF \l__image_decode_tl
+                { /Decode~[ \l__image_decode_tl ] }
+              \bool_if:NT \l__image_interpolate_bool
+                { /Interpolate~true }
+            }
+        }
       \int_compare:nNnT \l__image_page_int > 0
         { page ~ \int_use:N \l__image_page_int }
       \tl_if_empty:NF \l__image_pagebox_tl
@@ -1621,6 +1634,7 @@
 \cs_new_eq:NN \@@_image_getbb_png:n \@@_image_getbb_jpg:n
 \cs_new_protected:Npn \@@_image_getbb_pdf:n #1
   {
+    \tl_clear:N \l__image_decode_tl
     \bool_set_false:N \l__image_interpolate_bool
     \__image_extract_bb:n {#1}
   }
@@ -1673,6 +1687,8 @@
           { : \l__image_pagebox_tl }
         \int_compare:nNnT \l__image_page_int > 1
           { :P \int_use:N \l__image_page_int }
+        \tl_if_empty:NF \l__image_decode_tl
+          { :D \l__image_decode_tl }
         \bool_if:NT \l__image_interpolate_bool
            { :I }
       }
@@ -1714,8 +1730,17 @@
               \dim_to_decimal_in_bp:n \l__image_ury_dim \c_space_tl
           }
         (#1)
-        \bool_if:NT \l__image_interpolate_bool
-          { <</Interpolate~true>> }
+        \bool_lazy_or:nnT
+          { \l__image_interpolate_bool }
+          { ! \tl_if_empty_p:N \l__imge_decode_tl }
+          {
+            <<
+              \tl_if_empty:NF \l__imge_decode_tl
+                { /Decode~[ \l__imge_decode_tl ] }
+              \bool_if:NT \l__image_interpolate_bool
+                { /Interpolate~true> }
+            >>
+          }
       }
   }
 %    \end{macrocode}
@@ -1759,6 +1784,7 @@
 \cs_new_eq:NN \@@_image_getbb_png:n \@@_image_getbb_jpg:n
 \cs_new_protected:Npn \@@_image_getbb_pdf:n #1
   {
+    \tl_clear:N \l__image_decode_tl
     \bool_set_false:N \l__image_interpolate_bool
     \@@_image_getbb_auxi:nN {#1} \xetex_pdffile:D
   }
diff --git a/l3trial/l3image/l3image.dtx b/l3trial/l3image/l3image.dtx
index c5ddd10..d1219f9 100644
--- a/l3trial/l3image/l3image.dtx
+++ b/l3trial/l3image/l3image.dtx
@@ -76,6 +76,12 @@
 % which in themselves contain no driver-specific code. This functionality
 % is made available here.
 %
+% \begin{variable}{\l__image_decode_tl}
+%   Array to decode color in bitmap image: when non-empty, this should
+%   be in the form of one, two or three pairs of real numbers in the range
+%   $[0,1]$, separated by spaces.
+% \end{variable}
+%
 % \begin{variable}{\l__image_interpolate_bool}
 %   Indicates whether interpolation should be applied to bitmap image files.
 % \end{variable}
@@ -178,7 +184,12 @@
 % \subsection{Image feature support}
 %
 % \begin{macro}[int]
-%   {\l__image_interpolate_bool, \l__image_page_int, \l__image_pagebox_tl}
+%   {
+%     \l__image_decode_tl       ,
+%     \l__image_interpolate_bool,
+%     \l__image_page_int        ,
+%     \l__image_pagebox_tl
+%   }
 %   Keys which control features of images. The standard value of |[pagebox|
 %   set up here should match the default for the drivers themselves: in
 %   the absence of any other setting the |cropbox| should be used.
@@ -186,6 +197,7 @@
 \tl_new:N \l__image_pagebox_tl
 \keys_define:nn { image }
   {
+    decode      .tl_set:N   = \l__image_decode_tl        ,
     interpolate .bool_set:N = \l__image_interpolate_bool ,
     page        .int_set:N  = \l__image_page_int         ,
     pagebox     .choices:nn =

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the latex3-commits mailing list