如何使用GDI +快速绘制具有发光效果的文本 [英] How to Draw Texts with glow effect at a high speed with GDI+

查看:272
本文介绍了如何使用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 +对于实时数据效率不高.
You can''t draw it as you need it, you need to store it and show it. GDI+ is not efficient for real time stuff.


我确实存储了它然后显示出来,但是随着辉光宽度的增加,我将花费太多的时间来实现这一目标!!!您能告诉我一些更详细的信息吗?
I do store it and then show it,But as the width of the glow increase it will take me too much time to achieve that!!!Can you show me something more detailed!


它渲染的速度有多慢,您希望渲染多快?
How slow does it render and how fast do you want it to render?


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆