[latex3-commits] [l3svn] 02/02: Re-instroduce support for "interpolate" key for images

noreply at latex-project.org noreply at latex-project.org
Fri May 19 13:29:42 CEST 2017


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

joseph pushed a commit to branch master
in repository l3svn.

commit a1618f15c7a2f8e3570ccf746f0abfcc965fee57
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri May 19 12:27:28 2017 +0100

    Re-instroduce support for "interpolate" key for images
    
    Unlike "pagebox", "interpolate" does seem to have some real-world
    use cases: notably it is supported by pgf and see for example
    https://tex.stackexchange.com/q/287999 or
    https://tex.stackexchange.com/q/164055/. The interface here is also
    quite clear: a simple boolean which is straight-forward to understand.
---
 l3kernel/l3drivers.dtx      |   13 ++++++++++++-
 l3trial/l3image/l3image.dtx |   14 ++++++++++++--
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/l3kernel/l3drivers.dtx b/l3kernel/l3drivers.dtx
index 7a958b4..7000c09 100644
--- a/l3kernel/l3drivers.dtx
+++ b/l3kernel/l3drivers.dtx
@@ -720,7 +720,11 @@
 \cs_new_protected:Npn \@@_image_getbb_jpg:n #1
   {
     \int_zero:N \l__image_page_int
-    \tl_clear:N \l_@@_image_attr_tl
+    \tl_set:Nx \l_@@_image_attr_tl
+      {
+        \bool_if:NT \l__image_interpolate_bool
+          { :I }
+      }
     \@@_image_getbb_auxi:n {#1}
   }
 \cs_new_eq:NN \@@_image_getbb_png:n \@@_image_getbb_jpg:n
@@ -752,6 +756,8 @@
 \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 } }
       \int_compare:nNnT \l__image_page_int > 0
         { page ~ \int_use:N \l__image_page_int }
       {#1}
@@ -946,6 +952,7 @@
 \cs_new_eq:NN \@@_image_getbb_png:n \@@_image_getbb_jpg:n
 \cs_new_protected:Npn \@@_image_getbb_pdf:n #1
   {
+    \bool_set_false:N \l__image_interpolate_tl
     \__image_extract_bb:n {#1}
   }
 %</dvipdfmx>
@@ -990,6 +997,8 @@
       {
         \int_compare:nNnT \l__image_page_int > 0
           { :P \int_use:N \l__image_page_int }
+        \bool_if:NT \l__image_interpolate_bool
+           { :I }
       }
       {#1} {#2}
   }
@@ -1014,6 +1023,8 @@
         \int_compare:nNnT \l__image_page_int > 0
           { page ~ \int_use:N \l__image_page_int \c_space_tl }
         (#1)
+        \bool_if:NT \l__image_interpolate_bool
+          { <</Interpolate~true>> }
       }
   }
 %    \end{macrocode}
diff --git a/l3trial/l3image/l3image.dtx b/l3trial/l3image/l3image.dtx
index c9aaa69..7f79077 100644
--- a/l3trial/l3image/l3image.dtx
+++ b/l3trial/l3image/l3image.dtx
@@ -52,6 +52,11 @@
 %
 % \section{\pkg{l3image} documentation}
 %
+% \begin{variable}{interpolate}
+%   Indicates whether interpolation should be applied to bitmap image files.
+%   This key will be ignored for vector image files.
+% \end{variable}
+%
 % \begin{variable}{page}
 %   The page number of an image to be used when including a multi-page
 %   PDF file as an image. This key will be ignored for non-PDF images.
@@ -64,6 +69,10 @@
 % which in themselves contain no driver-specific code. This functionality
 % is made available here.
 %
+% \begin{variable}{\l__image_interpolate_bool}
+%   Indicates whether interpolation should be applied to bitmap image files.
+% \end{variable}
+%
 % \begin{variable}{\l__image_page_int}
 %   The page to extract from a multi-page image file: used for |.pdf| files
 %   which may contain multiple pages.
@@ -155,12 +164,13 @@
 %
 % \subsection{Image feature support}
 %
-% \begin{macro}[int]{\l__image_page_int}
+% \begin{macro}[int]{\l__image_interpolate_bool, \l__image_page_int}
 %   Keys which control features of images.
 %    \begin{macrocode}
 \keys_define:nn { image }
   {
-    page    .int_set:N   = \l__image_page_int,
+    interpolate .bool_set:N = \l__image_interpolate_bool ,
+    page        .int_set:N  = \l__image_page_int
   }
 %    \end{macrocode}
 % \end{macro}

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


More information about the latex3-commits mailing list