1

I am trying to try and create an image using racket. I want to try and make a waffle but I can't seem to figure it out. This is my code:

#lang slideshow

(require 2htdp/image)

(define (waffle img)

    (define two-p (hc-append img (rectangle 10 10 "solid" "white") img (rectangle 10 10 "solid" "white") img))

    (vc-append two-p (rectangle 10 10 "solid" "white") two-p (rectangle 10 10 "solid" "white") two-p))

(circle 35 "solid" "yellow")

(waffle (rectangle 10 10 "solid" "brown"))

I want to overlay the rectangles onto the circle. How should I do this? Am I using the correct libraries or should I use a different one?

soegaard
  • 30,661
  • 4
  • 57
  • 106
Connie
  • 251
  • 4
  • 17
  • 1
    Have you looked at pict combinators like [`cc-superimpose`](https://docs.racket-lang.org/pict/Pict_Combiners.html#(def._((lib._pict%2Fmain..rkt)._cc-superimpose)))? – Alex Knauth Aug 25 '19 at 16:19

1 Answers1

1

I managed to solve it by using cc-superimpose! My code now looks like this:

#lang slideshow

(require 2htdp/image)

(define (waffle img)

  (define two-p (hc-append img (rectangle 10 10 "solid" "yellow") img (rectangle 10 10 "solid" "yellow") img))

  (vc-append two-p (rectangle 10 10 "solid" "yellow") two-p (rectangle 10 10 "solid" "yellow") two-p))

(cc-superimpose

 (circle 37 "solid" "yellow")

 (waffle (rectangle 10 10 "solid" "brown")))
Connie
  • 251
  • 4
  • 17