Added SVG Screenshot support

This commit is contained in:
Yousef Khadadeh 2025-08-23 17:04:53 +03:00
parent 95c1c3c9e5
commit 45e2a8a032
3 changed files with 143 additions and 68 deletions

View file

@ -20,6 +20,7 @@ class ScreenshotTool : public DrawingProgramToolBase {
void commit_rect();
void take_screenshot(const std::filesystem::path& filePath);
void take_screenshot_area_hw(const sk_sp<SkSurface>& surface, SkCanvas* canvas, void* fullImgRawData, const Vector2i& fullImageSize, const Vector2i& sectionImagePos, const Vector2i& sectionImageSize, const Vector2i& canvasSize, bool transparentBackground);
void take_screenshot_svg(SkCanvas* canvas, bool transparentBackground);
//static constexpr std::array<InputManager::SystemCursorType, 8> cursors{
// InputManager::SystemCursorType::SE_RESIZE,
@ -32,6 +33,13 @@ class ScreenshotTool : public DrawingProgramToolBase {
// InputManager::SystemCursorType::E_RESIZE
//};
enum ScreenshotType : size_t {
SCREENSHOT_JPG,
SCREENSHOT_PNG,
SCREENSHOT_WEBP,
SCREENSHOT_SVG
};
struct ScreenshotControls {
CoordSpaceHelper coords;
float rectX1;
@ -48,8 +56,8 @@ class ScreenshotTool : public DrawingProgramToolBase {
bool displayGrid = true;
bool transparentBackground = false;
size_t selectedType = 0;
std::vector<std::string> typeSelections = {".jpg", ".png", ".webp"};
size_t selectedType = SCREENSHOT_JPG;
std::vector<std::string> typeSelections = {".jpg", ".png", ".webp", ".svg"};
std::atomic<bool> setToTakeScreenshot = false;
std::filesystem::path screenshotSavePath;