From ASMBits

Write a function that will draw a white square onto a 640×480, 16 bit per pixel image.

The image is an array of 640 pixels per row (left to right) and 480 rows (top to bottom), where each pixel is 16 bits (2 bytes) (Thus, there are 1280 bytes per row). The top-left corner of the image is pixel (0, 0), while the bottom right is pixel (639, 479). A white pixel has the 16-bit value 0xffff.

Draw a white square of the given size (width and height), with the upper-left corner of the square located at the given left and top pixels. The square will have size at least 1 pixel, and the entire square will fit in the image (you do not need to check for the square exceeding the image boundaries).

void square (void* image, int left, int top, int size);

Expected solution length: Around 20 lines.

Sample Input

square(Img, 1, 0, 3)

Sample Output

See below

Write your solution here

Upload a source file...