texlive[46740] Master/texmf-dist: pixelart (25feb18)

commits+karl at tug.org commits+karl at tug.org
Sun Feb 25 22:28:53 CET 2018


Revision: 46740
          http://tug.org/svn/texlive?view=revision&revision=46740
Author:   karl
Date:     2018-02-25 22:28:52 +0100 (Sun, 25 Feb 2018)
Log Message:
-----------
pixelart (25feb18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/pixelart/CHANGELOG.md
    trunk/Master/texmf-dist/doc/latex/pixelart/pixelart.pdf
    trunk/Master/texmf-dist/source/latex/pixelart/pixelart.dtx
    trunk/Master/texmf-dist/tex/latex/pixelart/pixelart.sty

Modified: trunk/Master/texmf-dist/doc/latex/pixelart/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/pixelart/CHANGELOG.md	2018-02-25 01:23:50 UTC (rev 46739)
+++ trunk/Master/texmf-dist/doc/latex/pixelart/CHANGELOG.md	2018-02-25 21:28:52 UTC (rev 46740)
@@ -1,3 +1,9 @@
+* pixelart 0.2.0 (2018-02-25)
+
+    * Add a `draft` package option.
+
+    -- Louis Paternault <spalax+ctan at gresille.org>
+
 * pixelart 0.1.2 (2018-01-13)
 
     * Fix bug: First line-break is now automatically ignored.

Modified: trunk/Master/texmf-dist/doc/latex/pixelart/pixelart.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/pixelart/pixelart.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/pixelart/pixelart.dtx	2018-02-25 01:23:50 UTC (rev 46739)
+++ trunk/Master/texmf-dist/source/latex/pixelart/pixelart.dtx	2018-02-25 21:28:52 UTC (rev 46740)
@@ -25,7 +25,7 @@
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{pixelart}
 %<*package>
-    [2018/01/13 v0.1.2 A package to draw pixel-art pictures]
+    [2018/02/25 v0.2.0 A package to draw pixel-art pictures]
 %</package>
 %
 %<*driver>
@@ -87,11 +87,12 @@
 % \DoNotIndex{\@bwpa at newline}
 % \DoNotIndex{\begin}
 % \DoNotIndex{\coordinate}
-% \DoNotIndex{\end}
-% \DoNotIndex{\fill}
+% \DoNotIndex{\end, \else}
+% \DoNotIndex{\fill, \fi}
+% \DoNotIndex{\ifpixelart at draft}
 % \DoNotIndex{\makeatletter, \makeatother}
-% \DoNotIndex{\newcommand}
-% \DoNotIndex{\pgfkeys, \pgfkeyssetvalue, \pgfkeysvalueof, \pgfparserdef, \pgfparserparse, \pgfparserswitch}
+% \DoNotIndex{\newcommand, \newif}
+% \DoNotIndex{\ProcessPgfPackageOptions, \pgfkeys, \pgfkeyssetvalue, \pgfkeysvalueof, \pgfparserdef, \pgfparserparse, \pgfparserswitch}
 % \DoNotIndex{\raisebox, \RequirePackage}
 % \DoNotIndex{\space}
 % \DoNotIndex{\tikz}
@@ -177,9 +178,12 @@
 % \label{sec:usage}
 %
 % \subsection{Package options}
+% \changes{v0.2.0}{2018/01/25}{Add package option \texttt{draft}.}
 %
-% This package has no package options.
+% This package has a single package option: |draft|. If this option is set (\lstinline|\usepackage[draft]{pixelart}|), pixel-art pictures are ignored. This can make compilation \emph{way, way} faster\footnote{On a document I am writing, containing a lot of pixel-art pictures, option |draft| makes compilation time go from 6 minutes to 22 seconds.}.
 %
+% A downside is that since pixel-art pictures are ignored, this can mess up your document layout. A nicer option would be to have option |draft| guess the pixel-art size, and display a dummy picture with the same size. Patches are welcome! \smiley
+%
 % \subsection{Macros}
 %
 % This package defines two macros : |\bwpixelart|\footnote{\texttt{$\backslash{}$bwpixelart} stands for \emph{b}lack and \emph{w}hite \emph{pixel art}, although \emph{color and transparent pixel art} would be more accurate.}, used to insert a pixel-art picture, and |\tikzbwpixelart|, which has the same purpose, excepted that it is called from within a |tikzpicture| environment.
@@ -254,7 +258,7 @@
 % \end{center}
 % Its optional arguments are |color| and |scale|, used to set the color and scale of the picture.
 %
-% Its first mandatory argument is the coordinate of the top left corner of the picture; the second one is the list of pixel (using the same syntax as teh |\bwpixelart| macro.
+% Its first mandatory argument is the coordinate of the top left corner of the picture; the second one is the list of pixels (using the same syntax as the |\bwpixelart| macro).
 %
 % For instance, this heart
 %\begin{tikzpicture}[scale=.05, baseline=-1em]
@@ -316,12 +320,6 @@
 %
 % That's it. It takes alomst 30 seconds to compile a document containing only a $128\times128$ picture (about \numprint{16000} pixels). I have no idea how to fix it. Good luck.
 %
-% \subsection{Package option \texttt{draft}}
-%
-% To (partially) fix the previous bug (slooooow), one could imaging adding a package option |draft|. With this option set, the pixel-art pictures would not be compiled, but would be replaced either by a dummy picture of an arbitrary size, or a dummy picture of the actual size of the picture, if an argument |size=(4, 5)| has been provided to the macro.
-%
-% This should not be that hard to implement. Patches welcome! \smiley{}
-%
 % \subsection{Black and white}
 %
 % Right now, it is black and white only (or, to be more accurate, any single color on a transparent background).
@@ -514,6 +512,7 @@
 % Load some packages.
 %    \begin{macrocode}
 \RequirePackage{pgf}
+\RequirePackage{pgfopts}
 \usepgfmodule{parser}
 \RequirePackage{tikz}
 \usetikzlibrary{calc}
@@ -529,6 +528,18 @@
 
 %    \end{macrocode}
 %
+% Parse package options.
+%
+%    \begin{macrocode}
+\newif\ifpixelart at draft
+\pgfkeys{
+  /PIXELART/.cd,
+  draft/.is if=pixelart at draft,
+  draft=false,
+}
+\ProcessPgfPackageOptions{/PIXELART}
+%    \end{macrocode}
+%
 % Define macro arguments
 %
 %    \begin{macrocode}
@@ -584,6 +595,7 @@
 %    \end{macrocode}
 %
 % \begin{macro}{\bwpixelart}
+% \changes{v0.1.2}{2018/01/13}{First line-break of pixelart argument is now automatically ignored.}
 % Define |\bwpixelart|, used to draw black-and-white pixelart.
 %    \begin{macrocode}
 \newcommand{\bwpixelart}[2][]{{%
@@ -606,15 +618,19 @@
 %    \begin{macrocode}
 \newcommand{\tikzbwpixelart}[3][]{
   \pgfkeys{/PIXELART/TIKZBWPIXELART, #1}
-  \begin{scope}[shift={#2}]
-    \begin{scope}[#1]
-      \coordinate (@pixelart) at (0, 1);
-      \coordinate (@pixelart at startline) at (@pixelart);
+  \ifpixelart at draft
+    % Draft mode. Nothing to parse, nothing to show!
+  \else
+    \begin{scope}[shift={#2}]
+      \begin{scope}[#1]
+        \coordinate (@pixelart) at (0, 1);
+        \coordinate (@pixelart at startline) at (@pixelart);
 
-      \pgfparserparse{@bwpixelart}
-      #3 @
+        \pgfparserparse{@bwpixelart}
+        #3 @
+      \end{scope}
     \end{scope}
-  \end{scope}
+  \fi
 }
 
 %    \end{macrocode}
@@ -625,6 +641,8 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \changes{v0.1.0}{2017/12/05}{First published version.}
+%
 % \addcontentsline{toc}{section}{Change History}
 % \PrintChanges
 %

Modified: trunk/Master/texmf-dist/tex/latex/pixelart/pixelart.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/pixelart/pixelart.sty	2018-02-25 01:23:50 UTC (rev 46739)
+++ trunk/Master/texmf-dist/tex/latex/pixelart/pixelart.sty	2018-02-25 21:28:52 UTC (rev 46740)
@@ -23,9 +23,10 @@
 %% and the derived file pixelart.sty.
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{pixelart}
-    [2018/01/13 v0.1.2 A package to draw pixel-art pictures]
+    [2018/02/25 v0.2.0 A package to draw pixel-art pictures]
 
 \RequirePackage{pgf}
+\RequirePackage{pgfopts}
 \usepgfmodule{parser}
 \RequirePackage{tikz}
 \usetikzlibrary{calc}
@@ -34,7 +35,14 @@
 
 \makeatletter
 
+\newif\ifpixelart at draft
 \pgfkeys{
+  /PIXELART/.cd,
+  draft/.is if=pixelart at draft,
+  draft=false,
+}
+\ProcessPgfPackageOptions{/PIXELART}
+\pgfkeys{
   /PIXELART/BWPIXELART/.is family,
   /PIXELART/BWPIXELART,
   scale/.value required,
@@ -93,15 +101,19 @@
 
 \newcommand{\tikzbwpixelart}[3][]{
   \pgfkeys{/PIXELART/TIKZBWPIXELART, #1}
-  \begin{scope}[shift={#2}]
-    \begin{scope}[#1]
-      \coordinate (@pixelart) at (0, 1);
-      \coordinate (@pixelart at startline) at (@pixelart);
+  \ifpixelart at draft
+    % Draft mode. Nothing to parse, nothing to show!
+  \else
+    \begin{scope}[shift={#2}]
+      \begin{scope}[#1]
+        \coordinate (@pixelart) at (0, 1);
+        \coordinate (@pixelart at startline) at (@pixelart);
 
-      \pgfparserparse{@bwpixelart}
-      #3 @
+        \pgfparserparse{@bwpixelart}
+        #3 @
+      \end{scope}
     \end{scope}
-  \end{scope}
+  \fi
 }
 
 \makeatother



More information about the tex-live-commits mailing list