The obvious way to do this in Inkscape, using the Create Tiled Clones dialog, won't work as one cannot control the sizes and spacing properly. Instead, import into Inkscape the following simple PostScript program:
%!PS-Adobe-2.0
%% BoundingBox: 0 0 500 500
%% Copyright 2007 Tavmjong Bah
%% Squares...
/cell {
/cell_y2 exch def
/cell_x2 exch def
/cell_y1 exch def
/cell_x1 exch def
newpath
cell_x1 cell_y1 moveto
cell_x1 cell_y2 lineto
cell_x2 cell_y2 lineto
cell_x2 cell_y1 lineto
closepath
gsave
fill
grestore
0 setgray
stroke
} def
% Move to center
250 250 translate
% Global constants
/divs 11 def
/boxsize 200 def
% x stuff
/xmul 0 def
/xdiv divs def
/delxmul 1 xdiv 1 sub div def
xdiv 1 sub {
/x1 1 xmul 2 exp sub boxsize mul def
/xmul xmul delxmul add def
/x2 1 xmul 2 exp sub boxsize mul def
/myblue 1 xmul 2 exp sub def
% y stuff
/ymul 0 def
/ydiv divs def
/delymul 1 ydiv 1 sub div def
ydiv 1 sub {
/y1 1 ymul 2 exp sub boxsize mul def
/ymul ymul delymul add def
/y2 1 ymul 2 exp sub boxsize mul def
/myred 1 ymul 2 exp sub def
myred myblue 0.5 setrgbcolor
x1 y1 x2 y2 cell
myred myblue 0.5 setrgbcolor
x1 neg y1 x2 neg y2 cell
myred myblue 0.5 setrgbcolor
x1 y1 neg x2 y2 neg cell
myred myblue 0.5 setrgbcolor
x1 neg y1 neg x2 neg y2 neg cell
} repeat
} repeat
showpage
![]() | PostScript Programming |
|---|---|
|
Programming in PostScript is easy and fun! Check out the “Blue Book” (The PostScript® Language Tutorial and Cookbook) and the “Green Book” (PostScript Language Program Design), both available at the Adobe website. |
© 2005-2017 Tavmjong Bah.![]() | ![]() |