photo_editor_common.h 844 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. namespace Editor {
  9. class Scene;
  10. struct PhotoModifications {
  11. int angle = 0;
  12. bool flipped = false;
  13. QRect crop;
  14. std::shared_ptr<Scene> paint = nullptr;
  15. [[nodiscard]] bool empty() const;
  16. [[nodiscard]] explicit operator bool() const;
  17. ~PhotoModifications();
  18. };
  19. struct EditorData {
  20. enum class CropType {
  21. Rect,
  22. Ellipse,
  23. RoundedRect,
  24. };
  25. TextWithEntities about;
  26. QString confirm;
  27. QSize exactSize;
  28. CropType cropType = CropType::Rect;
  29. bool keepAspectRatio = false;
  30. };
  31. [[nodiscard]] QImage ImageModified(
  32. QImage image,
  33. const PhotoModifications &mods);
  34. } // namespace Editor