径向渐变多边形C# [英] Radial gradient polygon C#
问题描述
我想制作一个程序,从文件中取X和Y坐标,它将是一个国家。我用多边形做了一个带点的数组,这就是全部。但是,我需要填充3种颜色,从蓝色到黄色,从黄色到橙色的径向渐变。如何制作这种径向渐变?
一张我需要做的照片:< a
编辑:我试图找到一个中心,它只适用于黄色和蓝色,但我需要是蓝黄色和橙色。
我尝试过:
我试图制作类似的东西,但我不会工作:
Hi, I want to make a program , that take X and Y coordinates from a file, and It will be a country. I made that , with polygon, an array with points and that's all. But, I need to fill this, with 3 colors, with a radial gradient from blue to yellow and from yellow to orange. How can I make this radial gradient ?
A photo with the result of what I need to do : <a
I tried to get a center , and it works only for Yellow and Blue but I need to be blue yellow and orange.
What I have tried:
I tried to make something like that , but I will not works :
using (PathGradientBrush path_brush = new PathGradientBrush(curvepoints))
{
path_brush.CenterPoint = new Point(this.ClientSize.Width / 2, this.ClientSize.Height / 2);
path_brush.CenterColor = Color.Blue;
path_brush.SurroundColors = new Color[] { Color.Orange Color.Yellow };
g.FillPolygon(path_brush, curvepoints);
}
推荐答案
这是一张热图。
找到中心。
然后,从中心出来的像素根据它们与最近边界的相对距离进行着色。使用(百分比)band范围。
(或者它是一个扭曲;特定多边形内的径向渐变;重新计算半径再次基于相对距离。
It's a "heat map".
Locate the "center".
Then the pixels, from the center out, are colored based on their relative distance from the nearest border. Use (percent) ranges for "bands".
(Or it's a "warp"; of a radial gradient within a particular polygon; "recalculating" the "radius" based on relative distances again.
这篇关于径向渐变多边形C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!