aboutsummaryrefslogtreecommitdiff
path: root/src/image.cpp
diff options
context:
space:
mode:
authorDylan <boss@tehbox.org>2025-08-08 15:22:35 +1200
committerDylan <boss@tehbox.org>2025-08-08 15:38:59 +1200
commit41ddbec10d11b01ccc10bf7e1dc862a9f3e4c85f (patch)
treec4775a629588419803320818fc1458f6d35e8ae8 /src/image.cpp
parent5823a8dff5c6c565c9b253b122d2baeb767b72e2 (diff)
downloadtehimage-41ddbec10d11b01ccc10bf7e1dc862a9f3e4c85f.tar.gz
tehimage-41ddbec10d11b01ccc10bf7e1dc862a9f3e4c85f.zip
feat: Simplified APIv0.0.1
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
Diffstat (limited to 'src/image.cpp')
-rw-r--r--src/image.cpp10
1 files changed, 7 insertions, 3 deletions
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<uint8_t[]>(imageDataSize);
- std::copy_n(other.imageData.get(), imageDataSize, imageData.get());
+ pixels = std::make_unique<Pixel[]>(width*height);
+ std::copy_n(other.pixels.get(), width*height, pixels.get());
}
+
+Pixel& Image::operator[](int x, int y)
+{
+ return pixels[x + y*width];
+};