From 8b678f473da7b81842dbc13b50c6303991570521 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sat, 25 May 2019 11:48:47 +0200 Subject: 2019-05-25 10:53:00 --- tex/context/base/mkiv/back-trf.mkiv | 79 +++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 tex/context/base/mkiv/back-trf.mkiv (limited to 'tex/context/base/mkiv/back-trf.mkiv') diff --git a/tex/context/base/mkiv/back-trf.mkiv b/tex/context/base/mkiv/back-trf.mkiv new file mode 100644 index 000000000..3d8477a82 --- /dev/null +++ b/tex/context/base/mkiv/back-trf.mkiv @@ -0,0 +1,79 @@ +%D \module +%D [ file=back-trf, +%D version=2019.02.08, % 2009.04.15, +%D title=\CONTEXT\ Backend Macros, +%D subtitle=Transformations, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +\registerctxluafile{back-trf}{} + +% rotation + +\unexpanded\def\dostartrotation#1% + {\forcecolorhack + \clf_startrotation#1\relax} % todo: implement without Q q + +\unexpanded\def\dostoprotation + {\clf_stoprotation + \forcecolorhack} + +% scaling + +\unexpanded\def\dostartscaling#1#2% + {\forcecolorhack + \clf_startscaling rx #1 ry #2\relax} + +\unexpanded\def\dostopscaling + {\clf_stopscaling + \forcecolorhack} + +% mirroring + +\unexpanded\def\dostartmirroring + {\clf_startmirroring} + +\unexpanded\def\dostopmirroring + {\clf_stopmirroring} + +% transform + +\unexpanded\def\dotransformnextbox#1#2#3#4#5#6% + {\dowithnextbox{\dodotransformnextbox{#1}{#2}{#3}{#4}{#5}{#6}}} + +\unexpanded\def\dodotransformnextbox#1#2#3#4#5#6% + {\hpack + {\kern #5\onebasepoint + \raise#6\onebasepoint + \hpack + {\clf_startmatrix rx #1 sx #2 sy #3 ry #4\relax + \box\nextbox + \clf_stopmatrix}}} + +%D \macros +%D {dostartclipping,dostopclipping} +%D +%D Clipping is implemented in such a way that an arbitrary code can be fed. +%D +%D \starttyping +%D \dostartclipping {pathname} {width} {height} +%D \dostopclipping +%D \stoptyping + +\unexpanded\def\dostartclipping#1#2#3% we can move this to lua and only set a box here + {\forcecolorhack + \meta_grab_clip_path{#1}{#2}{#3}% + \clf_startclipping{\MPclippath}% + \glet\MPclippath\empty} + +\unexpanded\def\dostopclipping + {\clf_stopclipping} + +\protect \endinput -- cgit v1.2.3