mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-16 21:30:31 +02:00
Start of Dev
This commit is contained in:
73
IntelliPhoto/IntelliPhoto/.gitignore
vendored
Normal file
73
IntelliPhoto/IntelliPhoto/.gitignore
vendored
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
# This file is used to ignore files which are generated
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
*~
|
||||||
|
*.autosave
|
||||||
|
*.a
|
||||||
|
*.core
|
||||||
|
*.moc
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
*.orig
|
||||||
|
*.rej
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*_pch.h.cpp
|
||||||
|
*_resource.rc
|
||||||
|
*.qm
|
||||||
|
.#*
|
||||||
|
*.*#
|
||||||
|
core
|
||||||
|
!core/
|
||||||
|
tags
|
||||||
|
.DS_Store
|
||||||
|
.directory
|
||||||
|
*.debug
|
||||||
|
Makefile*
|
||||||
|
*.prl
|
||||||
|
*.app
|
||||||
|
moc_*.cpp
|
||||||
|
ui_*.h
|
||||||
|
qrc_*.cpp
|
||||||
|
Thumbs.db
|
||||||
|
*.res
|
||||||
|
*.rc
|
||||||
|
/.qmake.cache
|
||||||
|
/.qmake.stash
|
||||||
|
|
||||||
|
# qtcreator generated files
|
||||||
|
*.pro.user*
|
||||||
|
|
||||||
|
# xemacs temporary files
|
||||||
|
*.flc
|
||||||
|
|
||||||
|
# Vim temporary files
|
||||||
|
.*.swp
|
||||||
|
|
||||||
|
# Visual Studio generated files
|
||||||
|
*.ib_pdb_index
|
||||||
|
*.idb
|
||||||
|
*.ilk
|
||||||
|
*.pdb
|
||||||
|
*.sln
|
||||||
|
*.suo
|
||||||
|
*.vcproj
|
||||||
|
*vcproj.*.*.user
|
||||||
|
*.ncb
|
||||||
|
*.sdf
|
||||||
|
*.opensdf
|
||||||
|
*.vcxproj
|
||||||
|
*vcxproj.*
|
||||||
|
|
||||||
|
# MinGW generated files
|
||||||
|
*.Debug
|
||||||
|
*.Release
|
||||||
|
|
||||||
|
# Python byte code
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Binaries
|
||||||
|
# --------
|
||||||
|
*.dll
|
||||||
|
*.exe
|
||||||
|
|
||||||
35
IntelliPhoto/IntelliPhoto/IntelliPhoto.pro
Normal file
35
IntelliPhoto/IntelliPhoto/IntelliPhoto.pro
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
QT += core gui
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
|
CONFIG += c++11
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any Qt feature that has been marked deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if it uses deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
LayerManager.cpp \
|
||||||
|
intelligui.cpp \
|
||||||
|
layer.cpp \
|
||||||
|
main.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
LayerManager.h \
|
||||||
|
intelligui.h \
|
||||||
|
layer.h
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
intelligui.ui
|
||||||
|
|
||||||
|
# Default rules for deployment.
|
||||||
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
|
!isEmpty(target.path): INSTALLS += target
|
||||||
80
IntelliPhoto/IntelliPhoto/LayerManager.cpp
Normal file
80
IntelliPhoto/IntelliPhoto/LayerManager.cpp
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
#include "LayerManager.h"
|
||||||
|
|
||||||
|
LayerManager::LayerManager(){
|
||||||
|
this->imgLabel = new QLabel("");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerManager::~LayerManager(){
|
||||||
|
delete this->imgLabel;
|
||||||
|
for(auto element:Ebenen){
|
||||||
|
delete element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int LayerManager::getLayerCount(){
|
||||||
|
return static_cast<int>(this->Ebenen.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerManager::setLayerVisbility(int idx, int alpha){
|
||||||
|
//current alpha is ignored, just one image is shown
|
||||||
|
for(auto &element: this->MetaEbenen){
|
||||||
|
element.a=0;
|
||||||
|
}
|
||||||
|
MetaEbenen[static_cast<size_t>(idx)].a=255;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerManager::activateLayer(int idx){
|
||||||
|
for(auto& element: this->MetaEbenen){
|
||||||
|
element.a = 0;
|
||||||
|
}
|
||||||
|
MetaEbenen[static_cast<size_t>(idx)].a=255;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerManager::goLayerUp(){
|
||||||
|
for(size_t i=0; i<static_cast<size_t>(this->getLayerCount()); i++){
|
||||||
|
if(this->MetaEbenen[i].a==255){
|
||||||
|
if(i==static_cast<size_t>(this->getLayerCount())-1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MetaEbenen[i].a=0;
|
||||||
|
MetaEbenen[i+1].a=255;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerManager::goLayerDown(){
|
||||||
|
for(size_t i=0; i<static_cast<size_t>(this->getLayerCount()); i++){
|
||||||
|
if(this->MetaEbenen[i].a==255){
|
||||||
|
if(i==0){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MetaEbenen[i].a=0;
|
||||||
|
MetaEbenen[i-1].a=255;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerManager::AddLayerAfer(int idx){
|
||||||
|
Layer* newLayer = new Layer(100,100);
|
||||||
|
Ebenen.insert(Ebenen.begin()+idx, newLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerManager::DeleteLayer(int idx){
|
||||||
|
Ebenen.erase(Ebenen.begin()+idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
QLabel* LayerManager::getDisplayable(){
|
||||||
|
//Tranzparenz der Ebenen muss möglich sein
|
||||||
|
QPixmap Map(maxWidth, maxHeight);
|
||||||
|
for(size_t i=0; i<static_cast<size_t>(this->getLayerCount()); i++){
|
||||||
|
if(MetaEbenen[i].a==255){
|
||||||
|
Map = Ebenen[i]->getAsPixmap();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this->imgLabel->setPixmap(Map);
|
||||||
|
return imgLabel;
|
||||||
|
}
|
||||||
43
IntelliPhoto/IntelliPhoto/LayerManager.h
Normal file
43
IntelliPhoto/IntelliPhoto/LayerManager.h
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#ifndef CANVAS_H
|
||||||
|
#define CANVAS_H
|
||||||
|
#include"layer.h"
|
||||||
|
|
||||||
|
#include<vector>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class LayerManager{
|
||||||
|
private:
|
||||||
|
struct EbenenMetaDaten{
|
||||||
|
unsigned int x;
|
||||||
|
unsigned int y;
|
||||||
|
unsigned int a;
|
||||||
|
EbenenMetaDaten(unsigned int x, unsigned int y, unsigned int a){
|
||||||
|
this->x = x;
|
||||||
|
this->y = y;
|
||||||
|
this->a = a;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
int maxWidth;
|
||||||
|
int maxHeight;
|
||||||
|
|
||||||
|
QLabel* imgLabel;
|
||||||
|
std::vector<Layer*> Ebenen;
|
||||||
|
std::vector<EbenenMetaDaten> MetaEbenen;
|
||||||
|
public:
|
||||||
|
LayerManager();
|
||||||
|
~LayerManager();
|
||||||
|
|
||||||
|
int getLayerCount();
|
||||||
|
void setLayerVisbility(int idx, int alpha);
|
||||||
|
void activateLayer(int idx);
|
||||||
|
void goLayerUp();
|
||||||
|
void goLayerDown();
|
||||||
|
void AddLayerAfer(int idx);
|
||||||
|
void DeleteLayer(int idx);
|
||||||
|
QLabel* getDisplayable();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CANVAS_H
|
||||||
36
IntelliPhoto/IntelliPhoto/intelligui.cpp
Normal file
36
IntelliPhoto/IntelliPhoto/intelligui.cpp
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#include "intelligui.h"
|
||||||
|
#include "ui_intelligui.h"
|
||||||
|
#include<QDebug>
|
||||||
|
#include<QGridLayout>
|
||||||
|
#include<QLabel>
|
||||||
|
#include<QColor>
|
||||||
|
|
||||||
|
IntelliGUI::IntelliGUI(QWidget *parent)
|
||||||
|
: QMainWindow(parent),
|
||||||
|
ui(new Ui::IntelliGUI){
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
IntelliGUI::~IntelliGUI(){
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliGUI::setColor(double R, double G, double B){
|
||||||
|
R *= 255;
|
||||||
|
G *= 255;
|
||||||
|
B *= 255;
|
||||||
|
QString color = "rgb(";
|
||||||
|
color += QString::number(R)+ ",";
|
||||||
|
color += QString::number(G)+ ",";
|
||||||
|
color += QString::number(B)+ ")";
|
||||||
|
this->setStyleSheet("background-color:"+color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IntelliGUI::setColor(int R, int G, int B){
|
||||||
|
QString color = "rgb(";
|
||||||
|
color += QString::number(R)+ ",";
|
||||||
|
color += QString::number(G)+ ",";
|
||||||
|
color += QString::number(B)+ ")";
|
||||||
|
this->setStyleSheet("background-color:"+color);
|
||||||
|
}
|
||||||
|
|
||||||
30
IntelliPhoto/IntelliPhoto/intelligui.h
Normal file
30
IntelliPhoto/IntelliPhoto/intelligui.h
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#ifndef INTELLIGUI_H
|
||||||
|
#define INTELLIGUI_H
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
namespace Ui { class IntelliGUI; }
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
class IntelliGUI : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
QWidget *GUI;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::IntelliGUI *ui;
|
||||||
|
QString color="rgb(255,255,255)";
|
||||||
|
|
||||||
|
public:
|
||||||
|
IntelliGUI(QWidget *parent = nullptr);
|
||||||
|
~IntelliGUI();
|
||||||
|
|
||||||
|
//COlor Values between 0 and 1
|
||||||
|
void setColor(double R, double G, double B);
|
||||||
|
void setColor(int R, int G, int B);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
};
|
||||||
|
#endif // INTELLIGUI_H
|
||||||
23
IntelliPhoto/IntelliPhoto/intelligui.ui
Normal file
23
IntelliPhoto/IntelliPhoto/intelligui.ui
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>IntelliGUI</class>
|
||||||
|
<widget class="QMainWindow" name="IntelliGUI">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>438</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>IntelliGUI</string>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget"/>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
27
IntelliPhoto/IntelliPhoto/layer.cpp
Normal file
27
IntelliPhoto/IntelliPhoto/layer.cpp
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#include "layer.h"
|
||||||
|
|
||||||
|
Layer::Layer(const int& width,const int& height){
|
||||||
|
this->Canvas = new QImage(width, height, QImage::Format::Format_ARGB32);
|
||||||
|
}
|
||||||
|
|
||||||
|
Layer::~Layer(){
|
||||||
|
delete this->Canvas;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Layer::setPixel(const int& w,const int& h,const int& a,const int& r,const int& g,const int& b){
|
||||||
|
QRgba64 clr;
|
||||||
|
clr.setRed(static_cast<quint16>(r));
|
||||||
|
clr.setGreen(static_cast<quint16>(g));
|
||||||
|
clr.setBlue(static_cast<quint16>(b));
|
||||||
|
clr.setAlpha(static_cast<quint16>(a));
|
||||||
|
this->Canvas->setPixelColor(w,h,QColor(clr));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Layer::loadImage(const QString& fileName){
|
||||||
|
//load of image an specifing fileformat needs to be implemented
|
||||||
|
}
|
||||||
|
|
||||||
|
QPixmap Layer::getAsPixmap(){
|
||||||
|
return QPixmap::fromImage(*(this->Canvas));
|
||||||
|
}
|
||||||
|
|
||||||
20
IntelliPhoto/IntelliPhoto/layer.h
Normal file
20
IntelliPhoto/IntelliPhoto/layer.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#ifndef LAYER_H
|
||||||
|
#define LAYER_H
|
||||||
|
#include<QImage>
|
||||||
|
#include<QPixmap>
|
||||||
|
#include<QString>
|
||||||
|
|
||||||
|
class Layer{
|
||||||
|
private:
|
||||||
|
QImage* Canvas;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
public:
|
||||||
|
Layer(const int& width,const int& height);
|
||||||
|
~Layer();
|
||||||
|
void setPixel(const int& w,const int& h,const int& a,const int& r,const int& g,const int& b);
|
||||||
|
void loadImage(const QString& fileName);
|
||||||
|
QPixmap getAsPixmap();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LAYER_H
|
||||||
26
IntelliPhoto/IntelliPhoto/main.cpp
Normal file
26
IntelliPhoto/IntelliPhoto/main.cpp
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#include "intelligui.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include<QHBoxLayout>
|
||||||
|
#include<QLabel>
|
||||||
|
#include<QPushButton>
|
||||||
|
#include<QImage>
|
||||||
|
#include<QPixmap>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication application(argc, argv);
|
||||||
|
IntelliGUI* win = new IntelliGUI();
|
||||||
|
QWidget *window = new QWidget(win);
|
||||||
|
win->setCentralWidget(window);
|
||||||
|
|
||||||
|
QGridLayout* Layout = new QGridLayout(window);
|
||||||
|
QPushButton* Button= new QPushButton("Button");
|
||||||
|
QImage* Canvas = new QImage(200,200, QImage::Format::Format_ARGB32);
|
||||||
|
QLabel* imgLabel = new QLabel("");
|
||||||
|
imgLabel->setPixmap(QPixmap::fromImage(*Canvas));
|
||||||
|
Layout->addWidget(imgLabel,0,0,10,10);
|
||||||
|
Layout->addWidget(Button,10,0);
|
||||||
|
win->show();
|
||||||
|
return application.exec();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user