so I keep getting this error despite the fact that I am calling the class correctly if anybody could please help.
void PPM::sepiaFilter( PPM& dst ) const {
dst.setWidth( this->getWidth( ) );
dst.setHeight( this->getHeight( ) );
dst.setMaxColorValue( this->getMaxColorValue( ) );
double red = 0;
double green = 0;
double blue = 0;
for ( int y = 0; y <= this->getHeight( ); y++ ) {
for ( int x = 0; x <= this->getWidth( ); x++ ) {
red = this->getChannel( y, x, 0 );
green = this->getChannel( y, x, 1 );
blue = this->getChannel( y, x, 2 );
double new_red = 0.393 * red + 0.769 * green + 0.189 * blue;
double new_green = 0.349 * red + 0.686 * green + 0.168 * blue;
double new_blue = 0.272 * red + 0.534 * green + 0.131 * blue;
if ( new_red > this->getMaxColorValue( ) ) {
dst.setChannel( y, x, 0, this->getMaxColorValue( ) );
}
if ( new_green > this->getMaxColorValue( ) ) {
dst.setChannel( y, x, 1, this->getMaxColorValue( ) );
}
if ( new_blue > this->getMaxColorValue( ) ) {
dst.setChannel( y, x, 2, this->getMaxColorValue( ) );
}
dst.setChannel( y, x, 0, int ( new_red ) );
dst.setChannel( y, x, 1, int ( new_green ) );
dst.setChannel( y, x, 2, int ( new_blue ) );
}
}
}
I keep getting this error even though everything looks correct, No matter what I do. I have changed so many things to make this not throw an error and I just continue to throw the same error. If anybody could please help me find the situation so I can gladly move on with my life lol.
here is my .h file.
#ifndef _PPM_H_
#define _PPM_H_
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <algorithm>
class PPM {
public:
PPM( );
int getWidth( ) const;
int getHeight( ) const;
int getMaxColorValue( ) const;
int getChannel( const int& row, const int& column, const int& channel ) const;
void setWidth( const int& width );
void setHeight( const int& height );
void setMaxColorValue( const int& max_color_value );
void setChannel( const int& row, const int& column, const int& channel, const int& value );
int getting_width;
int rhs_width;
int rhs;
int lhs;
bool operator<(const PPM& rhs);
bool operator>(const PPM& rhs);
bool operator==(const PPM& rhs);
bool operator<=(const PPM& rhs);
bool operator>=(const PPM& rhs);
bool operator!=(const PPM& rhs);
PPM operator+=(const PPM& rhs);
PPM operator-=(const PPM& rhs);
PPM operator+(const PPM& rhs) const;
PPM operator-(const PPM& rhs) const;
PPM operator*(const PPM& rhs) const;
PPM operator*=(double d);
PPM operator/=(double d);
PPM operator*(double d) const;
PPM operator/(double d) const;
void sepiaFilter( PPM& dst ) const;
private:
int mWidth;
int mHeight;
int mMAX_COLOR;
int mRow;
int mColumn;
int mChannel;
std::vector < int > Pixel;
};
std::ostream& operator << (std::ostream& output, const PPM& Pic_out);
std::istream& operator >> (std::istream &input, PPM& Pic_in);
#endif /* _PPM_H_ */