Revert "Added pixel printing to terminal"

This reverts commit 7d9e250c68.
This commit is contained in:
nedko 2022-12-07 14:50:09 +02:00
parent 7d9e250c68
commit 6ee8f59859

View File

@ -1,6 +1,5 @@
#include <iostream>
#include <string>
#include <stdio.h>
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
@ -19,15 +18,6 @@ void usage(char *name)
cout << "Image must have 3 or more channels" << endl;
}
void print_pixel(ColourRGB rgb)
{
uint8_t r = static_cast<uint8_t>(round(rgb.r * 255));
uint8_t g = static_cast<uint8_t>(round(rgb.g * 255));
uint8_t b = static_cast<uint8_t>(round(rgb.b * 255));
printf("#%02x%02x%02x - %3d %3d %3d", r, g ,b, r, g, b);
}
int main(int argc, char **argv)
{
int x_size;
@ -85,6 +75,7 @@ int main(int argc, char **argv)
// TODO: Handle alpha here
}
// TODO: Add pixel to evaluator here
pixel_hsv = RGBtoHSV(pixel);
main_extractor.add_pixel(pixel_hsv);
comp_extractor.add_pixel(pixel_hsv);
@ -96,12 +87,7 @@ int main(int argc, char **argv)
pixel = HSVtoRGB(pixel_hsv);
pixel2 = HSVtoRGB(comp_extractor.extract_colour());
cout << "Main - ";
print_pixel(pixel);
cout << endl;
cout << "Comp - ";
print_pixel(pixel2);
cout << endl;
// TODO: Print them to console
x_size = 16;
y_size = 16;
@ -120,7 +106,7 @@ int main(int argc, char **argv)
image[i * channels + 2] = static_cast<unsigned char>(round(pixel.b * 255));
}
stbi_write_png("0 - main.png", x_size, y_size, channels, image, x_size * channels);
stbi_write_png("main.png", x_size, y_size, channels, image, x_size * channels);
for (int i = 0; i < x_size * y_size; ++i)
{
@ -129,7 +115,7 @@ int main(int argc, char **argv)
image[i * channels + 2] = static_cast<unsigned char>(round(pixel2.b * 255));
}
stbi_write_png("1 - comp.png", x_size, y_size, channels, image, x_size * channels);
stbi_write_png("comp.png", x_size, y_size, channels, image, x_size * channels);
delete[] image;