Skip to content

Commit 87b0cd2

Browse files
committed
Added const to methods that do not modify the obj
1 parent abc6800 commit 87b0cd2

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

include/Image.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,15 @@ class Image : public ::Image {
216216
/**
217217
* Export image data to file, returns true on success
218218
*/
219-
inline bool Export(const std::string& fileName) {
219+
inline bool Export(const std::string& fileName) const {
220220
// TODO(RobLoach): Switch to an invalid loading exception on false.
221221
return ::ExportImage(*this, fileName.c_str());
222222
}
223223

224224
/**
225225
* Export image as code file defining an array of bytes, returns true on success
226226
*/
227-
inline bool ExportAsCode(const std::string& fileName) {
227+
inline bool ExportAsCode(const std::string& fileName) const {
228228
return ::ExportImageAsCode(*this, fileName.c_str());
229229
}
230230

@@ -237,21 +237,21 @@ class Image : public ::Image {
237237
/**
238238
* Retrieve the width and height of the image.
239239
*/
240-
inline ::Vector2 GetSize() {
240+
inline ::Vector2 GetSize() const {
241241
return {static_cast<float>(width), static_cast<float>(height)};
242242
}
243243

244244
/**
245245
* Create an image duplicate (useful for transformations)
246246
*/
247-
inline ::Image Copy() {
247+
inline ::Image Copy() const {
248248
return ::ImageCopy(*this);
249249
}
250250

251251
/**
252252
* Create an image from another image piece
253253
*/
254-
inline ::Image FromImage(::Rectangle rec) {
254+
inline ::Image FromImage(::Rectangle rec) const {
255255
return ::ImageFromImage(*this, rec);
256256
}
257257

@@ -557,35 +557,35 @@ class Image : public ::Image {
557557
/**
558558
* Load color data from image as a Color array (RGBA - 32bit)
559559
*/
560-
inline ::Color* LoadColors() {
560+
inline ::Color* LoadColors() const {
561561
return ::LoadImageColors(*this);
562562
}
563563

564564
/**
565565
* Load colors palette from image as a Color array (RGBA - 32bit)
566566
*/
567-
inline ::Color* LoadPalette(int maxPaletteSize, int *colorsCount) {
567+
inline ::Color* LoadPalette(int maxPaletteSize, int *colorsCount) const {
568568
return ::LoadImagePalette(*this, maxPaletteSize, colorsCount);
569569
}
570570

571571
/**
572572
* Unload color data loaded with LoadImageColors()
573573
*/
574-
inline void UnloadColors(::Color* colors) {
574+
inline void UnloadColors(::Color* colors) const {
575575
::UnloadImageColors(colors);
576576
}
577577

578578
/**
579579
* Unload colors palette loaded with LoadImagePalette()
580580
*/
581-
inline void UnloadPalette(::Color* colors) {
581+
inline void UnloadPalette(::Color* colors) const {
582582
::UnloadImagePalette(colors);
583583
}
584584

585585
/**
586586
* Load texture from image data
587587
*/
588-
inline ::Texture2D LoadTexture() {
588+
inline ::Texture2D LoadTexture() const {
589589
return ::LoadTextureFromImage(*this);
590590
}
591591

@@ -608,7 +608,7 @@ class Image : public ::Image {
608608
*
609609
* @return The pixel data size of the image.
610610
*/
611-
int GetPixelDataSize() {
611+
int GetPixelDataSize() const {
612612
return ::GetPixelDataSize(width, height, format);
613613
}
614614

include/Texture.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class Texture : public ::Texture {
8787
/**
8888
* Retrieve the width and height of the texture.
8989
*/
90-
inline ::Vector2 GetSize() {
90+
inline ::Vector2 GetSize() const {
9191
return {static_cast<float>(width), static_cast<float>(height)};
9292
}
9393

0 commit comments

Comments
 (0)