本文介绍了如何使用GDI +快速绘制具有发光效果的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请参阅标题!!!
我尝试了几种方法来实现这一目标,但是效率很低!

位图bmpGlow(szeFont.Width,szeFont.Height);
图形gGlow(& bmpGlow);
gGlow.SetSmoothingMode(SmoothingModeAntiAlias);
gGlow.SetTextRenderingHint(TextRenderingHintAntiAlias);
gGlow.SetInterpolationMode(InterpolationModeHighQualityBicubic);
float fAMin =(float)m_nGlowAlphaMin;
浮点fAMax =(float)m_nGlowAlphaMax;
if(m_nLWidth< 8)
{
for(int nCell = 1; nCell< = m_nLWidth; nCell ++)
{
颜色clrGlow;
MakeColor(clrGlow,BYTE(fAMax-(fAMax-fAMin)/m_nLWidth * nCell),m_clrGlow.GetR(),m_clrGlow.GetG(),m_clrGlow.GetB());
Pen penGlow(clrGlow,nCell * WIDTH_RATE);
penGlow.SetLineJoin(LineJoinRound);
gGlow.DrawPath(& penGlow,& path);
}
}
其他
{
float fCellSeed = m_nLWidth/8.0f;
for(float fCell = fCellSeed; fCell< = m_nLWidth; fCell + = fCellSeed)
{
颜色clrGlow;
MakeColor(clrGlow,BYTE(fAMax-(fAMax-fAMin)/m_nLWidth * fCell),m_clrGlow.GetR(),m_clrGlow.GetG(),m_clrGlow.GetB());
Pen penGlow(clrGlow,fCell * WIDTH_RATE);
penGlow.SetLineJoin(LineJoinRound);
gGlow.DrawPath(& penGlow,& path);
}
}
CachedBitmap cacheBitmap(& bmpGlow,bmpg);
bmpg-> DrawCachedBitmap(& cacheBitmap,0,0);

Refer to the title!!!
I have tried several kinds of way to achieve that, but the efficience is pretty low!

Bitmap bmpGlow(szeFont.Width, szeFont.Height);
Graphics gGlow(&bmpGlow);
gGlow.SetSmoothingMode(SmoothingModeAntiAlias);
gGlow.SetTextRenderingHint(TextRenderingHintAntiAlias);
gGlow.SetInterpolationMode(InterpolationModeHighQualityBicubic);
float fAMin = (float)m_nGlowAlphaMin;
float fAMax = (float)m_nGlowAlphaMax;
if(m_nLWidth < 8)
{
for(int nCell=1; nCell<= m_nLWidth; nCell++)
{
Color clrGlow;
MakeColor(clrGlow, BYTE(fAMax- (fAMax- fAMin)/m_nLWidth * nCell), m_clrGlow.GetR(), m_clrGlow.GetG(), m_clrGlow.GetB());
Pen penGlow(clrGlow, nCell*WIDTH_RATE);
penGlow.SetLineJoin(LineJoinRound);
gGlow.DrawPath(&penGlow, &path);
}
}
else
{
float fCellSeed = m_nLWidth/8.0f;
for(float fCell=fCellSeed; fCell<=m_nLWidth; fCell+=fCellSeed)
{
Color clrGlow;
MakeColor(clrGlow, BYTE(fAMax- (fAMax- fAMin)/m_nLWidth * fCell), m_clrGlow.GetR(), m_clrGlow.GetG(), m_clrGlow.GetB());
Pen penGlow(clrGlow, fCell*WIDTH_RATE);
penGlow.SetLineJoin(LineJoinRound);
gGlow.DrawPath(&penGlow, &path);
}
}
CachedBitmap cacheBitmap(&bmpGlow, bmpg);
bmpg->DrawCachedBitmap(&cacheBitmap, 0, 0);

推荐答案




这篇关于如何使用GDI +快速绘制具有发光效果的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 10:08