On this page:
svg-def-rect
4.1 rect
4.2 rect with start point(no padding)
4.3 rect with radius
4.4 multiple rect
7.7

4 Rectangle

 (require simple-svg) package: simple-svg

procedure

(svg-def-rect width    
  height    
  [#:radius? radius?])  string?
  width : natural?
  height : natural?
  radius? : (or/c #f (cons/c natural? natural?)) = #f
define a rectangle.

radius?: ’(radiusX . radiusY)

4.1 rect

(let ([rec (svg-def-rect 100 100)]
      [_sstyle (sstyle-new)])
 
  (sstyle-set! _sstyle 'fill "#BBC42A")
  (svg-use-shape rec _sstyle)
  (svg-show-default))

4.2 rect with start point(no padding)

(let ([rec (svg-def-rect 100 100)]
      [_sstyle (sstyle-new)])
 
  (sstyle-set! _sstyle 'fill "#BBC42A")
  (svg-use-shape rec _sstyle #:at? '(50 . 50))
  (svg-show-default))

4.3 rect with radius

(let ([rec (svg-def-rect 100 100 #:radius? '(5 . 10))]
      [_sstyle (sstyle-new)])
 
  (sstyle-set! _sstyle 'fill "#BBC42A")
  (svg-use-shape rec _sstyle)
  (svg-show-default))

4.4 multiple rect

(let (
      [blue_rec (svg-def-rect 150 150)]
      [_blue_sstyle (sstyle-new)]
      [green_rec (svg-def-rect 100 100)]
      [_green_sstyle (sstyle-new)]
      [red_rec (svg-def-rect 50 50)]
      [_red_sstyle (sstyle-new)])
 
  (sstyle-set! _blue_sstyle 'fill "blue")
  (svg-use-shape blue_rec _blue_sstyle)
 
  (sstyle-set! _green_sstyle 'fill "green")
  (svg-use-shape green_rec _green_sstyle #:at? '(25 . 25))
 
  (sstyle-set! _red_sstyle 'fill "red")
  (svg-use-shape red_rec _red_sstyle #:at? '(50 . 50))
 
  (svg-show-default))