CS111

QuiltWorld Contract

Primitive Picture Methods

These methods return the basic building block Pictures you need to build the quilt.

public Picture patch(Color c)
Returns a Picture which is the entire picture grid filled with the color c. Looks like a 1×1 square of color c.

public Picture triangles(Color c1, Color c2)
Returns a Picture which divides the picture grid into two spaces along the diagonal from (0.0, 1.0) to (1.0, 0.0). The bottom section (including the point (0.0, 0.0)) is filled with the color c1 and the top section (including point (1.0, 1.0)) is filled with the color c2. Looks like splitting the 1×1 square into two triangles via a diagonal from the top left corner to the bottom right corner with the bottom triangle of color c1 and the top triangle of color c2.

Additional Picture Combining Methods

public Picture fourPics (Picture p1, Picture p2, Picture p3, Picture p4)
Returns a Picture which is the composition of dividing the picture grid into four equal quadrants and placing Picture p1 in the top left corner, Picture p2 in the top right corner, Picture p3 in the bottom left corner, and Picture p4 in the bottom right corner.
+----+----+ | | | | p1 | p2 | | | | +----+----+ | | | | p3 | p4 | | | | +----+----+

public Picture fourSame (Picture p)
Returns a Picture which is the composition of dividing the picture grid into four equal quadrants and placing Picture p into all four quadrants.

+---+---+ | | | | p | p | | | | +---+---+ | | | | p | p | | | | +---+---+

public Picture rotations (Picture p)
Returns a Picture which is the composition of dividing the picture grid into four equal quadrants and placing Picture p in the top right quadrant, Picture p rotated clockwise 90 degrees in the bottom right quadrant, Picture p rotated clockwise 180 degrees in the bottom left quadrant, and Picture p rotated clockwise 270 degrees in the top left quadrant. Looks like placing Picture p at the top right corner and then rotating it around the center of the picture grid.

+----+----+ | | | | | | -+ | +- | +----+----+ | -+ | +- | | | | | | +----+----+