From 6c76847e17134b9f8cea1144d0e10974ae2788e5 Mon Sep 17 00:00:00 2001
From: Brandon Rodriguez <brodriguez8774@gmail.com>
Date: Fri, 23 Apr 2021 13:09:11 -0400
Subject: [PATCH] Rename pixel data struct to be more intuitive

---
 part_1/image.cu | 22 +++++++++++-----------
 part_1/image.h  | 12 ++++++------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/part_1/image.cu b/part_1/image.cu
index d776917..06952d2 100644
--- a/part_1/image.cu
+++ b/part_1/image.cu
@@ -21,14 +21,14 @@
     #define LOGGING_CLASS_INIT
     extern Logging logger;
 #endif
-const Image::Rgb Image::pixelBlack = Image::Rgb(0);
-const Image::Rgb Image::pixelWhite = Image::Rgb(1);
-const Image::Rgb Image::pixelRed = Image::Rgb(1,0,0);
-const Image::Rgb Image::pixelGreen = Image::Rgb(0,1,0);
-const Image::Rgb Image::pixelBlue = Image::Rgb(0,0,1);
-const Image::Rgb Image::pixelYellow = Image::Rgb(1,1,0);
-const Image::Rgb Image::pixelPink = Image::Rgb(1,0,1);
-const Image::Rgb Image::pixelLiBlue = Image::Rgb(0,1,1);
+const Image::PixelStruct Image::pixelBlack = Image::PixelStruct(0);
+const Image::PixelStruct Image::pixelWhite = Image::PixelStruct(1);
+const Image::PixelStruct Image::pixelRed = Image::PixelStruct(1,0,0);
+const Image::PixelStruct Image::pixelGreen = Image::PixelStruct(0,1,0);
+const Image::PixelStruct Image::pixelBlue = Image::PixelStruct(0,0,1);
+const Image::PixelStruct Image::pixelYellow = Image::PixelStruct(1,1,0);
+const Image::PixelStruct Image::pixelPink = Image::PixelStruct(1,0,1);
+const Image::PixelStruct Image::pixelLiBlue = Image::PixelStruct(0,1,1);
 
 
 /**
@@ -98,7 +98,7 @@ void Image::import_image_file() {
         input_file >> width >> height >> bit_depth;
 
         // Create and populate image.
-        pixel_arr = new Rgb[width * height];
+        pixel_arr = new PixelStruct[width * height];
 
         // Skip empty lines in necessary until we get to the binary data.
         input_file.ignore(256, '\n');
@@ -135,10 +135,10 @@ Image::Image() {
     width = 10;
     height = 10;
     bit_depth = 255;
-    Rgb c = pixelBlack; // Default color. Can select based on below preset colors.
+    PixelStruct c = pixelBlack; // Default color. Can select based on below preset colors.
 
     // Create and populate image.
-    pixel_arr = new Rgb[width * height];
+    pixel_arr = new PixelStruct[width * height];
     for (int index = 0; index < (width * height); index++) {
         pixel_arr[index] = c;
     }
diff --git a/part_1/image.h b/part_1/image.h
index e5ceadc..4d9eb46 100644
--- a/part_1/image.h
+++ b/part_1/image.h
@@ -29,7 +29,7 @@ class Image {
          * According to https://stackoverflow.com/a/36917400, this is basically treated as a sub-class.
          * This allows creating multiple constructors, which will handle different scenarios of pixel input.
          */
-        struct Rgb {
+        struct PixelStruct {
             // Struct variables.
             float r, g, b;
 
@@ -40,9 +40,9 @@ class Image {
              * When a single float is provided, the second constructor sets all three rgb channels to that value.
              * Finally, when three floats are provided, the last constructor sets rgb channels accordingly.
              */
-            Rgb(): r(0), g(0), b(0) {}
-            Rgb(float c): r(c), g(c), b(c) {}
-            Rgb(float _r, float _g, float _b) : r(_r), g(_g), b(_b) {}
+            PixelStruct(): r(0), g(0), b(0) {}
+            PixelStruct(float c): r(c), g(c), b(c) {}
+            PixelStruct(float _r, float _g, float _b) : r(_r), g(_g), b(_b) {}
 
         };
 
@@ -52,7 +52,7 @@ class Image {
         unsigned int width;
         unsigned int height;
         int bit_depth;
-        Rgb *pixel_arr;     // Array of pixel data.
+        PixelStruct *pixel_arr;     // Array of pixel data.
 
         /**
          * Calculates class input_path and output_path values.
@@ -70,7 +70,7 @@ class Image {
 
     public:
         // Public Variables.
-        static const Rgb pixelBlack, pixelWhite, pixelRed, pixelGreen, pixelBlue, pixelYellow, pixelPink, pixelLiBlue;
+        static const PixelStruct pixelBlack, pixelWhite, pixelRed, pixelGreen, pixelBlue, pixelYellow, pixelPink, pixelLiBlue;
 
 
         //region Constructors.
-- 
GitLab