Example #1
0
void OutlineText::DiffusedShadow(
	Gdiplus::Color color, 
	int nThickness,
	Gdiplus::Point ptOffset)
{
	DiffusedShadowStrategy* pStrat = new DiffusedShadowStrategy();
	pStrat->Init(Gdiplus::Color(0,0,0,0),color,nThickness,true);

	m_clrShadow = color;

	if(m_pFontBodyShadow)
		delete m_pFontBodyShadow;

	DiffusedShadowStrategy* pFontBodyShadow = new DiffusedShadowStrategy();
	pFontBodyShadow->Init(Gdiplus::Color(color.GetA(),255,255),Gdiplus::Color(0,0,0,0),0,true);
	m_pFontBodyShadow = pFontBodyShadow;

	if(m_pShadowStrategy)
		delete m_pShadowStrategy;

	m_ptShadowOffset = ptOffset;
	m_pShadowStrategy = pStrat;
	m_bDiffuseShadow = true;
	m_bExtrudeShadow = false;
	m_nShadowThickness = nThickness;
}
ITextStrategy* DiffusedShadowStrategy::Clone()
{
	DiffusedShadowStrategy* p = new DiffusedShadowStrategy();
	if(m_bClrText)
		p->Init(m_clrText, m_clrOutline, m_nThickness, m_bOutlinetext);
	else
		p->Init(m_pbrushText, m_clrOutline, m_nThickness, m_bOutlinetext);

	return static_cast<ITextStrategy*>(p);
}
void PngOutlineText::DiffusedShadow(
	Gdiplus::Color color, 
	int nThickness,
	Gdiplus::Point ptOffset)
{
	DiffusedShadowStrategy* pStrat = new DiffusedShadowStrategy();
	pStrat->Init(Gdiplus::Color(0,0,0,0),color,nThickness,false);

	if(m_pShadowStrategy)
		delete m_pShadowStrategy;

	m_ptShadowOffset = ptOffset;
	m_pShadowStrategy = pStrat;

	DiffusedShadowStrategy* pStrat2 = new DiffusedShadowStrategy();
	pStrat2->Init(
		Gdiplus::Color(0,0,0,0),
		Gdiplus::Color(color.GetAlpha(),255,255,255),
		nThickness,
		true);

	if(m_pShadowStrategyMask)
		delete m_pShadowStrategyMask;

	m_pShadowStrategyMask = pStrat2;

	m_clrShadow = color;

	if(m_pFontBodyShadow)
		delete m_pFontBodyShadow;

	DiffusedShadowStrategy* pFontBodyShadow = new DiffusedShadowStrategy();
	pFontBodyShadow->Init(Gdiplus::Color(255,255,255),Gdiplus::Color(0,0,0,0),nThickness,false);

	m_pFontBodyShadow = pFontBodyShadow;

	if(m_pFontBodyShadowMask)
		delete m_pFontBodyShadowMask;

	DiffusedShadowStrategy* pFontBodyShadowMask = new DiffusedShadowStrategy();
	pFontBodyShadowMask->Init(Gdiplus::Color(color.GetAlpha(),255,255,255),Gdiplus::Color(0,0,0,0),
		nThickness,false);

	m_pFontBodyShadowMask = pFontBodyShadowMask;
	m_bDiffuseShadow = true;
	m_nShadowThickness = nThickness;
}