5
A
回答
1
- 绘制边界进入图像比边界本身稍大。
- 模糊它。
- 清除边框内部。
- 在模糊图像上绘制边框。
- 将该图像绘制到目的地。
1
使用GDI +,我会建议你使用PathGradientBrush。它允许您在边缘周围填充一系列颜色的区域,这些颜色都会向中心颜色混合。在这种情况下,您可能只需要1种边缘颜色。为圆角矩形创建的GraphicsPath和使用FillPath()用PathGradientBrush来填补它:
GraphicsPath graphicsPath;
//rect - for a bounding rect
//radius - for how 'rounded' the glow will look
int diameter = radius * 2;
graphicsPath.AddArc(Rect(rect.X, rect.Y, diameter, diameter) 180.0f, 90.0f);
graphicsPath.AddArc(Rect(rect.X + rect.Width - diameter, rect.Y, diameter, diameter), 270.0f, 90.0f);
graphicsPath.AddArc(Rect(rect.X + rect.Width - diameter, rect.Y + rect.Height - diameter, diameter, diameter), 0.0f, 90.0f);
graphicsPath.AddArc(Rect(rect.X, rect.Y + rect.Height - diameter, diameter, diameter), 90.0f, 90.0f);
graphicsPath.CloseFigure();
PathGradientBrush brush(&graphicsPath);
brush.SetCenterColor(centerColor); //would be some shade of blue, following your example
int colCount = 1;
brush.SetSurroundColors(surroundColor, &colCount); //same as your center color, but with the alpha channel set to 0
//play with these numbers to get the glow effect you want
REAL blendFactors[] = {0.0, 0.1, 0.3, 1.0};
REAL blendPos[] = {0.0, 0.4, 0.6, 1.0};
//sets how transition toward the center is shaped
brush.SetBlend(blendFactors, blendPos, 4);
//sets the scaling on the center. you may want to have it elongated in the x-direction
brush.SetFocusScales(0.2f, 0.2f);
graphics.FillPath(&brush, &graphicsPath);
+0
相似,但效果不太一样,我想...我无法控制发光的有条不紊......谢谢你 – toki 2012-07-31 12:06:37
相关问题
- 1. 边界外发光效果
- 2. 如何在位图周围制作外部发光效果?
- 3. WinRT中TextBlock的外部发光效果
- 4. WPF内部发光效果
- 5. Flex发光效果定制
- 6. 如何在ImageView上设置外部发光效果?
- 7. 如何在HTML/CSS中为外部发光效果添加列?
- 8. UISegmentedControl发光效果
- 9. WebGL发光效果
- 10. 如何使用HLSL制作外发光效果?
- 11. 发光效果对PNG的脉动发光效果
- 12. 按钮的内部发光效果
- 13. TextBlock发光效果内部按钮
- 14. WPF中的内部发光效果
- 15. ImageView带有阴影角落,实心边框和发光效果
- 16. HTML,CSS和Javascript非常酷的边框旋转发光效果
- 17. 如何绘制“发光”线在OpenGL ES
- 18. 制作发光效果字体
- 19. 除了使用闪光灯之外,如何实现发光效果
- 20. iOS/GLES2:如何实现发光效果
- 21. 如何获得与CSS发光效果
- 22. 如何隐藏发光效果?
- 23. 在InkCanvas中绘制线条的发光效果
- 24. 对MouseEnter发光效果WPF
- 25. UITextView中的发光效果
- 26. DirectX 9 HLSL发光效果
- 27. 发光风格效果
- 28. 围绕NSView发光效果
- 29. 绽放和发光效果
- 30. Directx 11 HLSL发光效果
这需要一个LinearGradientBrush。或DrawImage()。 – 2012-07-27 13:15:50