1) You will need to find out about how images are stored as pixels,
and how these pixels are often stored in integers.
You should look at how to use the ’<<’ and ’>>’ operators in C
as well as the ’&’ operator for isolating the red, green and blue
components of an image. See
http://en.wikipedia.org/wiki/Pixels
Each pixel is a 32 bit integer and has the upper 8 bits as the alpha
channel (which you can ignore) and the lower 8 bits are the blue
pixel value (0-255). So a pixel’s bits are ARGB (from most to least
significant, 8 bits per channel). So you can extract the colours via:
red is ((image_data[row][column]>>16)&0xff)
blue is ((image_data[row][column]>>8)&0xff)
green is ((image_data[row][column])&0xff)
2) You will need to find out how to include the existing library
supplied by me, as well as your library in your compilation "cc"
command. Most of this is handled by the supplied Makefile. Once you
have adjusted this file, you should simply be able to type make ¿
Or make run ¿ will display the default image.
Or make run IMAGE=images/silhouette_76_small.jpg ¿ will display the
specified image.
See section on Makefiles in:
[edited]
3) Write a C library function that will invert the pixels in an image
whose name is supplied on the command line. The function will IMPORT a
2-D pixel array and EXPORT