2021-02-05 05:44:04 +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
|
|
|
|
|
|
|
|
#include "ui/rp_widget.h"
|
|
|
|
|
2021-02-07 23:10:30 +00:00
|
|
|
#include "editor/photo_editor_common.h"
|
2021-02-20 04:27:10 +00:00
|
|
|
#include "ui/image/image.h"
|
2021-02-07 23:10:30 +00:00
|
|
|
|
2021-02-05 05:44:04 +00:00
|
|
|
namespace Editor {
|
|
|
|
|
2021-02-08 07:01:15 +00:00
|
|
|
class Crop;
|
2021-02-13 04:29:31 +00:00
|
|
|
class Paint;
|
2021-02-23 10:34:12 +00:00
|
|
|
struct Controllers;
|
2021-02-08 07:01:15 +00:00
|
|
|
|
2021-02-05 05:44:04 +00:00
|
|
|
class PhotoEditorContent final : public Ui::RpWidget {
|
|
|
|
public:
|
|
|
|
PhotoEditorContent(
|
|
|
|
not_null<Ui::RpWidget*> parent,
|
2021-02-20 04:27:10 +00:00
|
|
|
std::shared_ptr<Image> photo,
|
2021-03-14 09:42:18 +00:00
|
|
|
PhotoModifications modifications,
|
2021-02-23 10:34:12 +00:00
|
|
|
std::shared_ptr<Controllers> controllers,
|
2021-02-21 07:28:37 +00:00
|
|
|
EditorData data);
|
2021-02-05 05:44:04 +00:00
|
|
|
|
2021-02-07 23:10:30 +00:00
|
|
|
void applyModifications(PhotoModifications modifications);
|
2021-03-14 09:39:55 +00:00
|
|
|
void applyMode(const PhotoEditorMode &mode);
|
2021-02-16 03:45:05 +00:00
|
|
|
void applyBrush(const Brush &brush);
|
2021-02-13 04:29:31 +00:00
|
|
|
void save(PhotoModifications &modifications);
|
2021-02-07 23:10:30 +00:00
|
|
|
|
2021-02-05 05:44:04 +00:00
|
|
|
private:
|
|
|
|
|
2021-02-20 04:27:10 +00:00
|
|
|
const QSize _photoSize;
|
2021-02-13 04:29:31 +00:00
|
|
|
const base::unique_qptr<Paint> _paint;
|
2021-02-08 07:01:15 +00:00
|
|
|
const base::unique_qptr<Crop> _crop;
|
2021-02-20 04:27:10 +00:00
|
|
|
const std::shared_ptr<Image> _photo;
|
2021-02-08 07:01:15 +00:00
|
|
|
|
2021-02-07 23:10:30 +00:00
|
|
|
rpl::variable<PhotoModifications> _modifications;
|
|
|
|
|
2021-02-05 07:08:20 +00:00
|
|
|
QRect _imageRect;
|
2021-02-07 23:10:30 +00:00
|
|
|
QMatrix _imageMatrix;
|
2021-02-13 04:29:31 +00:00
|
|
|
PhotoEditorMode _mode;
|
2021-02-05 07:08:20 +00:00
|
|
|
|
2021-02-05 05:44:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Editor
|