20 likes | 129 Vues
This code snippet explains the preconditions for image-select-ellipse! function, listing width, left, operation, and their constraints. An image process is described using image-select-rectangle!, image-fill-selection! functions. The outcome includes a 100-edge square, a 50-edge square, a 100-edge square with a chunk removed, two rectangles, and a rectangle of width 80 and height 100.
E N D
What precondition would you NOT expect image-select-ellipse! to have? • width > 0 • left > 0 • (left + width) > 0 • operation is REPLACE, ADD, SUBTRACT, or INTERSECT • I’d expect it to have all of these preconditions.
What image does this describe?(define img (image-show (image-new 200 200))(image-select-rectangle! img REPLACE 50 50 100 100)(image-select-rectangle! img SUBTRACT 120 50 40 100)(image-fill-selection! img) • A square of edge length 100 • A square of edge length 50 • A square of edge length 100 with a small chunk taken out • Two rectangles • A rectangle of width 80 and height 100