diff options
author | Karl Berry <karl@freefriends.org> | 2024-10-26 20:12:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-10-26 20:12:09 +0000 |
commit | 4fb2af0d3bad596d07b0f54a7eeec7c2f9085de2 (patch) | |
tree | 70ff92f91e81c1a5b9cd3175eba9a69c45562dcf /Master/texmf-dist/metapost | |
parent | a8b4b35bc2f862ce4b4c79b6242d90574f5b187c (diff) |
mpchess (26oct24)
git-svn-id: svn://tug.org/texlive/trunk@72664 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r-- | Master/texmf-dist/metapost/mpchess/mpchess.mp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/Master/texmf-dist/metapost/mpchess/mpchess.mp b/Master/texmf-dist/metapost/mpchess/mpchess.mp index 3883ca0bc34..c5dee018d71 100644 --- a/Master/texmf-dist/metapost/mpchess/mpchess.mp +++ b/Master/texmf-dist/metapost/mpchess/mpchess.mp @@ -2,7 +2,7 @@ %% mpchess.mp %% %% draw chessboards with metapost %% %% notezik@gmail.com %% -%% Version 0.7 (juillet 2023) %% +%% Version 0.8 (octobre 2024) %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This work may be distributed and/or modified under the conditions of @@ -15,6 +15,8 @@ %input format; input hatching; +%input minim-mp; +%input minim-hatching; input mpchess-pieces; % piece of mpchess package input mpchess-cburnett; % piece of lichess cburnett input mpchess-skak; % piece of skak package @@ -258,6 +260,27 @@ def _buildClassicalSquare(expr _SquareUnit)= ); enddef; +def _buildDottedSquare(expr _SquareUnit)= + _blackSquarePic:=image( + fill (unitsquare scaled _SquareUnit) withcolor white; + save N; + N:= 11; + for i:=0 upto N+1: + for j:=0 upto N+1: + fill (fullcircle shifted (1/N*i*_SquareUnit if odd(j): +1/(2*N)*_SquareUnit fi,1/N*j*_SquareUnit)) + ; + endfor; + endfor; + draw (unitsquare scaled _SquareUnit); + clip currentpicture to (unitsquare scaled _SquareUnit); + ); + _whiteSquarePic:=image( + fill unitsquare scaled _SquareUnit withcolor white; + draw (unitsquare scaled _SquareUnit); + clip currentpicture to (unitsquare scaled _SquareUnit); + ); +enddef; + % default theme lichess blue _blackSquarePic:=_blackSquareColoredPic; _whiteSquarePic:=_whiteSquareColoredPic; @@ -287,6 +310,9 @@ def set_color_theme(expr t)= elseif(t="Classical"): _blackColorSquare:=black; _whiteColorSquare:=black; + elseif(t="Dotted"): + _blackColorSquare:=black; + _whiteColorSquare:=black; fi enddef; @@ -561,6 +587,10 @@ _chessSquareU:=_chessWidth/_chessSize; _init_piece(_chessSquareU); if(_chessTheme="Classical"): _buildClassicalSquare(_chessSquareU); +elseif(_chessTheme="Dotted"): + _buildDottedSquare(_chessSquareU); +elseif(_chessTheme="User"): + buildUserSquare(_chessSquareU); else: % colored themes _buildColoredSquare(_chessSquareU,_blackColorSquare,_whiteColorSquare); fi |