本文整理匯總了C#中System.Color.Set方法的典型用法代碼示例。如果您正苦於以下問題:C# Color.Set方法的具體用法?C# Color.Set怎麽用?C# Color.Set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Color
的用法示例。
在下文中一共展示了Color.Set方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: threadTileGenerator_main
void threadTileGenerator_main(object tileObject)
{
Tile tile = tileObject as Tile;
if (!tile.TexturePainter.Lock(TextureLockMode.WriteOnly))
return;
try
{
// generate Mandelbrot set
int w = tile.TexturePainter.MipMapLevelWidth;
double rx = tile.WindowRect.UpperLeftCorner.X;
double rxu = tile.WindowRect.Width / w;
int h = tile.TexturePainter.MipMapLevelHeight;
double ry = tile.WindowRect.UpperLeftCorner.Y;
double ryu = tile.WindowRect.Height / h;
Color c = new Color();
int i;
for (int y = 0; y < h; y++)
{
for (int x = 0; x < w; x++)
{
double ax0 = rx + x * rxu;
double ay0 = ry + y * ryu;
double ax1 = ax0;
double ay1 = ay0;
double ac = ax0 * ax0 + ay0 * ay0;
for (i = 0; i < tile.MaxIterations && ac < 16; i++)
{
double ax2 = ax1 * ax1 - ay1 * ay1 + ax0;
ay1 = 2 * ax1 * ay1 + ay0;
ax1 = ax2;
ac = ax1 * ax1 + ay1 * ay1;
}
if (i < tile.MaxIterations)
c.Set((uint)(i * 0x0102f4));
else
c.Set(0);
tile.TexturePainter.SetPixel(x, y, c);
}
}
}
finally
{
tile.TexturePainter.Unlock();
tile.TextureIsReady = true;
}
}