• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ColorGradient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ColorGradient的典型用法代码示例。如果您正苦于以下问题:C# ColorGradient类的具体用法?C# ColorGradient怎么用?C# ColorGradient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ColorGradient类属于命名空间,在下文中一共展示了ColorGradient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: VerticalMeterData

        public VerticalMeterData()
        {
            Inverted = false;
            DecayTime = 1500;
            AttackTime = 50;
            Normalize = true;
            Gain = 0;
            Range = 10;
            RedColorPosition = 95;
            GreenColorPosition = 25;
            MeterColorStyle = MeterColorTypes.Linear;

            LowPass = false;
            LowPassFreq = 100;
            HighPass = false;
            HighPassFreq = 500;

            Color[] myColors = { Color.Lime, Color.Yellow, Color.Red };
            float[] myPositions = { 0, (float)GreenColorPosition / 100, (float)RedColorPosition / 100 };
            ColorBlend linearBlend = new ColorBlend();
            linearBlend.Colors = myColors;
            linearBlend.Positions = myPositions;

            ColorGradient linearGradient = new ColorGradient(linearBlend);

            IntensityCurve = new Curve();
            IntensityCurve.Points.Clear();
            IntensityCurve.Points.Add(new ZedGraph.PointPair(0, 100));
            IntensityCurve.Points.Add(new ZedGraph.PointPair(100, 100));

            MeterColorGradient = linearGradient;

            DepthOfEffect = 0;
        }
开发者ID:jaredb7,项目名称:vixen,代码行数:34,代码来源:VerticalMeterData.cs


示例2: VUMeterData

        public VUMeterData()
        {
            DecayTime = 1500;
            AttackTime = 50;
            Normalize = true;
            Gain = 0;
            Range = 10;
            RedColorPosition = 95;
            GreenColorPosition = 25;
            MeterColorStyle = MeterColorTypes.Custom;

            LowPass = false;
            LowPassFreq = 100;
            HighPass = false;
            HighPassFreq = 500;

            IntensityCurve = new Curve();
            IntensityCurve.Points.Clear();
            IntensityCurve.Points.Add(new ZedGraph.PointPair(0, 0));
            IntensityCurve.Points.Add(new ZedGraph.PointPair(100, 100));

            ColorGradient linearGradient = new ColorGradient(Color.White);
            MeterColorGradient = linearGradient;

            DepthOfEffect = 0;
        }
开发者ID:jaredb7,项目名称:vixen,代码行数:26,代码来源:VUMeterData.cs


示例3: RenderNode

        // renders the given node to the internal ElementData dictionary. If the given node is
        // not a element, will recursively descend until we render its elements.
        public static EffectIntents RenderNode(ElementNode node, Curve levelCurve, ColorGradient colorGradient, TimeSpan duration, bool isDiscrete, bool allowZeroIntensity = false)
        {
            //Collect all the points first.
            double[] allPointsTimeOrdered = _GetAllSignificantDataPoints(levelCurve, colorGradient).ToArray();
            var elementData = new EffectIntents();
            foreach (ElementNode elementNode in node.GetLeafEnumerator())
            {
                // this is probably always going to be a single element for the given node, as
                // we have iterated down to leaf nodes in RenderNode() above. May as well do
                // it this way, though, in case something changes in future.
                if (elementNode == null || elementNode.Element == null)
                    continue;

                //ElementColorType colorType = ColorModule.getColorTypeForElementNode(elementNode);

                if (isDiscrete && IsElementDiscrete(node))
                {
                    IEnumerable<Color> colors = ColorModule.getValidColorsForElementNode(elementNode, false)
                         .Intersect(colorGradient.GetColorsInGradient());
                    foreach (Color color in colors)
                    {
                        AddIntentsToElement(elementNode.Element, allPointsTimeOrdered, levelCurve, colorGradient, duration, elementData, allowZeroIntensity, color);
                    }
                }
                else
                {
                    AddIntentsToElement(elementNode.Element, allPointsTimeOrdered, levelCurve, colorGradient, duration, elementData, allowZeroIntensity);
                }
            }

            return elementData;
        }
开发者ID:jaredb7,项目名称:vixen,代码行数:34,代码来源:PulseRenderer.cs


示例4: ChaseData

 public ChaseData()
 {
     ColorHandling = ChaseColorHandling.StaticColor;
     PulseOverlap = 0;
     DefaultLevel = 0;
     StaticColor = Color.White;
     ColorGradient = new ColorGradient();
     PulseCurve = new Curve();
     ChaseMovement = new Curve();
 }
开发者ID:kjburns31,项目名称:vixen-modules,代码行数:10,代码来源:ChaseData.cs


示例5: GumpGradient

		public GumpGradient(int x, int y, int width, int height, Direction45 dirTo, ColorGradient gradient)
		{
			_X = x;
			_Y = y;

			_Width = width;
			_Height = height;

			_Direction = dirTo;
			_Gradient = gradient;
		}
开发者ID:Ravenwolfe,项目名称:Core,代码行数:11,代码来源:GumpGradient.cs


示例6: ColorGradientEditor

        public ColorGradientEditor(ColorGradient gradient, bool discreteColors, IEnumerable<Color> validDiscreteColors)
        {
            InitializeComponent();
            Icon = Common.Resources.Properties.Resources.Icon_Vixen3;

            gradientEditPanel.GradientChanged += GradientChangedHandler;
            Gradient = gradient;
            _discreteColors = discreteColors;
            _validDiscreteColors = validDiscreteColors;
            PopulateFormWithGradient(_gradient);
        }
开发者ID:komby,项目名称:vixen,代码行数:11,代码来源:ColorGradientEditor.cs


示例7: CurtainData

 public CurtainData()
 {
     Gradient = new ColorGradient();
     Gradient.Colors.Clear();
     Gradient.Colors.Add(new ColorPoint(Color.Red, 0.0));
     Gradient.Colors.Add(new ColorPoint(Color.Lime, 1.0));
     Direction = CurtainDirection.CurtainOpen;
     Speed = 1;
     Edge = CurtainEdge.Center;
     Swag = 1;
     LevelCurve = new Curve(CurveType.Flat100);
     Orientation=StringOrientation.Vertical;
 }
开发者ID:jaredb7,项目名称:vixen,代码行数:13,代码来源:CurtainData.cs


示例8: ChaseData

		public ChaseData()
		{
			ColorHandling = ChaseColorHandling.StaticColor;
			PulseOverlap = 0;
			DefaultLevel = 0;
			StaticColor = Color.White;
			ColorGradient = new ColorGradient(Color.White);
			PulseCurve = new Curve();
			ChaseMovement = new Curve();
			DepthOfEffect = 0;
			ExtendPulseToStart = false;
			ExtendPulseToEnd = false;
		}
开发者ID:stewmc,项目名称:vixen,代码行数:13,代码来源:ChaseData.cs


示例9: ColorWashData

 public ColorWashData()
 {
     Gradient = new ColorGradient();
     Gradient.Colors.Clear();
     Gradient.Colors.Add(new ColorPoint(Color.Red, 0.0));
     Gradient.Colors.Add(new ColorPoint(Color.Lime, .5));
     Gradient.Colors.Add(new ColorPoint(Color.Blue, 1.0));
     Type = ColorWashType.Center;
     Iterations = 1;
     VerticalFade = false;
     HorizontalFade = false;
     LevelCurve = new Curve(new PointPairList(new[] { 0.0, 100.0 }, new[] { 100.0, 100.0 }));
     Orientation=StringOrientation.Vertical;
 }
开发者ID:jaredb7,项目名称:vixen,代码行数:14,代码来源:ColorWashData.cs


示例10: TwinkleData

		public TwinkleData()
		{
			IndividualChannels = true;
			MinimumLevel = 0;
			MaximumLevel = 100;
			LevelVariation = 50;
			AveragePulseTime = 400;
			PulseTimeVariation = 30;
			AverageCoverage = 50;
			ColorHandling = TwinkleColorHandling.GradientForEachPulse;
			StaticColor = Color.Empty;
			ColorGradient = new ColorGradient(Color.White);
			DepthOfEffect = 0;
		}
开发者ID:stewmc,项目名称:vixen,代码行数:14,代码来源:TwinkleData.cs


示例11: ColorGradientEditor

        public ColorGradientEditor(ColorGradient gradient, bool discreteColors, IEnumerable<Color> validDiscreteColors)
        {
            InitializeComponent();
            ForeColor = ThemeColorTable.ForeColor;
            BackColor = ThemeColorTable.BackgroundColor;
            ThemeUpdateControls.UpdateControls(this);
            Icon = Resources.Icon_Vixen3;

            gradientEditPanel.GradientChanged += GradientChangedHandler;
            Gradient = gradient;
            _discreteColors = discreteColors;
            _validDiscreteColors = validDiscreteColors;
            PopulateFormWithGradient(_gradient);
        }
开发者ID:naztrain,项目名称:vixen,代码行数:14,代码来源:ColorGradientEditor.cs


示例12: WipeData

		public WipeData() {
			Curve = new Curve();
			Curve.Points.Clear();
			Curve.Points.Add(0, 0);
		 	Curve.Points.Add(50, 100);
			Curve.Points.Add(100, 0);
		 			
			Direction = WipeDirection.Right;
			ColorGradient = new ColorGradient(Color.White);
			PulseTime = 1000;
			WipeByCount = false;
			PassCount = 1;
			PulsePercent = 33;
		}
开发者ID:stewmc,项目名称:vixen,代码行数:14,代码来源:WipeData.cs


示例13: TreeData

 public TreeData()
 {
     Colors = new List<ColorGradient>{new ColorGradient(Color.Red), new ColorGradient(Color.Lime), new ColorGradient(Color.Blue)};
     BackgroundColor = new ColorGradient(Color.Red);
     ColorType = TreeColorType.Static;
     BranchDirection = TreeBranchDirection.Up;
     Speed = 10;
     ToggleBlend = true;
     Branches = 10;
     LevelCurve = new Curve(new PointPairList(new[] { 0.0, 100.0 }, new[] { 100.0, 100.0 }));
     BlendCurve = new Curve(new PointPairList(new[] { 0.0, 100.0 }, new[] { 70.0, 70.0 }));
     BackgroundLevelCurve = new Curve(new PointPairList(new[] { 0.0, 100.0 }, new[] { 70.0, 70.0 }));
     Orientation=StringOrientation.Vertical;
 }
开发者ID:jaredb7,项目名称:vixen,代码行数:14,代码来源:TreeData.cs


示例14: ButterflyData

		public ButterflyData()
		{
			Gradient = new ColorGradient();
			Gradient.Colors.Clear();
			Gradient.Colors.Add(new ColorPoint(Color.Red,0.0));
			Gradient.Colors.Add(new ColorPoint(Color.Lime, 1.0));
			Iterations = 1;
			ColorScheme = ColorScheme.Gradient;
			ButterflyType = ButterflyType.Type1;
			Repeat = 1;
			BackgroundSkips = 2;
			BackgroundChunks = 1;
			Direction = Direction.Forward;
			LevelCurve = new Curve(new PointPairList(new[] { 0.0, 100.0 }, new[] { 100.0, 100.0 }));
			Orientation=StringOrientation.Vertical;
		}
开发者ID:stewmc,项目名称:vixen,代码行数:16,代码来源:ButterflyData.cs


示例15: SpinData

 public SpinData()
 {
     SpeedFormat = SpinSpeedFormat.RevolutionCount;
     PulseLengthFormat = SpinPulseLengthFormat.EvenlyDistributedAcrossSegments;
     ColorHandling = SpinColorHandling.StaticColor;
     RevolutionCount = 3;
     RevolutionFrequency = 2;
     RevolutionTime = 500;
     PulseTime = 100;
     PulsePercentage = 10;
     DefaultLevel = 0;
     StaticColor = Color.White;
     ColorGradient = new ColorGradient();
     PulseCurve = new Curve();
     ReverseSpin = false;
 }
开发者ID:kjburns31,项目名称:vixen-modules,代码行数:16,代码来源:SpinData.cs


示例16: AlternatingData

 public AlternatingData()
 {
     Level1 = 1;
     Level2 = 1;
     Color1 = Color.White;
     Color2 = Color.Red;
     Enable = true;
     Interval = 500;
     DepthOfEffect = 0;
     GroupEffect = 1;
     StaticColor1 = StaticColor2 = true;
     ColorGradient1 = new ColorGradient(Color.White);
     ColorGradient2 = new ColorGradient(Color.Red);
     Curve1 = new Curve();
     Curve2 = new Curve();
 }
开发者ID:Jchuchla,项目名称:vixen,代码行数:16,代码来源:AlternatingData.cs


示例17: ShockwaveData

 public ShockwaveData()
 {
     Gradient = new ColorGradient();
     Gradient.Colors.Clear();
     Gradient.Colors.Add(new ColorPoint(Color.Red,0.0));
     Gradient.Colors.Add(new ColorPoint(Color.Lime, .5));
     Gradient.Colors.Add(new ColorPoint(Color.Blue, 1.0));
     StartWidth = 5;
     EndWidth = 10;
     StartRadius = 1;
     EndRadius = 10;
     CenterX = 50;
     CenterY = 50;
     Acceleration = 0;
     BlendEdges = true;
     Orientation=StringOrientation.Vertical;
 }
开发者ID:jaredb7,项目名称:vixen,代码行数:17,代码来源:ShockwaveData.cs


示例18: AddIntentsToElement

        private static void AddIntentsToElement(Element element, double[] allPointsTimeOrdered, Curve levelCurve, ColorGradient colorGradient, TimeSpan duration, EffectIntents elementData, bool allowZeroIntensity, Color? color = null)
        {
            if (element != null)
            {
                double lastPosition = allPointsTimeOrdered[0];
                TimeSpan lastEnd = TimeSpan.Zero;
                for (var i = 1; i < allPointsTimeOrdered.Length; i++)
                {
                    double position = allPointsTimeOrdered[i];
                    TimeSpan startTime = lastEnd;
                    TimeSpan timeSpan = TimeSpan.FromMilliseconds(duration.TotalMilliseconds * (position - lastPosition));

                    if (color == null)
                    {
                        var startColor = colorGradient.GetColorAt(lastPosition);
                        var endColor = colorGradient.GetColorAt(position);
                        var startIntensity = levelCurve.GetValue(lastPosition * 100) / 100;
                        var endIntensity = levelCurve.GetValue(position * 100) / 100;

                        if (allowZeroIntensity || !(startIntensity.Equals(0) && endIntensity.Equals(0)))
                        {
                            IIntent intent = IntentBuilder.CreateIntent(startColor, endColor, startIntensity, endIntensity, timeSpan);
                            elementData.AddIntentForElement(element.Id, intent, startTime);
                        }
                    }
                    else
                    {
                        var startIntensity = (colorGradient.GetProportionOfColorAt(lastPosition, (Color)color) * levelCurve.GetValue(lastPosition * 100) / 100);
                        var endIntensity = (colorGradient.GetProportionOfColorAt(position, (Color)color) * levelCurve.GetValue(position * 100) / 100);

                        if (allowZeroIntensity || !(startIntensity.Equals(0) && endIntensity.Equals(0)))
                        {
                            IIntent intent = IntentBuilder.CreateDiscreteIntent((Color)color, startIntensity, endIntensity, timeSpan);
                            elementData.AddIntentForElement(element.Id, intent, startTime);
                        }

                    }

                    lastPosition = position;
                    lastEnd = startTime + timeSpan;
                }
            }
        }
开发者ID:jaredb7,项目名称:vixen,代码行数:43,代码来源:PulseRenderer.cs


示例19: PopulateFormWithGradient

		private void PopulateFormWithGradient(ColorGradient item)
		{
			gradientEditPanel.Gradient = item;
			gradientEditPanel.DiscreteColors = _discreteColors;
			gradientEditPanel.ValidDiscreteColors = _validDiscreteColors;

			// if we're editing one from the library, treat it special
			if (item.IsCurrentLibraryGradient) {
				if (LibraryItemName == null) {
					labelCurve.Text = "This gradient is a library gradient.";
					Text = "Color Gradient Editor: Library Gradient";
				}
				else {
					labelCurve.Text = string.Format("This gradient is the library gradient: {0}", LibraryItemName);
					Text = string.Format("Color Gradient Editor: Library Gradient {0}", LibraryItemName);
				}

				gradientEditPanel.ReadOnly = false;
				buttonSaveToLibrary.Enabled = false;
				buttonLoadFromLibrary.Enabled = false;
				buttonUnlink.Enabled = false;
				buttonEditLibraryItem.Enabled = false;
			}
			else {
				if (item.IsLibraryReference) {
					labelCurve.Text = string.Format("This gradient is linked to the library: {0}", item.LibraryReferenceName);
				}
				else {
					labelCurve.Text = "This gradient is not linked to any in the library.";
				}

				gradientEditPanel.ReadOnly = item.IsLibraryReference;
				buttonSaveToLibrary.Enabled = !item.IsLibraryReference;
				buttonLoadFromLibrary.Enabled = true;
				buttonUnlink.Enabled = item.IsLibraryReference;
				buttonEditLibraryItem.Enabled = item.IsLibraryReference;

				Text = @"Color Gradient Editor";
			}

			gradientEditPanel.Invalidate();
		}
开发者ID:stewmc,项目名称:vixen,代码行数:42,代码来源:ColorGradientEditor.cs


示例20: CheckForInvalidColorData

        //Validate that the we are using valid colors and set appropriate defaults if not.
        private void CheckForInvalidColorData()
        {
            var validColors = GetValidColors();
            if (validColors.Any())
            {
                if (!Data.MeterColorGradient.GetColorsInGradient().IsSubsetOf(validColors))
                {
                    //Our color is not valid for any elements we have.
                    //Try to set a default color gradient from our available colors
                    if (validColors.Count > 1)
                    {
                        //Try to make some kind of transitions
                        List<float> positions = new List<float>(validColors.Count);
                        positions.AddRange(validColors.Select((t, i) => i/(float) (validColors.Count - 1)));

                        ColorBlend linearBlend = new ColorBlend();
                        linearBlend.Colors = validColors.ToArray();
                        linearBlend.Positions = positions.ToArray();

                        MeterColorGradient = new ColorGradient(linearBlend);

                    }
                    else
                    {
                        MeterColorGradient = new ColorGradient(validColors.First());
                    }
                }

                //ensure we are using Custom and we can't change it. We are limited in discrete color mode
                MeterColorStyle = MeterColorTypes.Custom;
                EnableColorTypesSelection(false);
            }
            else
            {
                EnableColorTypesSelection(true);
            }
        }
开发者ID:jaredb7,项目名称:vixen,代码行数:38,代码来源:Waveform.cs



注:本文中的ColorGradient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ColorImageFormat类代码示例发布时间:2022-05-24
下一篇:
C# ColorFormat类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap