lvalue required as left operand of assignment

Hey, guys. I am working on a program that reads a .bmp image, rotates it, and saves as a new .bmp file.

The BMP() constructor creates an empty image.
readFromFile(const char* FileName) loads the .bmp image into the BMP class.
RGBApixel* operator()(int i, int j) returns a pointer to the color information stored at the pixel with x-coordinate whose x-coordinate is i and whose y-coordinate is j.

1
2
3
4
5
6
7
8
9
10
11
12
#include "EasyBMP.cpp"
#include <iostream>
using namespace std;

int main()
    {
        BMP originalImage;
	BMP rotatedImage;
	originalImage.readFromFile("in.bmp");
	rotatedImage.setSize(originalImage.tellWidth(),originalImage.tellHeight());
        rotatedImage(0,0) = originalImage(0,0)
    }


I expected that rotatedImage(0,0) = originalImage(0,0) would not work, but I do not know how else assign a pixel value to the rotatedImage. This line give me the error: lvalue required as left operand of assignment.

Any ideas? I am not provided with functions that allow me changing the pixels' values.

I am a beginner with C++ and I am super lost...

Thanks in advance!
Last edited on
Topic archived. No new replies allowed.