You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.7KB

  1. #lang racket
  2. (require "xml.rkt")
  3. (define-tag svg)
  4. (define-tag defs)
  5. (define-single-tag circle)
  6. (define-single-tag rect)
  7. (define-single-tag line)
  8. (define-single-tag use)
  9. (define-tag clipPath)
  10. (displayln
  11. (let
  12. ([doc-width 100]
  13. [doc-height 100]
  14. [stone-radius 5]
  15. [black-colour "#222222"]
  16. [white-colour "#DDDDDD"]
  17. [stone-border 1]
  18. [board-edge 2]
  19. [board-colour "#F9D77D"]
  20. [edge-colour "#000000"])
  21. (svg
  22. ([xmlns:xlink "http://www.w3.org/1999/xlink"]
  23. [width doc-width]
  24. [height doc-width])
  25. (defs ()
  26. (clipPath
  27. ([id "board-clip"])
  28. (rect
  29. ([width doc-width]
  30. [height doc-height])))
  31. (circle
  32. ([id "black-stone"]
  33. [cx 0]
  34. [cy 0]
  35. [r stone-radius]
  36. [stroke-width stone-border]
  37. [stroke white-colour]
  38. [fill black-colour]))
  39. (circle
  40. ([id "white-stone"]
  41. [cx 0]
  42. [cy 0]
  43. [r stone-radius]
  44. [stroke-width stone-border]
  45. [stroke black-colour]
  46. [fill white-colour])))
  47. (rect
  48. ([width doc-width]
  49. [height doc-height]
  50. [stroke edge-colour]
  51. [clip-path "url(#board-clip)"]
  52. [stroke-width (* 2 board-edge)]
  53. [fill board-colour]))
  54. (map (lambda (x)
  55. (use
  56. ([xlink:href "#black-stone"]
  57. [x (+ (/ doc-width 2)
  58. (* 30
  59. (cos (/ (* x pi)
  60. 180))))]
  61. [y (+ (/ doc-height 2)
  62. (* 30
  63. (sin (/ (* x pi)
  64. 180))))])))
  65. (range 0 360 40)))))
  66. (provide (all-defined-out))