mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-18 22:30:30 +02:00
Restore of old painting
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
#include"Image/IntelliImage.h"
|
||||
#include <QPoint>
|
||||
#include <QWidget>
|
||||
#include <QList>
|
||||
|
||||
class PaintingArea : public QWidget
|
||||
{
|
||||
@@ -17,24 +16,19 @@ class PaintingArea : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PaintingArea(int maxWidth=1000, int maxHeight=800, QWidget *parent = nullptr);
|
||||
//create raster image 400*200
|
||||
PaintingArea(QWidget *parent = nullptr);
|
||||
PaintingArea(int width, int height, ImageType type, QWidget *parent = nullptr);
|
||||
|
||||
// Handles all events
|
||||
bool openImage(const QString &fileName);
|
||||
bool saveImage(const QString &fileName, const char *fileFormat);
|
||||
|
||||
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);
|
||||
void setPenColor(const QColor &newColor);
|
||||
void setPenWidth(int newWidth);
|
||||
|
||||
// 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:
|
||||
@@ -43,7 +37,7 @@ public slots:
|
||||
void clearImage();
|
||||
|
||||
//void setUp helper for konstruktor
|
||||
void setUp(int maxWidth, int maxHeight);
|
||||
void setUp();
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
@@ -57,22 +51,6 @@ 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);
|
||||
|
||||
@@ -89,6 +67,7 @@ private:
|
||||
QColor myPenColor;
|
||||
|
||||
// Stores the image being drawn
|
||||
IntelliImage* image;
|
||||
|
||||
// Stores the location at the current mouse event
|
||||
QPoint lastPoint;
|
||||
|
||||
Reference in New Issue
Block a user