2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Added initial implementation of mouse drawing in photo editor.

This commit is contained in:
23rd
2021-02-13 07:29:31 +03:00
parent e1ea833ad6
commit 5b6bddd7fc
10 changed files with 254 additions and 13 deletions

View File

@@ -13,6 +13,12 @@ QImage ImageModified(QImage image, const PhotoModifications &mods) {
if (!mods) {
return image;
}
if (mods.paint) {
Painter p(&image);
PainterHighQualityEnabler hq(p);
mods.paint->render(&p, image.rect());
}
QTransform transform;
if (mods.flipped) {
transform.scale(-1, 1);
@@ -27,4 +33,18 @@ QImage ImageModified(QImage image, const PhotoModifications &mods) {
return newImage;
}
bool PhotoModifications::empty() const {
return !angle && !flipped && !crop.isValid();
}
PhotoModifications::operator bool() const {
return !empty();
}
PhotoModifications::~PhotoModifications() {
if (paint && (paint.use_count() == 1)) {
paint->deleteLater();
}
}
} // namespace Editor