void RGBImageStudent::set(const RGBImageStudent &other) { RGBImage::set(other.getWidth(), other.getHeight()); for (int i = 0; i < this->getHeight()*this->getWidth(); i++) { pixelmap[i] = other.getPixel(i); } }
RGBImageStudent::RGBImageStudent(const RGBImageStudent &other) : RGBImage(other.getWidth(), other.getHeight()){ init_rgb_image(); for (int y = 0; y < height; y++){ for (int x = 0; x < width; x++){ rgb_image[x][y] = other.getPixel(x, y); } } }
RGBImageStudent::RGBImageStudent(const RGBImageStudent &other) : RGBImage(other.getWidth(), other.getHeight()), pixelMap(nullptr) { const int SIZE = other.getSize(); if (SIZE > 0) { pixelMap = new RGB[SIZE]; for (int i = 0; i < SIZE; i++) { pixelMap[i] = other.getPixel(i); } } }
void RGBImageStudent::set(const RGBImageStudent &other) { const int SIZE = other.getSize(); RGBImage::set(other.getWidth(), other.getHeight()); if (SIZE > 0) { delete[] pixelMap; pixelMap = new RGB[SIZE]; for (int i = 0; i < SIZE; i++) { pixelMap[i] = other.getPixel(i); } } }
void RGBImageStudent::set(const RGBImageStudent &other) { RGB** t_rgb_array = rgb_image; int old_height = height; width = other.width; height = other.height; init_rgb_image(); for (int y = 0; y < height; y++){ for (int x = 0; x < width; x++){ rgb_image[x][y] = other.getPixel(x, y); } } delete_rgb_array(t_rgb_array, old_height); }
RGBImageStudent::RGBImageStudent(const RGBImageStudent &other) : RGBImage{ other.getWidth(), other.getHeight() } { pixelmap = new RGB[this->getWidth() * this->getHeight()]; for (int i = 0; i < this->getHeight()*this->getWidth(); i++) { pixelmap[i] = other.getPixel(i); } }