summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/metafun.mp14
-rw-r--r--metapost/context/base/mp-core.mp2
-rw-r--r--metapost/context/base/mp-spec.mp35
3 files changed, 43 insertions, 8 deletions
diff --git a/metapost/context/base/metafun.mp b/metapost/context/base/metafun.mp
index cfbf7b2f9..98ea1980f 100644
--- a/metapost/context/base/metafun.mp
+++ b/metapost/context/base/metafun.mp
@@ -53,12 +53,14 @@ input mp-func.mp ;
string metafunversion ;
-metafunversion = "metafun" & " " &
- decimal year & "-" &
- decimal month & "-" &
- decimal day & " " &
- decimal (time div 60) & ":" &
- decimal (time-(time div 60)*60) ;
+metafunversion = "metafun" & " " &
+ decimal year & "-" &
+ decimal month & "-" &
+ decimal day & " " &
+ if ((time div 60) < 10) : "0" & fi
+ decimal (time div 60) & ":" &
+ if ((time-(time div 60)*60) < 10) : "0" & fi
+ decimal (time-(time div 60)*60) ;
let normalend = end ;
diff --git a/metapost/context/base/mp-core.mp b/metapost/context/base/mp-core.mp
index c39aa406f..7967b718f 100644
--- a/metapost/context/base/mp-core.mp
+++ b/metapost/context/base/mp-core.mp
@@ -1000,6 +1000,7 @@ color boxfillcolor ; boxfillcolor := .8white ;
numeric boxgridtype ; boxgridtype := 0 ;
numeric boxlinetype ; boxlinetype := 1 ;
numeric boxfilltype ; boxfilltype := 1 ;
+numeric boxdashtype ; boxdashtype := 0 ;
pair boxgriddirection ; boxgriddirection := up ;
numeric boxgridwidth ; boxgridwidth := 1pt ;
numeric boxlinewidth ; boxlinewidth := 1pt ;
@@ -1166,6 +1167,7 @@ vardef baseline_grid (expr pxy, pdir, at_baseline) =
save i, grid, bb ; picture grid ; pair start ; path bb ;
def _do_ (expr start) =
draw start -- start shifted (bbwidth(pxy),0)
+ if boxdashtype = 1 : dashed evenly fi
withpen pencircle scaled boxgridwidth
withcolor boxgridcolor ;
enddef ;
diff --git a/metapost/context/base/mp-spec.mp b/metapost/context/base/mp-spec.mp
index 43d8f095c..d4c2b8cfc 100644
--- a/metapost/context/base/mp-spec.mp
+++ b/metapost/context/base/mp-spec.mp
@@ -230,14 +230,31 @@ enddef ;
vardef _is_spot_(expr c) =
(redpart c = _special_signal_/_special_div_) and (greenpart c = 2/_special_div_)
enddef ;
+vardef _is_gray_(expr c) =
+ (redpart c = greenpart c) and (greenpart c = bluepart c)
+enddef ;
numeric mp_shade_version ; mp_shade_version := 2 ; % more colors, needs new backend
vardef define_linear_shade (expr a, b, ca, cb) =
- if (mp_shade_version > 1) and _is_cmyk_(ca) and _is_cmyk_(cb) :
+ save cmyk_a, cmyk_b ; boolean cmyk_a, cmyk_b ;
+ save gray_a, gray_b ; boolean gray_a, gray_b ;
+ cmyk_a := _is_cmyk_(ca) ; gray_a := _is_gray_(ca) ;
+ cmyk_b := _is_cmyk_(cb) ; gray_b := _is_gray_(cb) ;
+ if (mp_shade_version > 1) and cmyk_a and cmyk_b :
flush_special(32, 17, "0 1 " & decimal shadefactor & " " &
cmykcolorpattern[bluepart ca] & " " & ddecimal (a shifted shadeoffset) & " " &
cmykcolorpattern[bluepart cb] & " " & ddecimal (b shifted shadeoffset) ) ;
+ elseif (mp_shade_version > 1) and cmyk_a and gray_b :
+ save cg ; color cg ; cg := cmyk(0,0,0,1-greenpart cb) ;
+ flush_special(32, 17, "0 1 " & decimal shadefactor & " " &
+ cmykcolorpattern[bluepart ca] & " " & ddecimal (a shifted shadeoffset) & " " &
+ cmykcolorpattern[bluepart cg] & " " & ddecimal (b shifted shadeoffset) ) ;
+ elseif (mp_shade_version > 1) and gray_a and cmyk_b :
+ save cg ; color cg ; cg := cmyk(0,0,0,1-greenpart ca) ;
+ flush_special(32, 17, "0 1 " & decimal shadefactor & " " &
+ cmykcolorpattern[bluepart cg] & " " & ddecimal (a shifted shadeoffset) & " " &
+ cmykcolorpattern[bluepart cb] & " " & ddecimal (b shifted shadeoffset) ) ;
elseif (mp_shade_version > 1) and _is_spot_(ca) and _is_spot_(cb) :
flush_special(34, 17, "0 1 " & decimal shadefactor & " " &
spotcolorpattern[bluepart ca] & " " & ddecimal (a shifted shadeoffset) & " " &
@@ -251,10 +268,24 @@ vardef define_linear_shade (expr a, b, ca, cb) =
enddef ;
vardef define_circular_shade (expr a, b, ra, rb, ca, cb) =
- if (mp_shade_version > 1) and _is_cmyk_(ca) and _is_cmyk_(cb) :
+ save cmyk_a, cmyk_b ; boolean cmyk_a, cmyk_b ;
+ save gray_a, gray_b ; boolean gray_a, gray_b ;
+ cmyk_a := _is_cmyk_(ca) ; gray_a := _is_gray_(ca) ;
+ cmyk_b := _is_cmyk_(cb) ; gray_b := _is_gray_(cb) ;
+ if (mp_shade_version > 1) and cmyk_a and cmyk_b :
flush_special(33, 19, "0 1 " & decimal shadefactor & " " &
cmykcolorpattern[bluepart ca] & " " & ddecimal (a shifted shadeoffset) & " " & decimal ra & " " &
cmykcolorpattern[bluepart cb] & " " & ddecimal (b shifted shadeoffset) & " " & decimal rb ) ;
+ elseif (mp_shade_version > 1) and cmyk_a and gray_b :
+ save cg ; color cg ; cg := cmyk(0,0,0,1-greenpart cb) ;
+ flush_special(33, 19, "0 1 " & decimal shadefactor & " " &
+ cmykcolorpattern[bluepart ca] & " " & ddecimal (a shifted shadeoffset) & " " & decimal ra & " " &
+ cmykcolorpattern[bluepart cg] & " " & ddecimal (b shifted shadeoffset) & " " & decimal rb ) ;
+ elseif (mp_shade_version > 1) and gray_a and cmyk_b :
+ save cg ; color cg ; cg := cmyk(0,0,0,1-greenpart ca) ;
+ flush_special(33, 19, "0 1 " & decimal shadefactor & " " &
+ cmykcolorpattern[bluepart cg] & " " & ddecimal (a shifted shadeoffset) & " " & decimal ra & " " &
+ cmykcolorpattern[bluepart cb] & " " & ddecimal (b shifted shadeoffset) & " " & decimal rb ) ;
elseif (mp_shade_version > 1) and _is_spot_(ca) and _is_spot_(cb) :
flush_special(35, 19, "0 1 " & decimal shadefactor & " " &
spotcolorpattern[bluepart ca] & " " & ddecimal (a shifted shadeoffset) & " " & decimal ra & " " &