mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-11 06:22:44 +08:00
71 lines
1.4 KiB
C++
71 lines
1.4 KiB
C++
//----------------------------------------------------------------------------
|
|
// Pen class - Version 0.1.1 - 28-10-2004
|
|
// Marlon Mircevski
|
|
//----------------------------------------------------------------------------
|
|
#include "stdafx.h"
|
|
#include "ap_Pen.h"
|
|
#include "ap_Brush.h"
|
|
|
|
namespace Aggplus
|
|
{
|
|
Pen::Pen(const Color& color, REAL width) : m_DashStyle(DashStyleSolid), m_LineJoin(LineJoinMiter)
|
|
{
|
|
m_pBrush=new BrushSolid(color);
|
|
m_fWidth=width;
|
|
}
|
|
|
|
Pen::Pen(const Brush* brush, REAL width) : m_DashStyle(DashStyleSolid), m_LineJoin(LineJoinMiter)
|
|
{
|
|
m_pBrush=brush->Clone();
|
|
m_fWidth=width;
|
|
}
|
|
|
|
Pen::~Pen()
|
|
{
|
|
delete(m_pBrush);
|
|
}
|
|
|
|
Pen *Pen::Clone(VOID)
|
|
{
|
|
Pen *pRet=new Pen(m_pBrush, m_fWidth);
|
|
pRet->m_DashStyle=m_DashStyle;
|
|
pRet->m_LineJoin=m_LineJoin;
|
|
return(pRet);
|
|
}
|
|
|
|
Status Pen::SetBrush(const Brush* brush)
|
|
{
|
|
delete(m_pBrush);
|
|
m_pBrush=brush->Clone();
|
|
return Ok;
|
|
}
|
|
|
|
Status Pen::GetColor(Color* color) const
|
|
{
|
|
if(m_pBrush->GetType() == BrushTypeSolidColor)
|
|
{
|
|
((BrushSolid *)m_pBrush)->GetColor(color);
|
|
return Ok;
|
|
}
|
|
|
|
return WrongState;
|
|
}
|
|
|
|
Status Pen::SetColor(const Color &color)
|
|
{
|
|
if(m_pBrush->GetType() == BrushTypeSolidColor)
|
|
{
|
|
((BrushSolid *)m_pBrush)->SetColor(color);
|
|
}
|
|
else
|
|
{
|
|
delete(m_pBrush);
|
|
m_pBrush=new BrushSolid(color);
|
|
}
|
|
return Ok;
|
|
}
|
|
|
|
|
|
|
|
}
|