diff options
Diffstat (limited to 'metapost/context/base/mp-char.mp')
-rw-r--r-- | metapost/context/base/mp-char.mp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/metapost/context/base/mp-char.mp b/metapost/context/base/mp-char.mp index fd9e33848..3a7a1d939 100644 --- a/metapost/context/base/mp-char.mp +++ b/metapost/context/base/mp-char.mp @@ -111,6 +111,7 @@ def new_chart = color xydraw [][] ; numeric xyline [][] ; boolean xypeep [][] ; + picture xypicture[][] ; numeric cpath ; cpath := 0 ; path cpaths [] ; @@ -233,6 +234,15 @@ def flush_shapes = endfor ; enddef ; +def flush_pictures = + for x=1 upto max_x : + for y=1 upto max_y : + flush_picture (x, y) ; + endfor ; + endfor ; +enddef ; + + def draw_connection_point (expr x, y, z) = pickup pencircle scaled if (z=0): 2 fi xyline[x][y] ; drawdot xy_bottom(x,y,z,false) scaled_to_grid withcolor (1,0,0) ; @@ -450,6 +460,16 @@ def draw_midpoint (expr n) = endgroup ; enddef ; +def flush_picture(expr x, y) = + if known xypicture[x][y]: + draw xypicture[x][y] shifted xy_offset((x+0.5)*grid_width,(max_y-y+1.5)*grid_height) ; + fi ; +enddef ; + +def chart_draw_picture(expr x, y, p) = + xypicture[x][y] := p ; +enddef ; + boolean reverse_connection ; reverse_connection := false ; vardef up_on_grid (expr n) = @@ -911,6 +931,7 @@ enddef ; def end_chart = flush_shapes ; flush_connections ; + flush_pictures ; cmin_x := cmin_x ; cmax_x := cmin_x+cmax_x ; cmin_y := cmin_y-1 ; |