redo old strcuture to dev

This commit is contained in:
Jonas Mucke
2019-12-04 18:02:14 +01:00
parent dd0899ff67
commit 69c2750358
33 changed files with 515 additions and 4942 deletions

View File

@@ -7,6 +7,7 @@
#include"Image/IntelliImage.h"
#include <QPoint>
#include <QWidget>
#include <QList>
class PaintingArea : public QWidget
{
@@ -16,20 +17,24 @@ class PaintingArea : public QWidget
Q_OBJECT
public:
//create raster image 400*200
PaintingArea(QWidget *parent = nullptr);
PaintingArea(int width, int height, ImageType type, QWidget *parent = nullptr);
PaintingArea(int maxWidth=1000, int maxHeight=800, QWidget *parent = nullptr);
// Handles all events
bool openImage(const QString &fileName);
bool saveImage(const QString &fileName, const char *fileFormat);
void setPenColor(const QColor &newColor);
void setPenWidth(int newWidth);
void standart_image();
void addLayer(int width, int height, int widthOffset=0, int heightOffset=0, ImageType type = ImageType::Raster_Image);
void deleteLayer(int index);
void setLayerToActive(int index);
void setAlphaToLayer(int index, int alpha);
// Has the image been modified since last save
bool isModified() const { return modified; }
void setPenColor(const QColor &newColor);
QColor penColor() const { return myPenColor; }
void setPenWidth(int newWidth);
int penWidth() const { return myPenWidth; }
public slots:
@@ -38,7 +43,7 @@ public slots:
void clearImage();
//void setUp helper for konstruktor
void setUp();
void setUp(int maxWidth, int maxHeight);
protected:
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
@@ -52,6 +57,22 @@ protected:
void resizeEvent(QResizeEvent *event) override;
private:
struct LayerObject{
IntelliImage* image;
int width;
int height;
int widthOffset;
int heightOffset;
int alpha=255;
};
QImage* Canvas;
int maxWidth;
int maxHeight;
std::vector<LayerObject> layerStructure;
int activeLayer=-1;
void drawLineTo(const QPoint &endPoint);
void resizeImage(QImage *image_res, const QSize &newSize);
@@ -68,7 +89,6 @@ private:
QColor myPenColor;
// Stores the image being drawn
IntelliImage* image;
// Stores the location at the current mouse event
QPoint lastPoint;