untiy是最初开始是opengl所以你们明白一点,渲染管线的问题
我就换一个说一下你们所说的untiy用C#写颜色的算法不可能。
这是gdi+的处理方式,虽然不是gui但是也能看出点问题
对于颜色来说是要通过加载某些方法才能实现对于在它本身来说基本颜色有关的,用颜色渐变的梯度刷填充形状 ,灰阶,其他的颜色算法基本很难达到。这是有关用颜色渐变的梯度刷填充形状写法
Status SetCenterColor(const Color &color); // 设置刷中心颜色 Status SetSurroundColors(const Color *colors, INT *count); // 设置路径点颜色 Status GetCenterColor(Color *color); // 获取刷中心颜色 INT GetSurroundColorCount(VOID); // 获取路径点颜色数目 Status GetSurroundColors(Color *colors, INT *count); // 获取路径点颜色数组 其中,路径刷的中心色和路径点色,缺省都为背景色(白色)。 例如:(用路径刷画五角星) void FillPentacle(HDC hdc) { INT count = 10; Point points[] = {Point(100, 0), Point(122, 69), Point(195, 69), Point(137, 111), Point(159, 181), Point(100, 138), Point(41, 181), Point(63, 111), Point(5, 69), Point(78, 69)}; GraphicsPath path; path.AddPolygon(points, count); Graphics graph(hdc); PathGradientBrush pgBrush(&path); pgBrush.SetCenterColor(Color::Red); //pgBrush.SetCenterColor(Color::Green); graph.FillPath(&pgBrush, &path); Color cols[] = {Color::Black, Color::Green, Color::Blue, Color::White, Color::Black, Color::Green, Color::Blue, Color::White, Color::Black, Color::Green}; /*Color cols[] = {Color::Cyan, Color::Aqua, Color::Blue, Color::Chartreuse, Color::Coral, Color::CadetBlue, Color::HotPink, Color::Turquoise, Color::LightSkyBlue, Color::DeepPink}; pgBrush.SetCenterColor(Color::White);*/ pgBrush.SetSurroundColors(cols, &count); graph.TranslateTransform(200.0f, 0); graph.FillPath(&pgBrush, &path); for (int i = 0; i < count; i++) cols = Color(rand() % 255, rand() % 255, rand() % 255); pgBrush.SetSurroundColors(cols, &count); pgBrush.SetCenterColor(Color(rand() % 255, rand() % 255, rand() % 255)); graph.TranslateTransform(- 200.0f, 200.0f); graph.FillPath(&pgBrush, &path); for (int i = 0; i < count; i++) cols = Color(rand() % 255, rand() % 255, rand() % 255); pgBrush.SetSurroundColors(cols, &count);
pgBrush.SetCenterColor(Color(rand() % 255, rand() % 255, rand() % 255)); graph.TranslateTransform(200.0f, 0.0f); graph.FillPath(&pgBrush, &path); }
|