mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-21 00:14:15 +08:00
8431b80e48
Co-authored-by: Alexis Campailla <alexis@janeasystems.com> Co-authored-by: Bret Anderson <bretan@microsoft.com> Co-authored-by: Enrico Giordani <enrico.giordani@gmail.com> Co-authored-by: Jaime Bernardo <jaime@janeasystems.com> Co-authored-by: Jeff Bogdan <jeffbog@microsoft.com> Co-authored-by: March Rogers <marchr@microsoft.com> Co-authored-by: Mike Harsh <mharsh@microsoft.com> Co-authored-by: Nachum Bundak <Nachum.Bundak@microsoft.com> Co-authored-by: Oliver Jones <ojones@microsoft.com> Co-authored-by: Patrick Little <plittle@microsoft.com>
25 lines
853 B
C++
25 lines
853 B
C++
#pragma once
|
|
#include <d2d1_3.h>
|
|
#include <d2d1_3helper.h>
|
|
#include <winrt/base.h>
|
|
#include <string>
|
|
|
|
class D2DSVG {
|
|
public:
|
|
D2DSVG& load(const std::wstring& filename, ID2D1DeviceContext5* d2d_dc);
|
|
D2DSVG& resize(int x, int y, int width, int height, float fill, float max_scale = -1.0f);
|
|
D2DSVG& render(ID2D1DeviceContext5* d2d_dc);
|
|
D2DSVG& recolor(uint32_t oldcolor, uint32_t newcolor);
|
|
float get_scale() const { return used_scale; }
|
|
int width() const { return svg_width; }
|
|
int height() const { return svg_height; }
|
|
D2DSVG& toggle_element(const wchar_t* id, bool visible);
|
|
winrt::com_ptr<ID2D1SvgElement> find_element(const std::wstring& id);
|
|
D2D1_RECT_F rescale(D2D1_RECT_F rect);
|
|
protected:
|
|
float used_scale = 1.0f;
|
|
winrt::com_ptr<ID2D1SvgDocument> svg;
|
|
int svg_width = -1, svg_height = -1;
|
|
D2D1::Matrix3x2F transform;
|
|
};
|