I’m currently writing a pixel-art drawing software and I’m wondering whether my approach is correct.
Currently I have a QGraphicsView with QGraphicsScene that contains a QGraphicsItem derived class with following code in overriden paint method:
painter->drawImage(0, 0, _canvasRepresentation);
The _canvasRepresentation is a QImage that has each pixel color computed (using alpha blending, each time this pixel is changed) based on drawing layers which are essentially represented by something similar to this:
using Layer = std::vector<std::array<uint32_t, width * height>>
This approach is working fine so far however I’m worried that after adding some more complicated tools the performance will suffer (as far as I know QGraphicsView is drawing using CPU) and I don’t want to continue with a design that I will have to change eventually and will require rewriting half of the project.
I’ve been looking into Skia but I’m struggling to use it inside Qt (would it even be significantly faster?), I also could use graphics apis such as openGL but I have no experience of using them so I like it to be last resort.
Here is a link to the GitHub project, most of the drawing code is in ui/widgets
and graphics/drawing-tools/PenTool.cpp
directories: https://github.com/Zipeerix/capy-art-studio