Uncrustified Files

This commit is contained in:
2020-01-13 19:59:30 +01:00
parent 048fae53fb
commit 6fec7c26bf
10 changed files with 449 additions and 449 deletions

View File

@@ -46,7 +46,7 @@ void IntelliPhotoGui::slotOpen(){
// If we have a file name load the image and place
// it in the paintingArea
if (!fileName.isEmpty()){
if (!fileName.isEmpty()) {
paintingArea->open(fileName);
UpdateGui();
}
@@ -84,7 +84,7 @@ void IntelliPhotoGui::slotCreateNewLayer(){
tr("Height:"),
200,1, 500, 1, &ok2);
// Create New Layer
if (ok1&&ok2){
if (ok1&&ok2) {
paintingArea->addLayer(width,height,0,0);
UpdateGui();
}
@@ -676,7 +676,7 @@ void IntelliPhotoGui::createGui(){
ActiveLayerLine->setFixedSize(Buttonsize.width()+10,Buttonsize.height()/3);
IntelliImage* activePicture = paintingArea->getImageOfActiveLayer();
if(activePicture){
if(activePicture) {
preview = preview.fromImage(activePicture->getImageData());
}else{
QImage tmp(1,1,QImage::Format_ARGB32);
@@ -804,7 +804,7 @@ void IntelliPhotoGui::UpdateGui(){
ActiveLayerLine->setText(string);
IntelliImage* activePicture = paintingArea->getImageOfActiveLayer();
if(activePicture){
if(activePicture) {
preview = preview.fromImage(activePicture->getImageData());
}else{
QImage tmp(1,1,QImage::Format_ARGB32);

View File

@@ -4,11 +4,11 @@
IntelliImage::IntelliImage(int width, int height, bool fastRendererOn)
: imageData(QSize(width, height), fastRendererOn ? QImage::Format_Indexed8 : QImage::Format_ARGB32){
if(fastRendererOn){
if(fastRendererOn) {
imageData = imageData.convertToFormat(QImage::Format_ARGB32);
}
imageData.fill(QColor(255,255,255,255));
if(fastRendererOn){
if(fastRendererOn) {
imageData = imageData.convertToFormat(QImage::Format_Indexed8);
}
this->fastRenderering = fastRendererOn;
@@ -46,7 +46,7 @@ void IntelliImage::resizeImage(QImage*image, const QSize &newSize){
// Draw the image
QPainter painter(&newImage);
painter.drawImage(QPoint(0, 0), *image);
if(fastRenderering){
if(fastRenderering) {
*image = newImage.convertToFormat(QImage::Format_Indexed8);
}
else{
@@ -55,7 +55,7 @@ void IntelliImage::resizeImage(QImage*image, const QSize &newSize){
}
void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
if(fastRenderering){
if(fastRenderering) {
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
}
// Used to draw on the widget
@@ -66,13 +66,13 @@ void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
// Draw a line from the last registered point to the current
painter.drawPoint(p1);
if(fastRenderering){
if(fastRenderering) {
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
}
}
void IntelliImage::drawPoint(const QPoint &p1, const QColor& color, const int& penWidth){
if(fastRenderering){
if(fastRenderering) {
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
}
// Used to draw on the widget
@@ -82,13 +82,13 @@ void IntelliImage::drawPoint(const QPoint &p1, const QColor& color, const int& p
painter.setPen(QPen(color, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
// Draw a line from the last registered point to the current
painter.drawPoint(p1);
if(fastRenderering){
if(fastRenderering) {
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
}
}
void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& color, const int& penWidth){
if(fastRenderering){
if(fastRenderering) {
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
}
// Used to draw on the widget
@@ -99,23 +99,23 @@ void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& co
// Draw a line from the last registered point to the current
painter.drawLine(p1, p2);
if(fastRenderering){
if(fastRenderering) {
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
}
}
void IntelliImage::drawPlain(const QColor& color){
if(fastRenderering){
if(fastRenderering) {
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
}
imageData.fill(color);
if(fastRenderering){
if(fastRenderering) {
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
}
}
QColor IntelliImage::getPixelColor(QPoint& point){
if(fastRenderering){
if(fastRenderering) {
QImage copy = this->imageData.convertToFormat(QImage::Format_ARGB32);
return copy.pixelColor(point);
}
@@ -124,7 +124,7 @@ QColor IntelliImage::getPixelColor(QPoint& point){
QImage IntelliImage::getImageData(){
QImage copy = imageData;
if(fastRenderering){
if(fastRenderering) {
copy = copy.convertToFormat(QImage::Format_ARGB32);
}
return copy;
@@ -132,7 +132,7 @@ QImage IntelliImage::getImageData(){
void IntelliImage::setImageData(const QImage& newData){
imageData = newData;
if(fastRenderering){
if(fastRenderering) {
this->imageData = imageData.convertToFormat(QImage::Format_Indexed8);
}
else {
@@ -142,7 +142,7 @@ void IntelliImage::setImageData(const QImage& newData){
void IntelliImage::updateRendererSetting(bool fastRendererOn){
this->fastRenderering = fastRendererOn;
if(fastRenderering){
if(fastRenderering) {
this->imageData = imageData.convertToFormat(QImage::Format_Indexed8);
}
else {

View File

@@ -30,7 +30,7 @@ QImage IntelliRasterImage::getDisplayable(int alpha){
QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
QImage copy = imageData;
if(fastRenderering){
if(fastRenderering) {
copy = copy.convertToFormat(QImage::Format_ARGB32);
}
for(int y = 0; y<copy.height(); y++) {
@@ -40,7 +40,7 @@ QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
copy.setPixelColor(x,y, clr);
}
}
if(fastRenderering){
if(fastRenderering) {
copy = copy.convertToFormat(QImage::Format_Indexed8);
}
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);

View File

@@ -27,7 +27,7 @@ IntelliImage* IntelliShapedImage::getDeepCopy(){
}
void IntelliShapedImage::calculateVisiblity(){
if(fastRenderering){
if(fastRenderering) {
this->imageData = imageData.convertToFormat(QImage::Format_ARGB32);
}
@@ -40,7 +40,7 @@ void IntelliShapedImage::calculateVisiblity(){
imageData.setPixelColor(x,y,clr);
}
}
if(fastRenderering){
if(fastRenderering) {
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
}
return;
@@ -59,14 +59,14 @@ void IntelliShapedImage::calculateVisiblity(){
imageData.setPixelColor(x,y,clr);
}
}
if(fastRenderering){
if(fastRenderering) {
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
}
}
QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){
QImage copy = imageData;
if(fastRenderering){
if(fastRenderering) {
copy = copy.convertToFormat(QImage::Format_ARGB32);
}
for(int y = 0; y<copy.height(); y++) {
@@ -76,7 +76,7 @@ QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){
copy.setPixelColor(x,y, clr);
}
}
if(fastRenderering){
if(fastRenderering) {
copy = copy.convertToFormat(QImage::Format_Indexed8);
}
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);

View File

@@ -43,9 +43,9 @@ PaintingArea::~PaintingArea(){
}
void PaintingArea::setRenderSettings(bool isFastRenderingOn){
if(isFastRenderingOn != renderSettings.isFastRenderering()){
if(isFastRenderingOn != renderSettings.isFastRenderering()) {
renderSettings.setFastRendering(isFastRenderingOn);
for(auto& layer : layerBundle){
for(auto& layer : layerBundle) {
layer.image->updateRendererSetting(isFastRenderingOn);
}
}
@@ -86,7 +86,7 @@ void PaintingArea::deleteLayer(int idx){
if(activeLayer>=idx) {
activeLayer--;
}
if(activeLayer < 0 && layerBundle.size()){
if(activeLayer < 0 && layerBundle.size()) {
activeLayer=0;
}
}
@@ -265,7 +265,7 @@ std::vector<QPoint> PaintingArea::getPolygonDataOfRealLayer(){
// left button and if so store the current position
// Set that we are currently drawing
void PaintingArea::mousePressEvent(QMouseEvent*event){
if(this->activeLayer < 0){
if(this->activeLayer < 0) {
return;
}
if(Tool == nullptr)
@@ -284,7 +284,7 @@ void PaintingArea::mousePressEvent(QMouseEvent*event){
// we call the drawline function which draws a line
// from the last position to the current
void PaintingArea::mouseMoveEvent(QMouseEvent*event){
if(this->activeLayer < 0){
if(this->activeLayer < 0) {
return;
}
if(Tool == nullptr)
@@ -428,7 +428,7 @@ int PaintingArea::getNumberOfActiveLayer(){
}
IntelliImage* PaintingArea::getImageOfActiveLayer(){
if(activeLayer<0){
if(activeLayer<0) {
return nullptr;
}
return layerBundle[activeLayer].image;

View File

@@ -43,42 +43,42 @@ Q_OBJECT
friend IntelliTool;
friend IntelliPhotoGui;
public:
/*!
/*!
* \brief PaintingArea is the constructor of the PaintingArea class, which initiates the working environment
* \param maxWidth - The maximum amount of pixles that are inside painting area from left to right (default=600px)
* \param maxHeight - The maximum amount of pixles that are inside painting area from top to bottom (default=600px)
* \param parent - The parent window of the main window (default=nullptr)
*/
PaintingArea(int maxWidth=600, int maxHeight=600, QWidget *parent = nullptr);
PaintingArea(int maxWidth=600, int maxHeight=600, QWidget*parent = nullptr);
/*!
/*!
* \brief This deconstructor is used to clear up the memory and remove the currently active window
*/
~PaintingArea() override;
~PaintingArea() override;
// Handles all events
// Handles all events
/*!
/*!
* \brief setRenderSettings updates all Images to the new Rendersetting.
* \param isFastRenderingOn is the new given flag for the FastRenderer.
*/
void setRenderSettings(bool isFastRenderingOn);
void setRenderSettings(bool isFastRenderingOn);
/*!
/*!
* \brief The open method is used for loading a picture into the current layer
* \param fileName - Path and filename which are used to determine where the to-be-opened file is stored
* \return Returns a boolean variable whether the file was successfully opened or not
*/
bool open(const QString &filePath);
/*!
bool open(const QString &filePath);
/*!
* \brief The save method is used for exporting the current project as one picture
* \param fileName
* \param fileFormat
* \return Returns a boolean variable, true if the file was saved successfully, false if not
*/
bool save(const QString &filePath, const char *fileFormat);
bool save(const QString &filePath, const char*fileFormat);
/*!
/*!
* \brief The addLayer adds a layer to the current project/ painting area
* \param width - Width of the layer in pixles
* \param height - Height of the layer in pixles
@@ -87,8 +87,8 @@ public:
* \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, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE);
/*!
int addLayer(int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::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
* \param width - Width of the layer in pixles
@@ -98,87 +98,87 @@ public:
* \param type - Defining the ImageType of the new layer
* \return Returns the id of the layer position
*/
int addLayerAt(int idx, int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE);
/*!
int addLayerAt(int idx, int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE);
/*!
* \brief The deleteLayer method removes a layer at a given idx
* \param idx - The index of the layer to be removed
*/
void deleteLayer(int idx);
/*!
void deleteLayer(int idx);
/*!
* \brief The setLayerToActive method marks a specific layer as active
* \param idx - The index of the layer to be active
*/
void setLayerActive(int idx);
/*!
void setLayerActive(int idx);
/*!
* \brief The setAlphaOfLayer method sets the alpha value of a specific layer
* \param idx - The index of the layer where the change should be applied
* \param alpha - New alpha value of the layer
*/
void setLayerAlpha(int idx, int alpha);
/*!
void setLayerAlpha(int idx, int alpha);
/*!
* \brief The floodFill method fills a the active layer with a given color
* \param r - Red value of the color the layer should be filled with
* \param g - Green value of the color the layer should be filled with
* \param b - Blue value of the color the layer should be filled with
* \param a - Alpha value of the color the layer should be filled with
*/
void floodFill(int r, int g, int b, int a);
/*!
void floodFill(int r, int g, int b, int a);
/*!
* \brief The movePositionActive method moves the active layer to certain position
* \param x - The x value the new center of the layer should be at
* \param y - The y value the new center of the layer should be at
*/
void movePositionActive(int x, int y);
/*!
void movePositionActive(int x, int y);
/*!
* \brief The moveActiveLayer moves the active layer to a specific position in the layer stack
* \param idx - The index of the new position the layer should be in
*/
void moveActiveLayer(int idx);
void moveActiveLayer(int idx);
//change properties of colorPicker
/*!
//change properties of colorPicker
/*!
* \brief The colorPickerSetFirstColor calls the QTColorPicker to determine the primary drawing color
*/
void colorPickerSetFirstColor();
/*!
void colorPickerSetFirstColor();
/*!
* \brief The colorPickerSetSecondColor calls the QTColorPicker to determine the secondary drawing color
*/
void colorPickerSetSecondColor();
/*!
void colorPickerSetSecondColor();
/*!
* \brief The colorPickerSwitchColor swaps the primary color with the secondary drawing color
*/
void colorPickerSwapColors();
void colorPickerSwapColors();
// Create tools
void createPenTool();
void createPlainTool();
void createLineTool();
void createRectangleTool();
void createCircleTool();
void createPolygonTool();
void createFloodFillTool();
// Create tools
void createPenTool();
void createPlainTool();
void createLineTool();
void createRectangleTool();
void createCircleTool();
void createPolygonTool();
void createFloodFillTool();
/*!
/*!
* \brief The getWidthOfActive gets the horizontal dimensions of the active layer
* \return Returns the horizontal pixle count of the active layer
*/
int getWidthOfActive();
/*!
int getWidthOfActive();
/*!
* \brief The getHeightOfActive gets the vertical dimensions of the active layer
* \return Returns the vertical pixle count of the active layer
*/
int getHeightOfActive();
int getHeightOfActive();
IntelliImage::ImageType getTypeOfImageRealLayer();
IntelliImage::ImageType getTypeOfImageRealLayer();
std::vector<QPoint> getPolygonDataOfRealLayer();
std::vector<QPoint> getPolygonDataOfRealLayer();
int getNumberOfActiveLayer();
int getNumberOfActiveLayer();
IntelliImage* getImageOfActiveLayer();
IntelliImage* getImageOfActiveLayer();
IntelliToolsettings Toolsettings;
IntelliColorPicker colorPicker;
IntelliToolsettings Toolsettings;
IntelliColorPicker colorPicker;
public slots:
// Events to handle
@@ -226,8 +226,8 @@ void drawLayers(bool forSaving=false);
void resizeLayer(QImage*image_res, const QSize &newSize);
// Helper for Tool
bool createTempTopLayer(int idx);
// Helper for Tool
bool createTempTopLayer(int idx);
};
#endif

View File

@@ -25,7 +25,7 @@ void IntelliTool::onMouseRightReleased(int x, int y){
void IntelliTool::onMouseLeftPressed(int x, int y){
this->isDrawing=this->createToolLayer();
if(isDrawing){
if(isDrawing) {
Canvas->image->calculateVisiblity();
}
}
@@ -49,7 +49,7 @@ void IntelliTool::onWheelScrolled(int value){
}
bool IntelliTool::createToolLayer(){
if(Area->createTempTopLayer(Area->activeLayer)){
if(Area->createTempTopLayer(Area->activeLayer)) {
this->activeLayer=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer)];
this->Canvas=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer+1)];
return true;

View File

@@ -56,7 +56,7 @@ void IntelliToolCircle::onMouseRightReleased(int x, int y){
void IntelliToolCircle::onMouseLeftPressed(int x, int y){
IntelliTool::onMouseLeftPressed(x,y);
if(this->isDrawing){
if(this->isDrawing) {
this->centerPoint=QPoint(x,y);
int radius = 1;
drawCircle(radius);