Beginning of the program
The program begins in Listing 1.
If there is anything in Listing 1 that I haven't explained before, the comments should be self-explanatory.
Listing 1. Beginning of the program named ImageNegate03.
#include <allegro.h>
#include <stdio.h>//required to call sprintf
int main(){
int pixel = 0;//temporary storage for a pixel
//Temporary storage for red, green, and blue
int red = 0;
int green = 0;
int blue = 0;
int width = 0;//image width
int height = 0;//image height
int windowWidth = 0;//must be a multiple of 4 && >= 108
int windowHeight = 0;
//The addresses of the following variables are passed
// in the call to get_clip_rect, where they are
// populated with the coordinates of the diagonal
// corners of the rectangular image.
int upperLeftX = 0;
int upperLeftY = 0;
int lowerRightX = 0;
int lowerRightY = 0;
//Typical Allegro setup.
allegro_init();
install_keyboard();
set_color_depth(32);
//Declare a pointer variable capable of pointing to a
// bitmap.
BITMAP *picA = NULL;
//Load an image file from the current directory.
picA = load_bitmap("starfish.pcx", NULL);
|