当前位置: 首页>>代码示例>>C#>>正文


C# ColorGradient.GetColorsInGradient方法代码示例

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


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

示例1: 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

示例2: GenerateEffectIntents

        /// <summary>
        /// Convienience method to generate intents that knows how to deal with discrete colors.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="gradient"></param>
        /// <param name="level"></param>
        /// <param name="startPos"></param>
        /// <param name="endPos"></param>
        /// <param name="duration"></param>
        /// <param name="startTime"></param>
        /// <param name="isDiscrete"></param>
        /// <returns></returns>
        protected EffectIntents GenerateEffectIntents(ElementNode node, ColorGradient gradient, Curve level, double startPos, double endPos,
            TimeSpan duration, TimeSpan startTime, bool isDiscrete)
        {
            EffectIntents result = new EffectIntents();
            if (isDiscrete)
            {
                IEnumerable<Color> colors = ColorModule.getValidColorsForElementNode(node, false)
                         .Intersect(gradient.GetColorsInGradient());
                foreach (Color color in colors)
                {
                    double proportion = gradient.GetProportionOfColorAt(startPos, color);
                    var startIntensity = (level.GetValue(startPos * 100) / 100) * proportion;
                    proportion = gradient.GetProportionOfColorAt(endPos, color);
                    var endIntensity = (level.GetValue(endPos * 100) / 100) * proportion;
                    if (startIntensity > 0 && endIntensity > 0)
                    {
                        var intent = CreateDiscreteIntent(color, startIntensity, endIntensity, duration);
                        result.AddIntentForElement(node.Element.Id, intent, startTime);
                    }
                }
            }
            else
            {
                var startIntensity = level.GetValue(startPos * 100) / 100;
                var endIntensity = level.GetValue(endPos * 100) / 100;
                if (startIntensity > 0 && endIntensity > 0)
                {
                    var intent = CreateIntent(gradient.GetColorAt(startPos), gradient.GetColorAt(endPos), startIntensity, endIntensity, duration);
                    result.AddIntentForElement(node.Element.Id, intent, startTime);
                }
            }

            return result;
        }
开发者ID:jaredb7,项目名称:vixen,代码行数:46,代码来源:AudioPluginBase.cs


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