本文整理汇总了C#中Color.GetMultiColorBlend方法的典型用法代码示例。如果您正苦于以下问题:C# Color.GetMultiColorBlend方法的具体用法?C# Color.GetMultiColorBlend怎么用?C# Color.GetMultiColorBlend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Color
的用法示例。
在下文中一共展示了Color.GetMultiColorBlend方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderEffect
public Color[,] RenderEffect(Color[,] buffer, Color[] palette, int eventToRender)
{
const int speedFactor = 200;
var bufferHeight = buffer.GetLength(Utils.IndexRowsOrHeight);
var bufferWidth = buffer.GetLength(Utils.IndexColsOrWidth);
Color color;
var hsv2 = new HSV();
var colorcnt = palette.Length;
var cycleLen = colorcnt * speedFactor;
var count = tbCount.Value;
if (eventToRender > (colorcnt - 1) * speedFactor * count && count < 10) {
color = palette.GetMultiColorBlend(count % 2, false);
} else {
color = palette.GetMultiColorBlend(eventToRender % cycleLen / (double)cycleLen, true);
}
var hsv = color.ToHSV();
var halfHeight = (bufferHeight - 1) / 2.0;
var halfWidth = (bufferWidth - 1) / 2.0;
for (var col = 0; col < bufferWidth; col++) {
for (var row = 0; row < bufferHeight; row++) {
hsv2.SetToHSV(hsv);
if (chkBoxHFade.Checked) hsv2.Value *= (float)(1.0 - Math.Abs(halfWidth - col) / halfWidth);
if (chkBoxVFade.Checked) hsv2.Value *= (float)(1.0 - Math.Abs(halfHeight - row) / halfHeight);
buffer[row, col] = hsv2.ToColor();
}
}
return buffer;
}
示例2: RenderEffect
public Color[,] RenderEffect(Color[,] buffer, Color[] palette, int eventToRender)
{
var colorCount = palette.Length;
var spiralCount = colorCount * tbPaletteRepeat.Value;
var bufferHeight = buffer.GetLength(Utils.IndexRowsOrHeight);
var bufferWidth = buffer.GetLength(Utils.IndexColsOrWidth);
var deltaStrands = bufferWidth / spiralCount;
var spiralThickness = (deltaStrands * tbThickness.Value / 100) + 1;
long spiralState = eventToRender * tbDirection.Value;
for (var spiral = 0; spiral < spiralCount; spiral++) {
var strandBase = spiral * deltaStrands;
var color = palette[spiral % colorCount];
for (var thickness = 0; thickness < spiralThickness; thickness++) {
var strand = (strandBase + thickness) % bufferWidth;
for (var row = 0; row < bufferHeight; row++) {
var column = (strand + ((int)spiralState / 10) + (row * tbRotations.Value / bufferHeight)) % bufferWidth;
if (column < 0) {
column += bufferWidth;
}
if (chkBoxBlend.Checked) {
color = palette.GetMultiColorBlend((bufferHeight - row - 1) / (double)bufferHeight, false);
}
if (chkBox3D.Checked) {
var hsv = color.ToHSV();
hsv.Value = (float)((double)(tbRotations.Value < 0 ? thickness + 1 : spiralThickness - thickness) / spiralThickness);
color = hsv.ToColor();
}
buffer[row, column] = color;
}
}
}
return buffer;
}
示例3: GetMultiColor
private Color GetMultiColor(Color[] palette)
{
return palette.GetMultiColorBlend(_random.Next(100) / 100.0, false);
}
示例4: RenderEffect
public Color[,] RenderEffect(Color[,] buffer, Color[] palette, int eventToRender)
{
var rows = buffer.GetLength(Utils.IndexRowsOrHeight);
var columns = buffer.GetLength(Utils.IndexColsOrWidth);
var pixelSpacing = tbSpacing.Value * rows / 100 + 3;
var limit = rows * pixelSpacing * 4;
var garlandsState = (limit - (eventToRender % limit)) / 4;
for (var ring = 0; ring < rows; ring++) {
var ratio = ring / (double) rows;
var color = palette.GetMultiColorBlend(ratio, false);
var intialRow = garlandsState - ring * pixelSpacing;
for (var column = 0; column < columns; column++) {
var row = intialRow;
switch (tbGarlandType.Value) {
case 1:
switch (column % 5) {
case 2:
row -= 2;
break;
case 1:
case 3:
row -= 1;
break;
}
break;
case 2:
switch (column % 5) {
case 2:
row -= 4;
break;
case 1:
case 3:
row -= 2;
break;
}
break;
case 3:
switch (column % 6) {
case 3:
row -= 6;
break;
case 2:
case 4:
row -= 4;
break;
case 1:
case 5:
row -= 2;
break;
}
break;
case 4:
switch (column % 5) {
case 1:
case 3:
row -= 2;
break;
}
break;
}
if (row < rows - ring - 1) {
row = rows - ring - 1;
}
if (row < rows) {
buffer[row, column] = color;
}
}
}
return buffer;
}
示例5: RenderEffect
public Color[,] RenderEffect(Color[,] buffer, Color[] palette, int eventToRender)
{
var h = 0.0;
var bufferHeight = buffer.GetLength(Utils.IndexRowsOrHeight);
var bufferWidth = buffer.GetLength(Utils.IndexColsOrWidth);
var hsv = new HSV();
var maxframe = bufferHeight*2;
var frame = (int) ((bufferHeight*(double) eventToRender/200.0)%maxframe);
var offset = eventToRender/100.0;
for (var col = 0; col < bufferWidth; col++) {
for (var row = 0; row < bufferHeight; row++) {
double x1;
double y1;
double f;
switch (tbStyle.Value) {
case 1:
var n =
Math.Abs((col*col - row*row)*
Math.Sin(offset + ((col + row)*Pi2/(bufferHeight + bufferWidth))));
var d = col*col + row*row + 1;
h = n/d;
break;
case 2:
f = (frame < maxframe/2) ? frame + 1 : maxframe - frame;
x1 = (col - bufferWidth/2.0)/f;
y1 = (row - bufferHeight/2.0)/f;
h = Math.Sqrt(x1*x1 + y1*y1);
break;
case 3:
f = (frame < maxframe/2) ? frame + 1 : maxframe - frame;
f = f*0.1 + bufferHeight/60.0;
x1 = (col - bufferWidth/2.0)/f;
y1 = (row - bufferHeight/2.0)/f;
h = Math.Sin(x1)*Math.Cos(y1);
break;
}
hsv.Saturation = 1.0f;
hsv.Value = 1.0f;
var chunks = tbChunks.Value;
var skip = tbSkip.Value;
if (chunks > 1 && ((int) (h*chunks))%skip == 0) {
continue;
}
Color color;
if (cbColors.SelectedIndex == 0) {
hsv.Hue = (float) h;
color = hsv.ToColor();
}
else {
color = palette.GetMultiColorBlend(h, false);
}
buffer[row, col] = color;
}
}
return buffer;
}