mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-05 22:56:11 +00:00
This change removes the win2d (Direct2D wrapper) dependency by using D2D directly. This removes the manual step of adding the win2d to any new react-native-windows projects that want to use react-native-svg. It is also a stepping stone to an easier Fabric implementation for windows.
31 lines
1001 B
C++
31 lines
1001 B
C++
#pragma once
|
|
#include "LinearGradientView.g.h"
|
|
#include "BrushView.h"
|
|
|
|
namespace winrt::RNSVG::implementation {
|
|
struct LinearGradientView : LinearGradientViewT<LinearGradientView, RNSVG::implementation::BrushView> {
|
|
public:
|
|
LinearGradientView() = default;
|
|
|
|
// RenderableView
|
|
void UpdateProperties(Microsoft::ReactNative::IJSValueReader const &reader, bool forceUpdate, bool invalidate);
|
|
void Unload();
|
|
|
|
private:
|
|
RNSVG::SVGLength m_x1{};
|
|
RNSVG::SVGLength m_y1{};
|
|
RNSVG::SVGLength m_x2{};
|
|
RNSVG::SVGLength m_y2{};
|
|
std::vector<D2D1_GRADIENT_STOP> m_stops{};
|
|
std::string m_gradientUnits{"objectBoundingBox"};
|
|
|
|
void CreateBrush();
|
|
void UpdateBounds();
|
|
void SetPoints(ID2D1LinearGradientBrush *brush, D2D1_RECT_F bounds);
|
|
};
|
|
} // namespace winrt::RNSVG::implementation
|
|
|
|
namespace winrt::RNSVG::factory_implementation {
|
|
struct LinearGradientView : LinearGradientViewT<LinearGradientView, implementation::LinearGradientView> {};
|
|
} // namespace winrt::RNSVG::factory_implementation
|