mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-13 03:40:31 +02:00
Automated Release Preparation
This commit is contained in:
@@ -20,7 +20,7 @@ IntelliPhotoGui::IntelliPhotoGui(){
|
||||
setIntelliStyle();
|
||||
// Size the app
|
||||
resize(600,600);
|
||||
setDefaultValues();
|
||||
setDefaultValues();
|
||||
}
|
||||
|
||||
// User tried to close the app
|
||||
@@ -51,28 +51,28 @@ void IntelliPhotoGui::slotOpen(){
|
||||
// If we have a file name load the image and place
|
||||
// it in the paintingArea
|
||||
if (!fileName.isEmpty()) {
|
||||
bool rightFileType =true;
|
||||
if(fileName.size()>=4){
|
||||
QString endung(".idf");
|
||||
int length = fileName.size();
|
||||
for(int i=0; i<4; i++){
|
||||
if(endung[i]!=fileName[length-4+i]){
|
||||
rightFileType = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool rightFileType = true;
|
||||
if(fileName.size()>=4) {
|
||||
QString endung(".idf");
|
||||
int length = fileName.size();
|
||||
for(int i = 0; i<4; i++) {
|
||||
if(endung[i]!=fileName[length - 4 + i]) {
|
||||
rightFileType = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(rightFileType){
|
||||
IntelliDatamanager::loadProject(paintingArea,fileName);
|
||||
UpdateGui();
|
||||
if(rightFileType) {
|
||||
IntelliDatamanager::loadProject(paintingArea,fileName);
|
||||
UpdateGui();
|
||||
|
||||
}
|
||||
else{
|
||||
paintingArea->open(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
paintingArea->open(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called when the user clicks Save As in the menu
|
||||
@@ -101,7 +101,7 @@ void IntelliPhotoGui::slotCreateNewRasterLayer(){
|
||||
|
||||
// Create New Layer
|
||||
if (ok1&&ok2) {
|
||||
paintingArea->addLayer(width,height,0,0,255,ImageType::RASTERIMAGE);
|
||||
paintingArea->addLayer(width,height,0,0,255,ImageType::RASTERIMAGE);
|
||||
UpdateGui();
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){
|
||||
|
||||
// Create New Layer
|
||||
if (ok1&&ok2) {
|
||||
paintingArea->addLayer(width, height, 0, 0,255, ImageType::SHAPEDIMAGE);
|
||||
paintingArea->addLayer(width, height, 0, 0,255, ImageType::SHAPEDIMAGE);
|
||||
UpdateGui();
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,6 @@ void IntelliPhotoGui::slotChangeDim(){
|
||||
int height = IntelliInputDialog::getInt("New Canvas Size", "Height:", 600, 1, 50000, 1, &ok2);
|
||||
|
||||
|
||||
|
||||
// Change dimension
|
||||
if (ok1&&ok2) {
|
||||
paintingArea->setLayerDimensions(width,height);
|
||||
@@ -349,11 +348,11 @@ void IntelliPhotoGui::slotSetInnerAlpha(){
|
||||
}
|
||||
|
||||
void IntelliPhotoGui::slotGoBack(){
|
||||
paintingArea->historyGoBack();
|
||||
paintingArea->historyGoBack();
|
||||
}
|
||||
|
||||
void IntelliPhotoGui::slotGoForward(){
|
||||
paintingArea->historyGoForward();
|
||||
paintingArea->historyGoForward();
|
||||
}
|
||||
|
||||
// Define menu actions that call functions
|
||||
@@ -385,13 +384,13 @@ void IntelliPhotoGui::createActions(){
|
||||
actionSaveAs.append(pngSaveAction);
|
||||
pngSaveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S));
|
||||
|
||||
QAction*projectSaveAction = new QAction("Projekt", this);
|
||||
projectSaveAction->setData("idf");
|
||||
// When clicked call IntelliPhotoGui::save()
|
||||
connect(projectSaveAction, SIGNAL(triggered()), this, SLOT(slotSave()));
|
||||
// Attach each PNG in save Menu
|
||||
actionSaveAs.append(projectSaveAction);
|
||||
projectSaveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
|
||||
QAction*projectSaveAction = new QAction("Projekt", this);
|
||||
projectSaveAction->setData("idf");
|
||||
// When clicked call IntelliPhotoGui::save()
|
||||
connect(projectSaveAction, SIGNAL(triggered()), this, SLOT(slotSave()));
|
||||
// Attach each PNG in save Menu
|
||||
actionSaveAs.append(projectSaveAction);
|
||||
projectSaveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
|
||||
|
||||
// Create exit action and tie to IntelliPhotoGui::close()
|
||||
actionExit = new QAction(tr("&Exit"), this);
|
||||
@@ -563,13 +562,13 @@ void IntelliPhotoGui::createActions(){
|
||||
actionSetInnerAlpha->setShortcut(QKeySequence(Qt::ALT + Qt::Key_A));
|
||||
connect(actionSetInnerAlpha, SIGNAL(triggered()), this, SLOT(slotSetInnerAlpha()));
|
||||
|
||||
actionGoBack = new QAction(tr("&Go back"),this);
|
||||
actionGoBack->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
|
||||
connect(actionGoBack, SIGNAL(triggered()), this, SLOT(slotGoBack()));
|
||||
actionGoBack = new QAction(tr("&Go back"),this);
|
||||
actionGoBack->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
|
||||
connect(actionGoBack, SIGNAL(triggered()), this, SLOT(slotGoBack()));
|
||||
|
||||
actionGoForward = new QAction(tr("&Go forward"),this);
|
||||
actionGoForward->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Y));
|
||||
connect(actionGoForward, SIGNAL(triggered()), this, SLOT(slotGoForward()));
|
||||
actionGoForward = new QAction(tr("&Go forward"),this);
|
||||
actionGoForward->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Y));
|
||||
connect(actionGoForward, SIGNAL(triggered()), this, SLOT(slotGoForward()));
|
||||
}
|
||||
|
||||
// Create the menubar
|
||||
@@ -643,8 +642,8 @@ void IntelliPhotoGui::createMenus(){
|
||||
|
||||
// Attach all actions to Options
|
||||
optionMenu = new QMenu(tr("&Options"), this);
|
||||
optionMenu->addAction(actionGoBack);
|
||||
optionMenu->addAction(actionGoForward);
|
||||
optionMenu->addAction(actionGoBack);
|
||||
optionMenu->addAction(actionGoForward);
|
||||
optionMenu->addMenu(layerMenu);
|
||||
optionMenu->addMenu(toolMenu);
|
||||
optionMenu->addSeparator();
|
||||
@@ -674,7 +673,7 @@ void IntelliPhotoGui::createGui(){
|
||||
// create Gui elements
|
||||
// get and set max width and height
|
||||
paintingArea = new PaintingArea(1280, 720);
|
||||
paintingArea->guiReference = this;
|
||||
paintingArea->guiReference = this;
|
||||
|
||||
preview = QPixmap(":/Icons/Buttons/icons/circle-tool.svg");
|
||||
CircleButton = new QPushButton();
|
||||
@@ -788,14 +787,14 @@ void IntelliPhotoGui::createGui(){
|
||||
QString String = QString("%1x%2").arg(paintingArea->Canvas->width()).arg(paintingArea->Canvas->height());
|
||||
dimCanvas->setText(String);
|
||||
|
||||
ScrollArea = new QScrollArea(this);
|
||||
ScrollArea->setBackgroundRole(QPalette::Dark);
|
||||
ScrollArea->setWidget(paintingArea);
|
||||
ScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
ScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
ScrollArea = new QScrollArea(this);
|
||||
ScrollArea->setBackgroundRole(QPalette::Dark);
|
||||
ScrollArea->setWidget(paintingArea);
|
||||
ScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
ScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
|
||||
// set gui elements
|
||||
mainLayout->addWidget(ScrollArea,1,1,20,1);
|
||||
mainLayout->addWidget(ScrollArea,1,1,20,1);
|
||||
mainLayout->addWidget(CircleButton,1,2,1,1);
|
||||
mainLayout->addWidget(FloodFillButton,1,3,1,1);
|
||||
mainLayout->addWidget(LineButton,2,2,1,1);
|
||||
@@ -872,10 +871,10 @@ bool IntelliPhotoGui::saveFile(const QByteArray &fileFormat){
|
||||
return false;
|
||||
} else {
|
||||
// Call for the file to be saved
|
||||
if(fileFormat == "idf"){
|
||||
return IntelliDatamanager::saveProject(paintingArea, fileName);
|
||||
if(fileFormat == "idf") {
|
||||
return IntelliDatamanager::saveProject(paintingArea, fileName);
|
||||
|
||||
}
|
||||
}
|
||||
return paintingArea->save(fileName, fileFormat.constData());
|
||||
}
|
||||
}
|
||||
@@ -907,7 +906,7 @@ void IntelliPhotoGui::UpdateGui(){
|
||||
}
|
||||
|
||||
|
||||
ActiveLayerImageLabel->setPixmap(preview.scaled(Buttonsize * 2));
|
||||
ActiveLayerImageLabel->setPixmap(preview.scaled(Buttonsize * 2));
|
||||
|
||||
string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name());
|
||||
FirstColorButton->setStyleSheet(string);
|
||||
@@ -918,9 +917,9 @@ void IntelliPhotoGui::UpdateGui(){
|
||||
dimCanvas->setText(string);
|
||||
|
||||
if(paintingArea->layerBundle.size() != 0) {
|
||||
string = QString("%1x%2").arg(paintingArea->layerBundle[static_cast<size_t>
|
||||
(paintingArea->getNumberOfActiveLayer())].width).arg(paintingArea->layerBundle[static_cast<size_t>
|
||||
(paintingArea->getNumberOfActiveLayer())].height);
|
||||
string = QString("%1x%2").arg(paintingArea->layerBundle[static_cast<size_t>
|
||||
(paintingArea->getNumberOfActiveLayer())].width).arg(paintingArea->layerBundle[static_cast<size_t>
|
||||
(paintingArea->getNumberOfActiveLayer())].height);
|
||||
dimActive->setText(string);
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -220,7 +220,6 @@ QAction* actionMoveLayerDown;
|
||||
QList<QAction*> actionSaveAs;
|
||||
|
||||
|
||||
|
||||
// history actions
|
||||
QAction* actionGoBack;
|
||||
QAction* actionGoForward;
|
||||
|
||||
@@ -160,14 +160,14 @@ void IntelliImage::updateRendererSetting(bool fastRendererOn){
|
||||
}
|
||||
}
|
||||
|
||||
int IntelliImage::getWidth() const{
|
||||
return imageData.width();
|
||||
int IntelliImage::getWidth() const {
|
||||
return imageData.width();
|
||||
}
|
||||
|
||||
int IntelliImage::getHeight() const{
|
||||
return imageData.height();
|
||||
int IntelliImage::getHeight() const {
|
||||
return imageData.height();
|
||||
}
|
||||
|
||||
bool IntelliImage::isFastRendering() const{
|
||||
return this->fastRenderering;
|
||||
bool IntelliImage::isFastRendering() const {
|
||||
return this->fastRenderering;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ class IntelliTool;
|
||||
* \brief The Types, which an Image can be.
|
||||
*/
|
||||
enum class ImageType {
|
||||
RASTERIMAGE,
|
||||
SHAPEDIMAGE
|
||||
RASTERIMAGE,
|
||||
SHAPEDIMAGE
|
||||
};
|
||||
|
||||
/*!
|
||||
|
||||
@@ -5,28 +5,27 @@
|
||||
|
||||
IntelliRasterImage::IntelliRasterImage(int width, int height, bool fastRendererOn)
|
||||
: IntelliImage(width, height, fastRendererOn){
|
||||
TypeOfImage = ImageType::RASTERIMAGE;
|
||||
TypeOfImage = ImageType::RASTERIMAGE;
|
||||
this->fastRenderering = fastRendererOn;
|
||||
}
|
||||
|
||||
|
||||
IntelliRasterImage* IntelliRasterImage::copy(const IntelliRasterImage& image){
|
||||
this->TypeOfImage = ImageType::RASTERIMAGE;
|
||||
IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height(), this->fastRenderering);
|
||||
raster->imageData.copy(0,0,image.getWidth(),image.getWidth());
|
||||
return raster;
|
||||
this->TypeOfImage = ImageType::RASTERIMAGE;
|
||||
IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height(), this->fastRenderering);
|
||||
raster->imageData.copy(0,0,image.getWidth(),image.getWidth());
|
||||
return raster;
|
||||
}
|
||||
|
||||
|
||||
|
||||
IntelliRasterImage::~IntelliRasterImage(){
|
||||
|
||||
}
|
||||
|
||||
IntelliImage* IntelliRasterImage::getDeepCopy(){
|
||||
IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height(), this->fastRenderering);
|
||||
IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height(), this->fastRenderering);
|
||||
raster->imageData.fill(Qt::transparent);
|
||||
raster->TypeOfImage = ImageType::RASTERIMAGE;
|
||||
raster->TypeOfImage = ImageType::RASTERIMAGE;
|
||||
return raster;
|
||||
}
|
||||
|
||||
@@ -61,5 +60,5 @@ void IntelliRasterImage::setPolygon(const std::vector<QPoint>& polygonData){
|
||||
}
|
||||
|
||||
std::vector<QPoint> IntelliRasterImage::getPolygon(){
|
||||
return std::vector<QPoint>();
|
||||
return std::vector<QPoint>();
|
||||
}
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
|
||||
IntelliShapedImage::IntelliShapedImage(int width, int height, bool fastRendererOn)
|
||||
: IntelliRasterImage(width, height, fastRendererOn){
|
||||
TypeOfImage = ImageType::SHAPEDIMAGE;
|
||||
TypeOfImage = ImageType::SHAPEDIMAGE;
|
||||
this->fastRenderering = fastRendererOn;
|
||||
}
|
||||
|
||||
IntelliShapedImage* IntelliShapedImage::copy(const IntelliShapedImage& image){
|
||||
this->TypeOfImage = ImageType::SHAPEDIMAGE;
|
||||
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), this->fastRenderering);
|
||||
shaped->imageData.copy(0,0,image.getWidth(),image.getWidth());
|
||||
return shaped;
|
||||
this->TypeOfImage = ImageType::SHAPEDIMAGE;
|
||||
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), this->fastRenderering);
|
||||
shaped->imageData.copy(0,0,image.getWidth(),image.getWidth());
|
||||
return shaped;
|
||||
}
|
||||
|
||||
IntelliShapedImage::~IntelliShapedImage(){
|
||||
@@ -26,10 +26,10 @@ QImage IntelliShapedImage::getDisplayable(int alpha){
|
||||
}
|
||||
|
||||
IntelliImage* IntelliShapedImage::getDeepCopy(){
|
||||
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), this->fastRenderering);
|
||||
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), this->fastRenderering);
|
||||
shaped->setPolygon(this->polygonData);
|
||||
shaped->imageData.fill(Qt::transparent);
|
||||
shaped->TypeOfImage = ImageType::SHAPEDIMAGE;
|
||||
shaped->TypeOfImage = ImageType::SHAPEDIMAGE;
|
||||
return shaped;
|
||||
}
|
||||
|
||||
@@ -120,5 +120,5 @@ void IntelliShapedImage::setPolygon(const std::vector<QPoint>& polygonData){
|
||||
}
|
||||
|
||||
std::vector<QPoint> IntelliShapedImage::getPolygon(){
|
||||
return polygonData;
|
||||
return polygonData;
|
||||
}
|
||||
|
||||
@@ -2,100 +2,100 @@
|
||||
#include "Layer/PaintingArea.h"
|
||||
|
||||
bool IntelliDatamanager::saveProject(PaintingArea* Canvas, QString filePath){
|
||||
QFile openFile(filePath);
|
||||
QFile openFile(filePath);
|
||||
|
||||
if(openFile.open(QIODevice::WriteOnly)){
|
||||
if(openFile.open(QIODevice::WriteOnly)) {
|
||||
|
||||
QTextStream out(&openFile);
|
||||
std::vector<LayerObject>* layerBundle = Canvas->getLayerBundle();
|
||||
size_t numberOfLayers = layerBundle->size();
|
||||
out << 7 << endl; //version tag
|
||||
out << Canvas->getRenderSettings() << " ";
|
||||
out << Canvas->getMaxWidth() << " " << Canvas->getMaxHeight() << endl; //dimensions of canvas
|
||||
out << numberOfLayers << endl; //number of layers
|
||||
for(size_t i = 0; i<numberOfLayers; i++){
|
||||
int width = layerBundle->at(i).width;
|
||||
int height = layerBundle->at(i).height;
|
||||
out << width << endl; //width
|
||||
out << height << endl; //height
|
||||
out << layerBundle->at(i).widthOffset << endl; //widthOffset
|
||||
out << layerBundle->at(i).heightOffset << endl; //HeightOffset
|
||||
out << layerBundle->at(i).alpha << endl; //alpha of layer
|
||||
if(layerBundle->at(i).image->getTypeOfImage() == ImageType::RASTERIMAGE){
|
||||
out << 0 << " ";
|
||||
}else{
|
||||
out << 1 << " ";
|
||||
}
|
||||
std::vector<QPoint> points = layerBundle->at(i).image->getPolygonData();
|
||||
out << points.size() << " ";
|
||||
for(size_t j = 0; j<points.size(); j++){
|
||||
out << points.at(j).x() << " " << points.at(j).y() << " ";
|
||||
}
|
||||
for(int j=0; j<height; j++){
|
||||
for(int k = 0; k<width; k++){
|
||||
QColor pixColor = layerBundle->at(i).image->getImageData().pixelColor(j,k);
|
||||
out << pixColor.red() << " " << pixColor.green() << " " << pixColor.blue() << " " << pixColor.alpha() << " ";
|
||||
}
|
||||
}
|
||||
QTextStream out(&openFile);
|
||||
std::vector<LayerObject>* layerBundle = Canvas->getLayerBundle();
|
||||
size_t numberOfLayers = layerBundle->size();
|
||||
out << 7 << endl; //version tag
|
||||
out << Canvas->getRenderSettings() << " ";
|
||||
out << Canvas->getMaxWidth() << " " << Canvas->getMaxHeight() << endl; //dimensions of canvas
|
||||
out << numberOfLayers << endl; //number of layers
|
||||
for(size_t i = 0; i<numberOfLayers; i++) {
|
||||
int width = layerBundle->at(i).width;
|
||||
int height = layerBundle->at(i).height;
|
||||
out << width << endl; //width
|
||||
out << height << endl; //height
|
||||
out << layerBundle->at(i).widthOffset << endl; //widthOffset
|
||||
out << layerBundle->at(i).heightOffset << endl; //HeightOffset
|
||||
out << layerBundle->at(i).alpha << endl; //alpha of layer
|
||||
if(layerBundle->at(i).image->getTypeOfImage() == ImageType::RASTERIMAGE) {
|
||||
out << 0 << " ";
|
||||
}else{
|
||||
out << 1 << " ";
|
||||
}
|
||||
std::vector<QPoint> points = layerBundle->at(i).image->getPolygonData();
|
||||
out << points.size() << " ";
|
||||
for(size_t j = 0; j<points.size(); j++) {
|
||||
out << points.at(j).x() << " " << points.at(j).y() << " ";
|
||||
}
|
||||
for(int j = 0; j<height; j++) {
|
||||
for(int k = 0; k<width; k++) {
|
||||
QColor pixColor = layerBundle->at(i).image->getImageData().pixelColor(j,k);
|
||||
out << pixColor.red() << " " << pixColor.green() << " " << pixColor.blue() << " " << pixColor.alpha() << " ";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
out << "\nFormat designed and approved by IntelliPhoto Team 7. All rigths reserved.";
|
||||
openFile.close();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
out << "\nFormat designed and approved by IntelliPhoto Team 7. All rigths reserved.";
|
||||
openFile.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IntelliDatamanager::loadProject(PaintingArea* Canvas, QString filePath){
|
||||
QFile openFile(filePath);
|
||||
Canvas->deleteAllLayers();
|
||||
if(openFile.open(QIODevice::ReadOnly)){
|
||||
QTextStream in(&openFile);
|
||||
QFile openFile(filePath);
|
||||
Canvas->deleteAllLayers();
|
||||
if(openFile.open(QIODevice::ReadOnly)) {
|
||||
QTextStream in(&openFile);
|
||||
|
||||
float version;
|
||||
int rendersetting;
|
||||
int widthCanvas, heightCanvas, numberOffLayers;
|
||||
in >> version;
|
||||
in >> rendersetting;
|
||||
in >> widthCanvas >> heightCanvas;
|
||||
in >> numberOffLayers;
|
||||
float version;
|
||||
int rendersetting;
|
||||
int widthCanvas, heightCanvas, numberOffLayers;
|
||||
in >> version;
|
||||
in >> rendersetting;
|
||||
in >> widthCanvas >> heightCanvas;
|
||||
in >> numberOffLayers;
|
||||
|
||||
Canvas->setLayerDimensions(widthCanvas, heightCanvas);
|
||||
for(int i=0; i<numberOffLayers; i++){
|
||||
int width, height, widthOffset, heightOffset, alpha;
|
||||
in >> width >> height >> widthOffset >> heightOffset >> alpha;
|
||||
Canvas->setLayerDimensions(widthCanvas, heightCanvas);
|
||||
for(int i = 0; i<numberOffLayers; i++) {
|
||||
int width, height, widthOffset, heightOffset, alpha;
|
||||
in >> width >> height >> widthOffset >> heightOffset >> alpha;
|
||||
|
||||
int typeFlag;
|
||||
size_t numberOfPoints;
|
||||
std::vector<QPoint> polyPoints;
|
||||
int typeFlag;
|
||||
size_t numberOfPoints;
|
||||
std::vector<QPoint> polyPoints;
|
||||
|
||||
in >> typeFlag >> numberOfPoints;
|
||||
if(typeFlag==0){
|
||||
Canvas->addLayer(width, height, widthOffset, heightOffset, alpha, ImageType::RASTERIMAGE);
|
||||
}else{
|
||||
Canvas->addLayer(width, height, widthOffset, heightOffset, alpha, ImageType::SHAPEDIMAGE);
|
||||
}
|
||||
polyPoints.reserve(numberOfPoints);
|
||||
for(size_t j=0; j<numberOfPoints; j++){
|
||||
int x, y;
|
||||
in >> x >> y;
|
||||
polyPoints.push_back(QPoint(x,y));
|
||||
}
|
||||
Canvas->setPolygonDataToActive(polyPoints);
|
||||
in >> typeFlag >> numberOfPoints;
|
||||
if(typeFlag==0) {
|
||||
Canvas->addLayer(width, height, widthOffset, heightOffset, alpha, ImageType::RASTERIMAGE);
|
||||
}else{
|
||||
Canvas->addLayer(width, height, widthOffset, heightOffset, alpha, ImageType::SHAPEDIMAGE);
|
||||
}
|
||||
polyPoints.reserve(numberOfPoints);
|
||||
for(size_t j = 0; j<numberOfPoints; j++) {
|
||||
int x, y;
|
||||
in >> x >> y;
|
||||
polyPoints.push_back(QPoint(x,y));
|
||||
}
|
||||
Canvas->setPolygonDataToActive(polyPoints);
|
||||
|
||||
for(int j=0; j<height; j++){
|
||||
for(int k = 0; k<width; k++){
|
||||
int red, green, blue, alpha;
|
||||
in >> red >> green >> blue >> alpha;
|
||||
Canvas->setPixelToActive(QColor(red, green, blue, alpha), QPoint(j, k));
|
||||
}
|
||||
}
|
||||
}
|
||||
Canvas->setRenderSettings(static_cast<bool>(rendersetting));
|
||||
openFile.close();
|
||||
return true;
|
||||
}
|
||||
for(int j = 0; j<height; j++) {
|
||||
for(int k = 0; k<width; k++) {
|
||||
int red, green, blue, alpha;
|
||||
in >> red >> green >> blue >> alpha;
|
||||
Canvas->setPixelToActive(QColor(red, green, blue, alpha), QPoint(j, k));
|
||||
}
|
||||
}
|
||||
}
|
||||
Canvas->setRenderSettings(static_cast<bool>(rendersetting));
|
||||
openFile.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
class PaintingArea;
|
||||
|
||||
namespace IntelliDatamanager{
|
||||
namespace IntelliDatamanager {
|
||||
|
||||
bool loadProject(PaintingArea* Canvas, QString filePath = "unnamed.idf");
|
||||
bool saveProject(PaintingArea* Canvas, QString filePath = "unnamed.idf");
|
||||
bool loadProject(PaintingArea* Canvas, QString filePath = "unnamed.idf");
|
||||
bool saveProject(PaintingArea* Canvas, QString filePath = "unnamed.idf");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -24,20 +24,20 @@ LayerObject::LayerObject(){
|
||||
}
|
||||
|
||||
LayerObject::LayerObject(const LayerObject& layer){
|
||||
if(layer.image->getTypeOfImage()==ImageType::RASTERIMAGE){
|
||||
this->image = new IntelliRasterImage(*dynamic_cast<IntelliRasterImage*>(layer.image));
|
||||
}else if(layer.image->getTypeOfImage()==ImageType::SHAPEDIMAGE){
|
||||
this->image = new IntelliShapedImage(*dynamic_cast<IntelliShapedImage*>(layer.image));
|
||||
}
|
||||
this->width = layer.width;
|
||||
this->height = layer.height;
|
||||
this->widthOffset = layer.widthOffset;
|
||||
this->heightOffset = layer.heightOffset;
|
||||
this->alpha = layer.alpha;
|
||||
if(layer.image->getTypeOfImage()==ImageType::RASTERIMAGE) {
|
||||
this->image = new IntelliRasterImage(*dynamic_cast<IntelliRasterImage*>(layer.image));
|
||||
}else if(layer.image->getTypeOfImage()==ImageType::SHAPEDIMAGE) {
|
||||
this->image = new IntelliShapedImage(*dynamic_cast<IntelliShapedImage*>(layer.image));
|
||||
}
|
||||
this->width = layer.width;
|
||||
this->height = layer.height;
|
||||
this->widthOffset = layer.widthOffset;
|
||||
this->heightOffset = layer.heightOffset;
|
||||
this->alpha = layer.alpha;
|
||||
}
|
||||
|
||||
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent)
|
||||
: QLabel(parent){
|
||||
: QLabel(parent){
|
||||
this->Tool = nullptr;
|
||||
this->setLayerDimensions(maxWidth, maxHeight);
|
||||
|
||||
@@ -66,7 +66,7 @@ void PaintingArea::setRenderSettings(bool isFastRenderingOn){
|
||||
}
|
||||
|
||||
bool PaintingArea::getRenderSettings(){
|
||||
return this->renderSettings.isFastRenderering();
|
||||
return this->renderSettings.isFastRenderering();
|
||||
}
|
||||
|
||||
void PaintingArea::setLayerDimensions(int maxWidth, int maxHeight){
|
||||
@@ -75,8 +75,8 @@ void PaintingArea::setLayerDimensions(int maxWidth, int maxHeight){
|
||||
this->maxHeight = maxHeight;
|
||||
Canvas = new QImage(maxWidth,maxHeight, QImage::Format_ARGB32);
|
||||
|
||||
this->offsetXDimension = maxWidth/2;
|
||||
this->offsetYDimension = maxHeight/2;
|
||||
this->offsetXDimension = maxWidth / 2;
|
||||
this->offsetYDimension = maxHeight / 2;
|
||||
|
||||
// Roots the widget to the top left even if resized
|
||||
setAttribute(Qt::WA_StaticContents);
|
||||
@@ -84,11 +84,11 @@ void PaintingArea::setLayerDimensions(int maxWidth, int maxHeight){
|
||||
}
|
||||
|
||||
void PaintingArea::setPixelToActive(QColor color, QPoint point){
|
||||
layerBundle[static_cast<size_t>(activeLayer)].image->drawPixel(point, color);
|
||||
layerBundle[static_cast<size_t>(activeLayer)].image->drawPixel(point, color);
|
||||
}
|
||||
|
||||
void PaintingArea::setPolygonDataToActive(std::vector<QPoint> points){
|
||||
layerBundle[static_cast<size_t>(activeLayer)].image->setPolygon(points);
|
||||
layerBundle[static_cast<size_t>(activeLayer)].image->setPolygon(points);
|
||||
}
|
||||
|
||||
int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOffset,int alpha, ImageType type){
|
||||
@@ -98,15 +98,15 @@ int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOff
|
||||
newLayer.height = height;
|
||||
newLayer.widthOffset = widthOffset;
|
||||
newLayer.heightOffset = heightOffset;
|
||||
newLayer.alpha = alpha;
|
||||
if(type==ImageType::RASTERIMAGE) {
|
||||
newLayer.alpha = alpha;
|
||||
if(type==ImageType::RASTERIMAGE) {
|
||||
newLayer.image = new IntelliRasterImage(width,height,renderSettings.isFastRenderering());
|
||||
}else if(type==ImageType::SHAPEDIMAGE) {
|
||||
}else if(type==ImageType::SHAPEDIMAGE) {
|
||||
newLayer.image = new IntelliShapedImage(width, height, renderSettings.isFastRenderering());
|
||||
}
|
||||
this->layerBundle.push_back(newLayer);
|
||||
activeLayer = static_cast<int>(layerBundle.size()) - 1;
|
||||
historyadd();
|
||||
historyadd();
|
||||
return activeLayer;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ void PaintingArea::slotDeleteActiveLayer(){
|
||||
this->layerBundle.erase(layerBundle.begin() + activeLayer);
|
||||
activeLayer--;
|
||||
}
|
||||
historyadd();
|
||||
historyadd();
|
||||
}
|
||||
|
||||
void PaintingArea::setLayerActive(int idx){
|
||||
@@ -150,7 +150,7 @@ void PaintingArea::setLayerAlpha(int idx, int alpha){
|
||||
}
|
||||
void PaintingArea::setPolygon(int idx){
|
||||
if(idx>=0&&idx<static_cast<int>(layerBundle.size())) {
|
||||
if(layerBundle[static_cast<size_t>(idx)].image->getTypeOfImage()==ImageType::SHAPEDIMAGE) {
|
||||
if(layerBundle[static_cast<size_t>(idx)].image->getTypeOfImage()==ImageType::SHAPEDIMAGE) {
|
||||
delete this->Tool;
|
||||
this->Tool = new IntelliToolPolygon(this,&colorPicker,&Toolsettings, true);
|
||||
isSettingPolygon = true;
|
||||
@@ -172,10 +172,10 @@ bool PaintingArea::open(const QString &filePath){
|
||||
}
|
||||
|
||||
void PaintingArea::deleteAllLayers(){
|
||||
for(auto layer: layerBundle){
|
||||
delete layer.image;
|
||||
}
|
||||
layerBundle.clear();
|
||||
for(auto layer: layerBundle) {
|
||||
delete layer.image;
|
||||
}
|
||||
layerBundle.clear();
|
||||
}
|
||||
|
||||
// Save the current image
|
||||
@@ -206,7 +206,7 @@ void PaintingArea::movePositionActive(int x, int y){
|
||||
updateTools();
|
||||
layerBundle[static_cast<size_t>(activeLayer)].widthOffset += x;
|
||||
layerBundle[static_cast<size_t>(activeLayer)].heightOffset += y;
|
||||
historyadd();
|
||||
historyadd();
|
||||
}
|
||||
|
||||
void PaintingArea::moveActiveLayer(int idx){
|
||||
@@ -217,7 +217,7 @@ void PaintingArea::moveActiveLayer(int idx){
|
||||
this->selectLayerDown();
|
||||
}
|
||||
guiReference->UpdateGui();
|
||||
historyadd();
|
||||
historyadd();
|
||||
}
|
||||
|
||||
void PaintingArea::slotActivateLayer(int a){
|
||||
@@ -276,11 +276,11 @@ void PaintingArea::createFloodFillTool(){
|
||||
}
|
||||
|
||||
int PaintingArea::getWidthOfActive(){
|
||||
return this->layerBundle[static_cast<size_t>(activeLayer)].width;
|
||||
return this->layerBundle[static_cast<size_t>(activeLayer)].width;
|
||||
}
|
||||
|
||||
int PaintingArea::getHeightOfActive(){
|
||||
return this->layerBundle[static_cast<size_t>(activeLayer)].height;
|
||||
return this->layerBundle[static_cast<size_t>(activeLayer)].height;
|
||||
}
|
||||
|
||||
int PaintingArea::getMaxWidth(){
|
||||
@@ -292,11 +292,11 @@ int PaintingArea::getMaxHeight(){
|
||||
}
|
||||
|
||||
ImageType PaintingArea::getTypeOfImageRealLayer(){
|
||||
return this->layerBundle[static_cast<size_t>(activeLayer)].image->getTypeOfImage();
|
||||
return this->layerBundle[static_cast<size_t>(activeLayer)].image->getTypeOfImage();
|
||||
}
|
||||
|
||||
std::vector<QPoint> PaintingArea::getPolygonDataOfRealLayer(){
|
||||
return this->layerBundle[static_cast<size_t>(activeLayer)].image->getPolygonData();
|
||||
return this->layerBundle[static_cast<size_t>(activeLayer)].image->getPolygonData();
|
||||
}
|
||||
|
||||
// If a mouse button is pressed check if it was the
|
||||
@@ -308,12 +308,12 @@ void PaintingArea::mousePressEvent(QMouseEvent*event){
|
||||
}
|
||||
if(Tool == nullptr)
|
||||
return;
|
||||
int x = event->x() - layerBundle[static_cast<size_t>(activeLayer)].widthOffset-offsetXDimension;
|
||||
int y = event->y() - layerBundle[static_cast<size_t>(activeLayer)].heightOffset-offsetYDimension;
|
||||
int x = event->x() - layerBundle[static_cast<size_t>(activeLayer)].widthOffset - offsetXDimension;
|
||||
int y = event->y() - layerBundle[static_cast<size_t>(activeLayer)].heightOffset - offsetYDimension;
|
||||
if(event->button() == Qt::LeftButton) {
|
||||
Tool->onMouseLeftPressed(x, y);
|
||||
Tool->onMouseLeftPressed(x, y);
|
||||
}else if(event->button() == Qt::RightButton) {
|
||||
Tool->onMouseRightPressed(x, y);
|
||||
Tool->onMouseRightPressed(x, y);
|
||||
}
|
||||
update();
|
||||
}
|
||||
@@ -327,8 +327,8 @@ void PaintingArea::mouseMoveEvent(QMouseEvent*event){
|
||||
}
|
||||
if(Tool == nullptr)
|
||||
return;
|
||||
int x = event->x() - layerBundle[static_cast<size_t>(activeLayer)].widthOffset-offsetXDimension;
|
||||
int y = event->y() - layerBundle[static_cast<size_t>(activeLayer)].heightOffset-offsetYDimension;
|
||||
int x = event->x() - layerBundle[static_cast<size_t>(activeLayer)].widthOffset - offsetXDimension;
|
||||
int y = event->y() - layerBundle[static_cast<size_t>(activeLayer)].heightOffset - offsetYDimension;
|
||||
Tool->onMouseMoved(x, y);
|
||||
update();
|
||||
}
|
||||
@@ -339,8 +339,8 @@ void PaintingArea::mouseReleaseEvent(QMouseEvent*event){
|
||||
return;
|
||||
if(Tool == nullptr)
|
||||
return;
|
||||
int x = event->x() - layerBundle[static_cast<size_t>(activeLayer)].widthOffset-offsetXDimension;
|
||||
int y = event->y() - layerBundle[static_cast<size_t>(activeLayer)].heightOffset-offsetYDimension;
|
||||
int x = event->x() - layerBundle[static_cast<size_t>(activeLayer)].widthOffset - offsetXDimension;
|
||||
int y = event->y() - layerBundle[static_cast<size_t>(activeLayer)].heightOffset - offsetYDimension;
|
||||
if(event->button() == Qt::LeftButton) {
|
||||
Tool->onMouseLeftReleased(x, y);
|
||||
}else if(event->button() == Qt::RightButton) {
|
||||
@@ -365,17 +365,17 @@ void PaintingArea::wheelEvent(QWheelEvent*event){
|
||||
// The QPaintEvent is sent to widgets that need to
|
||||
// update themselves
|
||||
void PaintingArea::paintEvent(QPaintEvent*event){
|
||||
this->setFixedSize(QSize(maxWidth*2,maxHeight*2));
|
||||
this->setFixedSize(QSize(maxWidth * 2,maxHeight * 2));
|
||||
this->drawLayers();
|
||||
|
||||
QPainter painter(this);
|
||||
QPainter painter(this);
|
||||
|
||||
//insert zoom factor here
|
||||
painter.scale(1,1);
|
||||
//insert zoom factor here
|
||||
painter.scale(1,1);
|
||||
|
||||
//calulate image here for scroll
|
||||
//Todo set offset in first to parameters and calulate them into mouse position
|
||||
painter.drawImage(0, 0, *Canvas, -offsetXDimension, -offsetYDimension);
|
||||
//calulate image here for scroll
|
||||
//Todo set offset in first to parameters and calulate them into mouse position
|
||||
painter.drawImage(0, 0, *Canvas, -offsetXDimension, -offsetYDimension);
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ void PaintingArea::selectLayerUp(){
|
||||
void PaintingArea::selectLayerDown(){
|
||||
updateTools();
|
||||
if(activeLayer>0) {
|
||||
std::swap(layerBundle[static_cast<size_t>(activeLayer)], layerBundle[static_cast<size_t>(activeLayer - 1)]);
|
||||
std::swap(layerBundle[static_cast<size_t>(activeLayer)], layerBundle[static_cast<size_t>(activeLayer - 1)]);
|
||||
activeLayer--;
|
||||
}
|
||||
}
|
||||
@@ -434,11 +434,11 @@ bool PaintingArea::createTempTopLayer(int idx){
|
||||
if(idx>=0) {
|
||||
LayerObject newLayer;
|
||||
newLayer.alpha = 255;
|
||||
newLayer.height = layerBundle[static_cast<size_t>(idx)].height;
|
||||
newLayer.width = layerBundle[static_cast<size_t>(idx)].width;
|
||||
newLayer.heightOffset = layerBundle[static_cast<size_t>(idx)].heightOffset;
|
||||
newLayer.widthOffset = layerBundle[static_cast<size_t>(idx)].widthOffset;
|
||||
newLayer.image = layerBundle[static_cast<size_t>(idx)].image->getDeepCopy();
|
||||
newLayer.height = layerBundle[static_cast<size_t>(idx)].height;
|
||||
newLayer.width = layerBundle[static_cast<size_t>(idx)].width;
|
||||
newLayer.heightOffset = layerBundle[static_cast<size_t>(idx)].heightOffset;
|
||||
newLayer.widthOffset = layerBundle[static_cast<size_t>(idx)].widthOffset;
|
||||
newLayer.image = layerBundle[static_cast<size_t>(idx)].image->getDeepCopy();
|
||||
layerBundle.insert(layerBundle.begin() + idx + 1,newLayer);
|
||||
return true;
|
||||
}
|
||||
@@ -485,7 +485,7 @@ QImage PaintingArea::getImageDataOfActiveLayer(){
|
||||
}
|
||||
|
||||
std::vector<LayerObject>* PaintingArea::getLayerBundle(){
|
||||
return &layerBundle;
|
||||
return &layerBundle;
|
||||
}
|
||||
|
||||
void PaintingArea::updateTools(){
|
||||
@@ -505,30 +505,30 @@ void PaintingArea::updateTools(){
|
||||
|
||||
void PaintingArea::historyadd(){
|
||||
|
||||
if (++historyPresent == 100){
|
||||
historyPresent = 0;
|
||||
}
|
||||
historyMaxFuture = historyPresent;
|
||||
if (historyPresent == historyMaxPast)
|
||||
if (++historyMaxPast == 100)
|
||||
historyMaxPast = 0;
|
||||
history[static_cast<size_t>(historyPresent)] = layerBundle;
|
||||
if (++historyPresent == 100) {
|
||||
historyPresent = 0;
|
||||
}
|
||||
historyMaxFuture = historyPresent;
|
||||
if (historyPresent == historyMaxPast)
|
||||
if (++historyMaxPast == 100)
|
||||
historyMaxPast = 0;
|
||||
history[static_cast<size_t>(historyPresent)] = layerBundle;
|
||||
}
|
||||
|
||||
void PaintingArea::historyGoBack(){
|
||||
if (historyPresent != historyMaxPast){
|
||||
if (--historyPresent == -1)
|
||||
historyPresent = 99;
|
||||
layerBundle = history[static_cast<size_t>(historyPresent)];
|
||||
}
|
||||
this->guiReference->UpdateGui();
|
||||
if (historyPresent != historyMaxPast) {
|
||||
if (--historyPresent == -1)
|
||||
historyPresent = 99;
|
||||
layerBundle = history[static_cast<size_t>(historyPresent)];
|
||||
}
|
||||
this->guiReference->UpdateGui();
|
||||
}
|
||||
|
||||
void PaintingArea::historyGoForward(){
|
||||
if (historyPresent != historyMaxFuture){
|
||||
if (++historyPresent == 100)
|
||||
historyPresent = 0;
|
||||
layerBundle = history[static_cast<size_t>(historyPresent)];
|
||||
}
|
||||
this->guiReference->UpdateGui();
|
||||
if (historyPresent != historyMaxFuture) {
|
||||
if (++historyPresent == 100)
|
||||
historyPresent = 0;
|
||||
layerBundle = history[static_cast<size_t>(historyPresent)];
|
||||
}
|
||||
this->guiReference->UpdateGui();
|
||||
}
|
||||
|
||||
@@ -46,9 +46,9 @@ struct LayerObject {
|
||||
*/
|
||||
int alpha = 255;
|
||||
|
||||
LayerObject();
|
||||
LayerObject();
|
||||
|
||||
LayerObject(const LayerObject& layer);
|
||||
LayerObject(const LayerObject& layer);
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -117,7 +117,7 @@ void deleteAllLayers();
|
||||
* \param type - Defining the ImageType of the new layer
|
||||
* \return Returns the number of layers in the project
|
||||
*/
|
||||
int addLayer(int width, int height, int widthOffset = 0, int heightOffset = 0, int alpha=255, ImageType type = ImageType::RASTERIMAGE);
|
||||
int addLayer(int width, int height, int widthOffset = 0, int heightOffset = 0, int alpha = 255, ImageType type = ImageType::RASTERIMAGE);
|
||||
/*!
|
||||
* \brief The addLayerAt adds a layer to the current project/ painting area at a specific position in the layer stack
|
||||
* \param idx - Index of the position the new layer should be added
|
||||
|
||||
@@ -90,7 +90,7 @@ void IntelliTool::mergeToolLayer(){
|
||||
activeLayer->image->setPolygon(Canvas->image->getPolygonData());
|
||||
}
|
||||
Area->guiReference->UpdateGui();
|
||||
Area->historyadd();
|
||||
Area->historyadd();
|
||||
}
|
||||
|
||||
void IntelliTool::deleteToolLayer(){
|
||||
|
||||
@@ -34,9 +34,9 @@ void IntelliToolFloodFill::onMouseLeftPressed(int x, int y){
|
||||
|
||||
QColor oldColor = this->activeLayer->image->getPixelColor(start);
|
||||
QColor newColor = this->colorPicker->getFirstColor();
|
||||
if(newColor == oldColor) {
|
||||
if(newColor == oldColor) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Canvas->image->drawPixel(start,newColor);
|
||||
|
||||
QPoint left, right, top, down;
|
||||
|
||||
@@ -24,7 +24,7 @@ IntelliToolPolygon::~IntelliToolPolygon(){
|
||||
}
|
||||
|
||||
void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
|
||||
if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == ImageType::SHAPEDIMAGE && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
|
||||
if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == ImageType::SHAPEDIMAGE && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
|
||||
if(Area->getPolygonDataOfRealLayer().size()>2) {
|
||||
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer());
|
||||
QPoint Point(x,y);
|
||||
@@ -37,7 +37,7 @@ void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
|
||||
isInside = true;
|
||||
}
|
||||
}
|
||||
else if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == ImageType::RASTERIMAGE && x >= 0 && y >= 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
|
||||
else if(!drawingOfPolygon && Area->getTypeOfImageRealLayer() == ImageType::RASTERIMAGE && x >= 0 && y >= 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
|
||||
isInside = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ void UnitTest::cleanupTestCase()
|
||||
|
||||
//test painting area
|
||||
void UnitTest::test_addLayer(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
QCOMPARE(area->layerBundle.size(), 1);
|
||||
QCOMPARE(area->activeLayer, 0);
|
||||
@@ -192,8 +192,8 @@ void UnitTest::test_addLayer(){
|
||||
}
|
||||
|
||||
void UnitTest::test_deleteLayer(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
area->deleteLayer(3);
|
||||
QCOMPARE(area->layerBundle.size(), 2);
|
||||
@@ -214,8 +214,8 @@ void UnitTest::test_deleteLayer(){
|
||||
}
|
||||
|
||||
void UnitTest::test_setActive(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
area->setLayerActive(0);
|
||||
QCOMPARE(area->activeLayer, 0);
|
||||
@@ -231,8 +231,8 @@ void UnitTest::test_setActive(){
|
||||
}
|
||||
|
||||
void UnitTest::test_setAlpha(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
area->setLayerAlpha(0,0);
|
||||
QCOMPARE(area->layerBundle[0].alpha, 0);
|
||||
@@ -254,7 +254,7 @@ void UnitTest::test_setAlpha(){
|
||||
}
|
||||
|
||||
void UnitTest::test_floodFill(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
QPoint point;
|
||||
@@ -279,8 +279,8 @@ void UnitTest::test_floodFill(){
|
||||
}
|
||||
|
||||
void UnitTest::test_moveActive(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
area->layerBundle[1].image->drawPlain(QColor(0, 0, 0, 255));
|
||||
QPoint point(0,0);
|
||||
@@ -306,8 +306,8 @@ void UnitTest::test_moveActive(){
|
||||
}
|
||||
|
||||
void UnitTest::test_setPolygon(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
std::vector<QPoint> polygon{
|
||||
QPoint(10,00),
|
||||
@@ -328,8 +328,8 @@ void UnitTest::test_setPolygon(){
|
||||
}
|
||||
|
||||
void UnitTest::test_setLayerUp(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
area->selectLayerUp();
|
||||
QCOMPARE(area->activeLayer, 1);
|
||||
@@ -345,8 +345,8 @@ void UnitTest::test_setLayerUp(){
|
||||
}
|
||||
|
||||
void UnitTest::test_setLayerDown(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
area->selectLayerDown();
|
||||
QCOMPARE(area->activeLayer, 0);
|
||||
@@ -386,7 +386,7 @@ void UnitTest::test_createTools(){
|
||||
|
||||
//test Raster-Image operations
|
||||
void UnitTest::test_RasterImage_drawPixel(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QPoint point(0,0);
|
||||
|
||||
@@ -399,7 +399,7 @@ void UnitTest::test_RasterImage_drawPixel(){
|
||||
}
|
||||
|
||||
void UnitTest::test_RasterImage_drawLine(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QPoint point1(0,0);
|
||||
QPoint point2(10,10);
|
||||
@@ -424,7 +424,7 @@ void UnitTest::test_RasterImage_drawLine(){
|
||||
}
|
||||
|
||||
void UnitTest::test_RasterImage_drawPoint(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QPoint point1(5,5);
|
||||
QPoint point2(5,6);
|
||||
@@ -444,7 +444,7 @@ void UnitTest::test_RasterImage_drawPoint(){
|
||||
}
|
||||
|
||||
void UnitTest::test_RasterImage_getDisplayable(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
QImage img = area->layerBundle[0].image->getDisplayable(QSize(200,200),255);
|
||||
@@ -461,7 +461,7 @@ void UnitTest::test_RasterImage_getDisplayable(){
|
||||
}
|
||||
|
||||
void UnitTest::test_RasterImage_getPixelColor(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QPoint point(0,0);
|
||||
area->layerBundle[0].image->drawPlain(QColor(0, 0, 0, 255));
|
||||
@@ -471,7 +471,7 @@ void UnitTest::test_RasterImage_getPixelColor(){
|
||||
}
|
||||
|
||||
void UnitTest::test_RasterImage_getImageData(){
|
||||
area->addLayer(2,2,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(2,2,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QImage img(2,2, QImage::Format_ARGB32);
|
||||
img.setPixelColor(0,0, Qt::red);
|
||||
@@ -496,7 +496,7 @@ void UnitTest::test_RasterImage_getImageData(){
|
||||
}
|
||||
|
||||
void UnitTest::test_RasterImage_setImageData(){
|
||||
area->addLayer(2,2,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(2,2,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QImage img(2,2, QImage::Format_ARGB32);
|
||||
img.setPixelColor(0,0, Qt::red);
|
||||
@@ -521,7 +521,7 @@ void UnitTest::test_RasterImage_setImageData(){
|
||||
|
||||
//test Shaped-Image operations
|
||||
void UnitTest::test_ShapedImage_drawPixel(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QPoint point(0,0);
|
||||
|
||||
@@ -534,7 +534,7 @@ void UnitTest::test_ShapedImage_drawPixel(){
|
||||
}
|
||||
|
||||
void UnitTest::test_ShapedImage_drawLine(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QPoint point1(0,0);
|
||||
QPoint point2(10,10);
|
||||
@@ -559,7 +559,7 @@ void UnitTest::test_ShapedImage_drawLine(){
|
||||
}
|
||||
|
||||
void UnitTest::test_ShapedImage_drawPoint(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QPoint point1(5,5);
|
||||
QPoint point2(5,6);
|
||||
@@ -579,7 +579,7 @@ void UnitTest::test_ShapedImage_drawPoint(){
|
||||
}
|
||||
|
||||
void UnitTest::test_ShapedImage_getDisplayable(){
|
||||
area->addLayer(21,21,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(21,21,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
std::vector<QPoint> points{
|
||||
QPoint(10,00),
|
||||
QPoint(00,10),
|
||||
@@ -614,7 +614,7 @@ void UnitTest::test_ShapedImage_getDisplayable(){
|
||||
}
|
||||
|
||||
void UnitTest::test_ShapedImage_getPixelColor(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QPoint point(0,0);
|
||||
area->layerBundle[0].image->drawPlain(QColor(0, 0, 0, 255));
|
||||
@@ -624,7 +624,7 @@ void UnitTest::test_ShapedImage_getPixelColor(){
|
||||
}
|
||||
|
||||
void UnitTest::test_ShapedImage_getImageData(){
|
||||
area->addLayer(2,2,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(2,2,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QImage img(2,2, QImage::Format_ARGB32);
|
||||
img.setPixelColor(0,0, Qt::red);
|
||||
@@ -649,7 +649,7 @@ void UnitTest::test_ShapedImage_getImageData(){
|
||||
}
|
||||
|
||||
void UnitTest::test_ShapedImage_setImageData(){
|
||||
area->addLayer(2,2,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(2,2,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QImage img(2,2, QImage::Format_ARGB32);
|
||||
img.setPixelColor(0,0, Qt::red);
|
||||
@@ -674,7 +674,7 @@ void UnitTest::test_ShapedImage_setImageData(){
|
||||
|
||||
//test tools
|
||||
void UnitTest::test_Circle_fullDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createCircleTool();
|
||||
@@ -694,7 +694,7 @@ void UnitTest::test_Circle_fullDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::test_Circle_interruptedDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createCircleTool();
|
||||
@@ -718,7 +718,7 @@ void UnitTest::test_Circle_interruptedDraw(){
|
||||
|
||||
|
||||
void UnitTest::test_FloodFill_fullDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createFloodFillTool();
|
||||
@@ -738,7 +738,7 @@ void UnitTest::test_FloodFill_fullDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::test_FloodFill_interruptedDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createFloodFillTool();
|
||||
@@ -761,7 +761,7 @@ void UnitTest::test_FloodFill_interruptedDraw(){
|
||||
|
||||
|
||||
void UnitTest::test_Line_fullDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createLineTool();
|
||||
@@ -781,7 +781,7 @@ void UnitTest::test_Line_fullDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::test_Line_interruptedDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createLineTool();
|
||||
@@ -803,7 +803,7 @@ void UnitTest::test_Line_interruptedDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::test_Pen_fullDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPenTool();
|
||||
@@ -823,7 +823,7 @@ void UnitTest::test_Pen_fullDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::test_Pen_interruptedDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPenTool();
|
||||
@@ -845,7 +845,7 @@ void UnitTest::test_Pen_interruptedDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::test_Plain_fullDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPlainTool();
|
||||
@@ -865,7 +865,7 @@ void UnitTest::test_Plain_fullDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::test_Plain_interruptedDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPlainTool();
|
||||
@@ -887,7 +887,7 @@ void UnitTest::test_Plain_interruptedDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::test_Polygon_fullDraw(){
|
||||
area->addLayer(21,21,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(21,21,10,20,255,ImageType::RASTERIMAGE);
|
||||
std::vector<QPoint> points{
|
||||
QPoint(10,00),
|
||||
QPoint(00,10),
|
||||
@@ -944,7 +944,7 @@ void UnitTest::test_Polygon_fullDraw(){
|
||||
|
||||
|
||||
void UnitTest::test_Polygon_interruptedDraw(){
|
||||
area->addLayer(201,201,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(201,201,10,20,255,ImageType::RASTERIMAGE);
|
||||
std::vector<QPoint> points{
|
||||
QPoint(100,000),
|
||||
QPoint(000,100),
|
||||
@@ -1000,7 +1000,7 @@ void UnitTest::test_Polygon_interruptedDraw(){
|
||||
|
||||
|
||||
void UnitTest::test_Rectangle_fullDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createRectangleTool();
|
||||
@@ -1022,7 +1022,7 @@ void UnitTest::test_Rectangle_fullDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::test_Rectangle_interruptedDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createRectangleTool();
|
||||
@@ -1078,21 +1078,21 @@ void UnitTest::test_Triangulation_Coverage(){
|
||||
|
||||
void UnitTest::bench_addLayer(){
|
||||
QBENCHMARK{
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
}
|
||||
area->deleteLayer(0);
|
||||
}
|
||||
|
||||
void UnitTest::bench_deleteLayer(){
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
QBENCHMARK{
|
||||
area->deleteLayer(0);
|
||||
}
|
||||
}
|
||||
|
||||
void UnitTest::bench_setActive(){
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QBENCHMARK{
|
||||
area->setLayerActive(0);
|
||||
@@ -1103,7 +1103,7 @@ void UnitTest::bench_setActive(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_setAlpha(){
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QBENCHMARK{
|
||||
area->setLayerAlpha(0,0);
|
||||
@@ -1113,7 +1113,7 @@ void UnitTest::bench_setAlpha(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_floodFill(){
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QBENCHMARK{
|
||||
area->layerBundle[0].image->drawPlain(QColor(255, 255, 255, 255));
|
||||
@@ -1123,8 +1123,8 @@ void UnitTest::bench_floodFill(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_moveActive(){
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,0,0,255,ImageType::RASTERIMAGE);
|
||||
|
||||
area->setLayerActive(0);
|
||||
QBENCHMARK{
|
||||
@@ -1136,7 +1136,7 @@ void UnitTest::bench_moveActive(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_setPolygon(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
std::vector<QPoint> polygon{
|
||||
QPoint(10,00),
|
||||
@@ -1153,8 +1153,8 @@ void UnitTest::bench_setPolygon(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_setLayerUp(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
area->setLayerActive(0);
|
||||
QBENCHMARK{
|
||||
@@ -1166,8 +1166,8 @@ void UnitTest::bench_setLayerUp(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_setLayerDown(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QBENCHMARK{
|
||||
area->selectLayerDown();
|
||||
@@ -1208,7 +1208,7 @@ void UnitTest::bench_createTools(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_RasterImage_drawPixel(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QPoint point(0,0);
|
||||
|
||||
@@ -1220,7 +1220,7 @@ void UnitTest::bench_RasterImage_drawPixel(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_RasterImage_drawLine(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QPoint point1(000,000);
|
||||
QPoint point2(200,200);
|
||||
@@ -1233,7 +1233,7 @@ void UnitTest::bench_RasterImage_drawLine(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_RasterImage_drawPoint(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QPoint point(000,000);
|
||||
|
||||
@@ -1245,7 +1245,7 @@ void UnitTest::bench_RasterImage_drawPoint(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_RasterImage_getDisplayable(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QBENCHMARK{
|
||||
area->layerBundle[0].image->getDisplayable(QSize(200,200),255);
|
||||
@@ -1255,7 +1255,7 @@ void UnitTest::bench_RasterImage_getDisplayable(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_RasterImage_getPixelColor(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QPoint point(000,000);
|
||||
|
||||
@@ -1267,7 +1267,7 @@ void UnitTest::bench_RasterImage_getPixelColor(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_RasterImage_getImageData(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QBENCHMARK{
|
||||
area->layerBundle[0].image->getImageData();
|
||||
@@ -1277,7 +1277,7 @@ void UnitTest::bench_RasterImage_getImageData(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_RasterImage_setImageData(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
|
||||
QImage img = area->layerBundle[0].image->getImageData();
|
||||
QBENCHMARK{
|
||||
@@ -1288,7 +1288,7 @@ void UnitTest::bench_RasterImage_setImageData(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_ShapedImage_drawPixel(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
QPoint point(0,0);
|
||||
|
||||
@@ -1300,7 +1300,7 @@ void UnitTest::bench_ShapedImage_drawPixel(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_ShapedImage_drawLine(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
QPoint point1(000,000);
|
||||
QPoint point2(200,200);
|
||||
@@ -1313,7 +1313,7 @@ void UnitTest::bench_ShapedImage_drawLine(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_ShapedImage_drawPoint(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
QPoint point(000,000);
|
||||
|
||||
@@ -1325,7 +1325,7 @@ void UnitTest::bench_ShapedImage_drawPoint(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_ShapedImage_getDisplayable(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
QBENCHMARK{
|
||||
area->layerBundle[0].image->getDisplayable(QSize(200,200),255);
|
||||
@@ -1335,7 +1335,7 @@ void UnitTest::bench_ShapedImage_getDisplayable(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_ShapedImage_getPixelColor(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
QPoint point(000,000);
|
||||
|
||||
@@ -1347,7 +1347,7 @@ void UnitTest::bench_ShapedImage_getPixelColor(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_ShapedImage_getImageData(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
QBENCHMARK{
|
||||
area->layerBundle[0].image->getImageData();
|
||||
@@ -1357,7 +1357,7 @@ void UnitTest::bench_ShapedImage_getImageData(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_ShapedImage_setImageData(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::SHAPEDIMAGE);
|
||||
|
||||
QImage img = area->layerBundle[0].image->getImageData();
|
||||
QBENCHMARK{
|
||||
@@ -1368,7 +1368,7 @@ void UnitTest::bench_ShapedImage_setImageData(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_Circle_fullDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createCircleTool();
|
||||
@@ -1386,7 +1386,7 @@ void UnitTest::bench_Circle_fullDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_Circle_interruptedDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createCircleTool();
|
||||
@@ -1407,7 +1407,7 @@ void UnitTest::bench_Circle_interruptedDraw(){
|
||||
|
||||
|
||||
void UnitTest::bench_FloodFill_fullDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createFloodFillTool();
|
||||
@@ -1425,7 +1425,7 @@ void UnitTest::bench_FloodFill_fullDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_FloodFill_interruptedDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createFloodFillTool();
|
||||
@@ -1446,7 +1446,7 @@ void UnitTest::bench_FloodFill_interruptedDraw(){
|
||||
|
||||
|
||||
void UnitTest::bench_Line_fullDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createLineTool();
|
||||
@@ -1464,7 +1464,7 @@ void UnitTest::bench_Line_fullDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_Line_interruptedDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createLineTool();
|
||||
@@ -1485,7 +1485,7 @@ void UnitTest::bench_Line_interruptedDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_Pen_fullDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPenTool();
|
||||
@@ -1503,7 +1503,7 @@ void UnitTest::bench_Pen_fullDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_Pen_interruptedDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPenTool();
|
||||
@@ -1523,7 +1523,7 @@ void UnitTest::bench_Pen_interruptedDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_Plain_fullDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPlainTool();
|
||||
@@ -1541,7 +1541,7 @@ void UnitTest::bench_Plain_fullDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_Plain_interruptedDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createPlainTool();
|
||||
@@ -1561,7 +1561,7 @@ void UnitTest::bench_Plain_interruptedDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_Polygon_fullDraw(){
|
||||
area->addLayer(21,21,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(21,21,10,20,255,ImageType::RASTERIMAGE);
|
||||
std::vector<QPoint> points{
|
||||
QPoint(10,00),
|
||||
QPoint(00,10),
|
||||
@@ -1600,7 +1600,7 @@ void UnitTest::bench_Polygon_fullDraw(){
|
||||
|
||||
|
||||
void UnitTest::bench_Polygon_interruptedDraw(){
|
||||
area->addLayer(201,201,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(201,201,10,20,255,ImageType::RASTERIMAGE);
|
||||
std::vector<QPoint> points{
|
||||
QPoint(100,000)
|
||||
};
|
||||
@@ -1624,7 +1624,7 @@ void UnitTest::bench_Polygon_interruptedDraw(){
|
||||
|
||||
|
||||
void UnitTest::bench_Rectangle_fullDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createRectangleTool();
|
||||
@@ -1643,7 +1643,7 @@ void UnitTest::bench_Rectangle_fullDraw(){
|
||||
}
|
||||
|
||||
void UnitTest::bench_Rectangle_interruptedDraw(){
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->addLayer(200,200,10,20,255,ImageType::RASTERIMAGE);
|
||||
area->colorPicker.setFirstColor(QColor(255,255,255,255));
|
||||
area->colorPicker.setSecondColor(QColor(0,0,0,255));
|
||||
area->createRectangleTool();
|
||||
|
||||
Reference in New Issue
Block a user