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:
@@ -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
|
||||
|
Reference in New Issue
Block a user