From 43a8204032842b163add049b2a80e4e69d302de9 Mon Sep 17 00:00:00 2001 From: vonhyou Date: Tue, 27 Feb 2024 21:23:24 -0500 Subject: [PATCH] make getters const --- src/Output.cc | 8 ++++---- src/Output.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Output.cc b/src/Output.cc index 81da024..e89ab7c 100644 --- a/src/Output.cc +++ b/src/Output.cc @@ -10,13 +10,13 @@ void Output::write() { for (unsigned int x = 0; x < width; ++x) fout << (char)(255.0f * red[y * width + x]) << (char)(255.0f * green[y * width + x]) - << (char)(255.0f * blue[y * width + x]); + << (char)(255.0f * blue[y * height + x]); fout.close(); } -float Output::r(int index) { return red.at(index); } -float Output::g(int index) { return green.at(index); } -float Output::b(int index) { return blue.at(index); } +float Output::r(int index) const { return red.at(index); } +float Output::g(int index) const { return green.at(index); } +float Output::b(int index) const { return blue.at(index); } void Output::r(int index, float value) { red.at(index) = value; } void Output::g(int index, float value) { green.at(index) = value; } void Output::b(int index, float value) { blue.at(index) = value; } diff --git a/src/Output.h b/src/Output.h index d7b9af9..68f9350 100644 --- a/src/Output.h +++ b/src/Output.h @@ -27,11 +27,11 @@ private: public: void r(int, float); - float r(int); + float r(int) const; void g(int, float); - float g(int); + float g(int) const; void b(int, float); - float b(int); + float b(int) const; }; #endif // !OUTPUT_H_