2021-02-07 23:10:30 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Editor {
|
|
|
|
|
2021-03-03 09:24:35 +00:00
|
|
|
class Scene;
|
|
|
|
|
2021-03-14 09:39:55 +00:00
|
|
|
struct PhotoEditorMode {
|
|
|
|
enum class Mode {
|
|
|
|
Transform,
|
|
|
|
Paint,
|
|
|
|
} mode = Mode::Transform;
|
|
|
|
|
|
|
|
enum class Action {
|
|
|
|
None,
|
|
|
|
Save,
|
|
|
|
Discard,
|
|
|
|
} action = Action::None;
|
2021-02-13 04:29:31 +00:00
|
|
|
};
|
|
|
|
|
2021-02-07 23:10:30 +00:00
|
|
|
struct PhotoModifications {
|
|
|
|
int angle = 0;
|
|
|
|
bool flipped = false;
|
2021-02-08 07:01:15 +00:00
|
|
|
QRect crop;
|
2021-03-03 09:24:35 +00:00
|
|
|
std::shared_ptr<Scene> paint = nullptr;
|
2021-02-08 03:13:40 +00:00
|
|
|
|
2021-02-13 04:29:31 +00:00
|
|
|
[[nodiscard]] bool empty() const;
|
|
|
|
[[nodiscard]] explicit operator bool() const;
|
|
|
|
~PhotoModifications();
|
2021-02-08 03:13:40 +00:00
|
|
|
|
2021-02-07 23:10:30 +00:00
|
|
|
};
|
|
|
|
|
2021-02-21 07:28:37 +00:00
|
|
|
struct EditorData {
|
|
|
|
enum class CropType {
|
|
|
|
Rect,
|
|
|
|
Ellipse,
|
|
|
|
};
|
|
|
|
|
|
|
|
CropType cropType = CropType::Rect;
|
|
|
|
bool keepAspectRatio = false;
|
|
|
|
};
|
|
|
|
|
2021-02-16 03:45:05 +00:00
|
|
|
struct Brush {
|
|
|
|
float sizeRatio = 0.;
|
|
|
|
QColor color;
|
|
|
|
};
|
|
|
|
|
2021-02-08 03:13:40 +00:00
|
|
|
[[nodiscard]] QImage ImageModified(
|
|
|
|
QImage image,
|
|
|
|
const PhotoModifications &mods);
|
|
|
|
|
2021-02-07 23:10:30 +00:00
|
|
|
} // namespace Editor
|