Thanks for your help hamsterman, Let me clarify. I did not want the original post to have large amounts of code.
These are Globals
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
int counter = 0;
const int MAXRGB = 255;
int redValue;
int greenValue;
int blueValue;
int i = 0;
pixel** ptr = NULL;
image myImage;
pixel myPixels;
|
bool loadImageFromFile(string filename)
INPUTS: a string containing a path to a file to open. This value is returned from the
user's selection in the open file dialog.
OUTPUTS: a Boolean indicating whether or not the image could be opened correctly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
//load the image from a file and return the result
bool loadImageFromFile(string filename)
{
ifstream inFile; // declare in file stream variable
inFile.open( filename.c_str() ); // open data file
// check to see if file will open, terminate the program if file failed to open
if ( inFile.fail() )
{
return false;
exit( 1 );
}
else
{
myImage.loadImage( filename );
return true;
}
inFile.close();
}
|
void saveImageToFile(string filename)
INPUTS: a string containing a path to save the current image out to.
OUTPUTS: NONE
1 2 3 4 5 6 7 8 9 10 11
|
//save an image to a file
void saveImageToFile(string filename)
{
ofstream outFile; // declare out file stream variable
outFile.open( filename.c_str() ); // open data out file
myImage.saveImage( filename );
outFile.close();
}
|
image* displayImage()
INPUTS: NONE
OUTPUTS: This function should return a pointer to the image object that is currently being viewed on the screen.
If a user has loaded an image correctly, you should return a pointer to an image object containing the base image.
If a user has used the shrink button (aka averageRegions function) or performed any of the red/green/blue filters,
you should of course return a pointer to an image object that reflects these changes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
//return a pointer to your image object!
image* displayImage()
{
// this is a mess because I am not sure what to do
image* p = NULL;
for (int j = 0; j < myImage.getHeight(); j++)
{
if( j == 0)
{
p = j;
return p;
}
}
return NULL;
}
|
I hope this answers your question and if you could help I would greatly appreciate it.
Thanks again