aboutsummaryrefslogtreecommitdiffstats
path: root/include/graphf.lpg
diff options
context:
space:
mode:
authorJeffrey H. Kingston <jeff@it.usyd.edu.au>2010-09-14 20:38:23 +0000
committerJeffrey H. Kingston <jeff@it.usyd.edu.au>2010-09-14 20:38:23 +0000
commit78c2bcf9e96ab00615ee6f96905bca78fcd52a00 (patch)
tree9c7e31f2a59e174433e55b589771005b48a34158 /include/graphf.lpg
parent9daa98ce90ceeeaba9e942d28575d8fcfe36db4b (diff)
downloadlout-78c2bcf9e96ab00615ee6f96905bca78fcd52a00.tar.gz
Lout 3.27.
git-svn-id: http://svn.savannah.nongnu.org/svn/lout/trunk@23 9365b830-b601-4143-9ba8-b4a8e2c3339c
Diffstat (limited to 'include/graphf.lpg')
-rw-r--r--include/graphf.lpg62
1 files changed, 41 insertions, 21 deletions
diff --git a/include/graphf.lpg b/include/graphf.lpg
index ff95259..3c7edbc 100644
--- a/include/graphf.lpg
+++ b/include/graphf.lpg
@@ -173,26 +173,49 @@ lgraphdict begin
linewidth setlinewidth stroke
} def
+% % pre-texture versions
+% % stroke a filled y histogram: - filledyhisto -
+% /filledyhisto
+% {
+% linewidth setlinewidth
+% xprev yleft trpoint exch currentlinewidth 2 div add exch yextra sub moveto
+% xprev yprev trpoint exch currentlinewidth 2 div add exch lineto
+% xcurr yprev trpoint exch currentlinewidth 2 div sub exch lineto
+% xcurr yleft trpoint exch currentlinewidth 2 div sub exch yextra sub lineto
+% closepath fill
+% } def
+
+% % stroke a filled x histogram: - filledxhisto -
+% /filledxhisto
+% {
+% linewidth setlinewidth
+% xleft yprev trpoint currentlinewidth 2 div add exch xextra sub exch moveto
+% xcurr yprev trpoint currentlinewidth 2 div add lineto
+% xcurr ycurr trpoint currentlinewidth 2 div sub lineto
+% xleft ycurr trpoint currentlinewidth 2 div sub exch xextra sub exch lineto
+% closepath fill
+% } def
+
% stroke a filled y histogram: - filledyhisto -
/filledyhisto
{
linewidth setlinewidth
- xprev yleft trpoint exch currentlinewidth 2 div add exch yextra sub moveto
- xprev yprev trpoint exch currentlinewidth 2 div add exch lineto
- xcurr yprev trpoint exch currentlinewidth 2 div sub exch lineto
- xcurr yleft trpoint exch currentlinewidth 2 div sub exch yextra sub lineto
- closepath fill
+ xprev yleft trpoint exch currentlinewidth 1.3 mul add exch yextra sub moveto
+ xprev yprev trpoint exch currentlinewidth 1.3 mul add exch lineto
+ xcurr yprev trpoint exch currentlinewidth 1.3 mul sub exch lineto
+ xcurr yleft trpoint exch currentlinewidth 1.3 mul sub exch yextra sub lineto
+ gsave texture fill grestore stroke
} def
% stroke a filled x histogram: - filledxhisto -
/filledxhisto
{
linewidth setlinewidth
- xleft yprev trpoint currentlinewidth 2 div add exch xextra sub exch moveto
- xcurr yprev trpoint currentlinewidth 2 div add lineto
- xcurr ycurr trpoint currentlinewidth 2 div sub lineto
- xleft ycurr trpoint currentlinewidth 2 div sub exch xextra sub exch lineto
- closepath fill
+ xleft yprev trpoint currentlinewidth 1.3 mul add exch xextra sub exch moveto
+ xcurr yprev trpoint currentlinewidth 1.3 mul add lineto
+ xcurr ycurr trpoint currentlinewidth 1.3 mul sub lineto
+ xleft ycurr trpoint currentlinewidth 1.3 mul sub exch xextra sub exch lineto
+ gsave texture fill grestore stroke
} def
@@ -315,13 +338,6 @@ lgraphdict begin
} if
} def
-% % trpoint: transform (x, y) in graph space into (x', y') in print space
-% % x y trpoint x' y'
-% /trpoint
-% { exch xtr trxmin sub trxmax trxmin sub div xwidth mul xextra add
-% exch ytr trymin sub trymax trymin sub div ywidth mul yextra add
-% } def
-
% trpoint: transform (x, y) in graph space into (x', y') in print space
% x y trpoint x' y'
@@ -358,7 +374,7 @@ lgraphdict begin
% [ data ] xandy [ data ]
/xandy {} def
-% swapxandy: no interpolation of x or y values
+% swapxandy: swap x and y values
% [ data ] swapxandy [ data ]
/swapxandy
{ dup /tmp exch def
@@ -730,7 +746,8 @@ lgraphdict begin
/rundata
{ alldata
{ gsave
- dup dup dup dup
+ dup dup dup dup dup
+ 5 get /texture exch def
4 get /dopaint exch def
3 get /initrun exch def
2 get /pairs exch def
@@ -738,7 +755,9 @@ lgraphdict begin
0 get /data exch def
dopaint
{ data length 4 ge
- { initrun
+ {
+ gsave
+ initrun
newpath
data 0 get ymin trpoint yextra sub moveto
0 2 data length 2 sub
@@ -748,7 +767,8 @@ lgraphdict begin
xcurr ycurr trpoint lineto
} for
data dup length 2 sub get ymin trpoint yextra sub lineto
- closepath fill
+ closepath texture fill
+ grestore
} if
} if
initrun