From 41ddbec10d11b01ccc10bf7e1dc862a9f3e4c85f Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 8 Aug 2025 15:22:35 +1200 Subject: feat: Simplified API Had to restrict images to 8 bit depth sadly This could potentially be changed in the future by setting bit depth with templates and changing the data to be the specified bit depth --- src/image.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/image.cpp') diff --git a/src/image.cpp b/src/image.cpp index e23e3f6..77fe63c 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -15,7 +15,11 @@ Image::Image(const Image& other) this->filterMethod = other.filterMethod; this->interlaceMethod = other.interlaceMethod; - unsigned long imageDataSize = width * height * bpp; - imageData = std::make_unique(imageDataSize); - std::copy_n(other.imageData.get(), imageDataSize, imageData.get()); + pixels = std::make_unique(width*height); + std::copy_n(other.pixels.get(), width*height, pixels.get()); } + +Pixel& Image::operator[](int x, int y) +{ + return pixels[x + y*width]; +}; -- cgit v1.2.3