diff options
author | Karl Berry <karl@freefriends.org> | 2018-02-25 21:28:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-02-25 21:28:52 +0000 |
commit | eaeb7e1215c6dac950bfdc884c48478ea36afdc3 (patch) | |
tree | ef1fb13adeafc18149117e0d9a752afac75a5317 /Master/texmf-dist | |
parent | e18be612d01aa3905f88efab321f712f9fc478b6 (diff) |
pixelart (25feb18)
git-svn-id: svn://tug.org/texlive/trunk@46740 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/pixelart/CHANGELOG.md | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pixelart/pixelart.pdf | bin | 148783 -> 152344 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/pixelart/pixelart.dtx | 58 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pixelart/pixelart.sty | 28 |
4 files changed, 64 insertions, 28 deletions
diff --git a/Master/texmf-dist/doc/latex/pixelart/CHANGELOG.md b/Master/texmf-dist/doc/latex/pixelart/CHANGELOG.md index 18a56a43ab4..4a0fdfaee89 100644 --- a/Master/texmf-dist/doc/latex/pixelart/CHANGELOG.md +++ b/Master/texmf-dist/doc/latex/pixelart/CHANGELOG.md @@ -1,3 +1,9 @@ +* pixelart 0.2.0 (2018-02-25) + + * Add a `draft` package option. + + -- Louis Paternault <spalax+ctan@gresille.org> + * pixelart 0.1.2 (2018-01-13) * Fix bug: First line-break is now automatically ignored. diff --git a/Master/texmf-dist/doc/latex/pixelart/pixelart.pdf b/Master/texmf-dist/doc/latex/pixelart/pixelart.pdf Binary files differindex af4e7eeaba9..a651a085fe8 100644 --- a/Master/texmf-dist/doc/latex/pixelart/pixelart.pdf +++ b/Master/texmf-dist/doc/latex/pixelart/pixelart.pdf diff --git a/Master/texmf-dist/source/latex/pixelart/pixelart.dtx b/Master/texmf-dist/source/latex/pixelart/pixelart.dtx index 1f3e7396b85..472831348b4 100644 --- a/Master/texmf-dist/source/latex/pixelart/pixelart.dtx +++ b/Master/texmf-dist/source/latex/pixelart/pixelart.dtx @@ -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@newline} % \DoNotIndex{\begin} % \DoNotIndex{\coordinate} -% \DoNotIndex{\end} -% \DoNotIndex{\fill} +% \DoNotIndex{\end, \else} +% \DoNotIndex{\fill, \fi} +% \DoNotIndex{\ifpixelart@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,8 +178,11 @@ % \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} % @@ -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@draft +\pgfkeys{ + /PIXELART/.cd, + draft/.is if=pixelart@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@startline) at (@pixelart); + \ifpixelart@draft + % Draft mode. Nothing to parse, nothing to show! + \else + \begin{scope}[shift={#2}] + \begin{scope}[#1] + \coordinate (@pixelart) at (0, 1); + \coordinate (@pixelart@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 % diff --git a/Master/texmf-dist/tex/latex/pixelart/pixelart.sty b/Master/texmf-dist/tex/latex/pixelart/pixelart.sty index 229866d5146..ec702ee8036 100644 --- a/Master/texmf-dist/tex/latex/pixelart/pixelart.sty +++ b/Master/texmf-dist/tex/latex/pixelart/pixelart.sty @@ -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,6 +35,13 @@ \makeatletter +\newif\ifpixelart@draft +\pgfkeys{ + /PIXELART/.cd, + draft/.is if=pixelart@draft, + draft=false, +} +\ProcessPgfPackageOptions{/PIXELART} \pgfkeys{ /PIXELART/BWPIXELART/.is family, /PIXELART/BWPIXELART, @@ -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@startline) at (@pixelart); + \ifpixelart@draft + % Draft mode. Nothing to parse, nothing to show! + \else + \begin{scope}[shift={#2}] + \begin{scope}[#1] + \coordinate (@pixelart) at (0, 1); + \coordinate (@pixelart@startline) at (@pixelart); - \pgfparserparse{@bwpixelart} - #3 @ + \pgfparserparse{@bwpixelart} + #3 @ + \end{scope} \end{scope} - \end{scope} + \fi } \makeatother |