Restructure project.
5
01/README.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Rozwiązania laboratoria 01
|
||||||
|
|
||||||
|
# Znajdują się w katalogu ./01/do_sprawdzenia/cpp/mysimplegimp
|
||||||
|
|
||||||
|
|
22
01/do_sprawdzenia/cpp/mysimplegimp/MySimpleGimp.pro
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
QT += core gui widgets
|
||||||
|
|
||||||
|
TARGET = MySimpleGimp
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
INCLUDEPATH += src/
|
||||||
|
|
||||||
|
SOURCES += src/main.cpp
|
||||||
|
|
||||||
|
include(src/core/core.pri)
|
||||||
|
include(src/gui/gui.pri)
|
||||||
|
|
||||||
|
RESOURCES += res/icons.qrc
|
||||||
|
|
||||||
|
CONFIG += c++11
|
||||||
|
OUTPUT += Console
|
||||||
|
gcc:QMAKE_CXXFLAGS += -Wno-ignored-qualifiers -Wno-unused-parameter -Wno-unused-variable -Wno-unused-but-set-variable -Wno-reorder
|
||||||
|
|
||||||
|
msvc {
|
||||||
|
QMAKE_CXXFLAGS_WARN_ON -= -W3
|
||||||
|
QMAKE_CXXFLAGS_WARN_ON += -W2
|
||||||
|
}
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 975 B After Width: | Height: | Size: 975 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1002 B After Width: | Height: | Size: 1002 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1023 B After Width: | Height: | Size: 1023 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
@ -0,0 +1,53 @@
|
|||||||
|
#include "conversion_grayscale.h"
|
||||||
|
#include <QDebug>
|
||||||
|
#include <iostream>
|
||||||
|
ConversionGrayscale::ConversionGrayscale(PNM* img) :
|
||||||
|
Transformation(img)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ConversionGrayscale::ConversionGrayscale(PNM* img, ImageViewer* iv) :
|
||||||
|
Transformation(img, iv)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PNM* ConversionGrayscale::transform()
|
||||||
|
{
|
||||||
|
int width = image->width();
|
||||||
|
int height = image->height();
|
||||||
|
|
||||||
|
PNM* newImage = new PNM(width, height, QImage::Format_Grayscale8);
|
||||||
|
|
||||||
|
if (image->format() == QImage::Format_Mono)
|
||||||
|
{
|
||||||
|
for (int x=0; x<width; x++){
|
||||||
|
for (int y=0; y<height; y++)
|
||||||
|
{
|
||||||
|
QColor color = QColor::fromRgb(image->pixel(x,y)); // Getting the pixel(x,y) value
|
||||||
|
newImage->setPixel(x,y, color == Qt::white ? PIXEL_VAL_MAX : PIXEL_VAL_MIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else // if (image->format() == QImage::Format_RGB32)
|
||||||
|
{
|
||||||
|
for (int x=0; x<width; x++)
|
||||||
|
{
|
||||||
|
for (int y=0; y<height; y++)
|
||||||
|
{
|
||||||
|
QRgb pixel = image->pixel(x,y); // Getting the pixel(x,y) value
|
||||||
|
//int r = qRed(pixel); // Get the 0-255 value of the R channel
|
||||||
|
//int g = qGreen(pixel); // Get the 0-255 value of the G channel
|
||||||
|
//int b = qBlue(pixel);
|
||||||
|
double r = qRed(pixel)*0.3;
|
||||||
|
double g = qGreen(pixel)*0.6;
|
||||||
|
double b = qBlue(pixel)*0.1;
|
||||||
|
QColor newPixel = QColor(r+g+b,r+g+b,r+g+b);
|
||||||
|
newImage->setPixel(x,y, newPixel.rgb());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newImage;
|
||||||
|
}
|