Add offset for brush rect

This commit is contained in:
Prokhorov Kirill
2025-09-25 16:12:07 +03:00
parent 2931c4b53e
commit c8ebcfac87
5 changed files with 33 additions and 1 deletions

View File

@ -622,6 +622,12 @@ HRESULT CGraphicsRenderer::BrushRect(const INT& val, const double& left, const d
m_oBrush.Rect.Height = (float)height;
return S_OK;
}
HRESULT CGraphicsRenderer::get_BrushRect(Aggplus::RectF& rect, bool& rectable) const
{
rectable = m_oBrush.Rectable;
rect = m_oBrush.Rect;
return S_OK;
}
HRESULT CGraphicsRenderer::BrushBounds(const double& left, const double& top, const double& width, const double& height)
{
m_oBrush.Bounds.left = left;

View File

@ -190,6 +190,7 @@ public:
virtual HRESULT get_BrushTransform(Aggplus::CMatrix& oMatrix);
virtual HRESULT put_BrushTransform(const Aggplus::CMatrix& oMatrix);
virtual HRESULT BrushRect(const INT& val, const double& left, const double& top, const double& width, const double& height);
virtual HRESULT get_BrushRect(Aggplus::RectF& rect, bool& rectable) const;
virtual HRESULT BrushBounds(const double& left, const double& top, const double& width, const double& height);
virtual HRESULT put_BrushGradientColors(LONG* lColors, double* pPositions, LONG nCount);

View File

@ -243,6 +243,7 @@ public:
virtual HRESULT get_BrushLinearAngle(double* dAngle) = 0;
virtual HRESULT put_BrushLinearAngle(const double& dAngle) = 0;
virtual HRESULT BrushRect(const INT& val, const double& left, const double& top, const double& width, const double& height) = 0;
virtual HRESULT get_BrushRect(Aggplus::RectF& rect, bool& rectable) const = 0;
virtual HRESULT BrushBounds(const double& left, const double& top, const double& width, const double& height) = 0;
virtual HRESULT put_BrushGradientColors(LONG* lColors, double* pPositions, LONG nCount) = 0;

View File

@ -664,9 +664,20 @@ namespace NSOnlineOfficeBinToPdf
}
case ctPathCommandOffset:
{
isClip = true;
double m1 = oReader.ReadDouble();
double m2 = oReader.ReadDouble();
isClip = true;
Aggplus::RectF rect;
bool rectable;
pRenderer->get_BrushRect(rect, rectable);
if (rectable)
{
rect.Offset(m1, m2);
pRenderer->BrushRect(true, rect.X, rect.Y, rect.Width, rect.Height);
}
clipPath = path.Trsanslate(m1, m2);
}
case ctDrawPath:

View File

@ -212,6 +212,19 @@ public:
void Offset(const PointF_T<T>& point) { Offset(point.X, point.Y); }
void Offset(T dx, T dy) { X += dx; Y += dy; }
RectF_T& operator=(const RectF_T& other)
{
if (this == &other)
return *this;
X = other.X;
Y = other.Y;
Width = other.Width;
Height = other.Height;
return *this;
};
public:
T X, Y, Width, Height;
};