예제 #1
0
        /// <summary>
        /// Calculates the brushes.
        /// </summary>
        /// <param name="scatterSymbol">ScatterSymbol, already processed via <see cref="CalculateOverriddenScatterSymbol"/></param>
        /// <param name="plotColor">The current plot color.</param>
        /// <param name="cachedPathData">The cached path data.</param>
        /// <param name="cachedBrushData">Cached brush data, which will be filled-in during this call..</param>
        /// <returns>True if new cached brush data were calculated; false if the cached data were up-to-date.</returns>
        private bool CalculateBrushes(IScatterSymbol scatterSymbol, NamedColor plotColor, CachedPathData cachedPathData, ref CachedBrushData cachedBrushData)
        {
            if (plotColor == cachedBrushData.PlotColor)
            {
                return(false); // cached data valid and could be reused;
            }
            cachedBrushData.Clear();
            cachedBrushData.PlotColor = plotColor;

            var plotColorInfluence = _overridePlotColorInfluence ?? scatterSymbol.PlotColorInfluence;

            if (null != cachedPathData.InsetPath)
            {
                var insetColor = _overrideInsetColor ?? scatterSymbol.Inset.Color;
                if (plotColorInfluence.HasFlag(PlotColorInfluence.InsetColorFull))
                {
                    insetColor = plotColor;
                }
                else if (plotColorInfluence.HasFlag(PlotColorInfluence.InsetColorPreserveAlpha))
                {
                    insetColor = plotColor.NewWithAlphaValue(insetColor.Color.A);
                }

                cachedBrushData.InsetBrush = new SolidBrush(insetColor);
            }

            if (null != cachedPathData.FillPath)
            {
                var fillColor = _overrideFillColor ?? scatterSymbol.FillColor;
                if (plotColorInfluence.HasFlag(PlotColorInfluence.FillColorFull))
                {
                    fillColor = plotColor;
                }
                else if (plotColorInfluence.HasFlag(PlotColorInfluence.FillColorPreserveAlpha))
                {
                    fillColor = plotColor.NewWithAlphaValue(fillColor.Color.A);
                }

                cachedBrushData.FillBrush = new SolidBrush(fillColor);
            }

            if (null != cachedPathData.FramePath)
            {
                var frameColor = _overrideFrameColor ?? scatterSymbol.Frame.Color;
                if (plotColorInfluence.HasFlag(PlotColorInfluence.FrameColorFull))
                {
                    frameColor = plotColor;
                }
                else if (plotColorInfluence.HasFlag(PlotColorInfluence.FrameColorPreserveAlpha))
                {
                    frameColor = plotColor.NewWithAlphaValue(frameColor.Color.A);
                }

                cachedBrushData.FrameBrush = new SolidBrush(frameColor);
            }

            return(true);
        }
예제 #2
0
        private void GetBrushes(IScatterSymbol scatterSymbol, NamedColor plotColor, PathGeometry fillPath, PathGeometry framePath, PathGeometry insetPath, out Brush fillBrush, out Brush frameBrush, out Brush insetBrush)
        {
            fillBrush = frameBrush = insetBrush = null;

            var plotColorInfluence = scatterSymbol.PlotColorInfluence;

            if (null != insetPath)
            {
                var insetColor = scatterSymbol.Inset.Color;
                if (plotColorInfluence.HasFlag(PlotColorInfluence.InsetColorFull))
                {
                    insetColor = plotColor;
                }
                else if (plotColorInfluence.HasFlag(PlotColorInfluence.InsetColorPreserveAlpha))
                {
                    insetColor = plotColor.NewWithAlphaValue(insetColor.Color.A);
                }

                insetBrush = new SolidColorBrush(GuiHelper.ToWpf(insetColor));
            }

            if (null != fillPath)
            {
                var fillColor = scatterSymbol.FillColor;
                if (plotColorInfluence.HasFlag(PlotColorInfluence.FillColorFull))
                {
                    fillColor = plotColor;
                }
                else if (plotColorInfluence.HasFlag(PlotColorInfluence.FillColorPreserveAlpha))
                {
                    fillColor = plotColor.NewWithAlphaValue(fillColor.Color.A);
                }

                fillBrush = new SolidColorBrush(GuiHelper.ToWpf(fillColor));
            }

            if (null != framePath)
            {
                var frameColor = scatterSymbol.Frame.Color;
                if (plotColorInfluence.HasFlag(PlotColorInfluence.FrameColorFull))
                {
                    frameColor = plotColor;
                }
                else if (plotColorInfluence.HasFlag(PlotColorInfluence.FrameColorPreserveAlpha))
                {
                    frameColor = plotColor.NewWithAlphaValue(frameColor.Color.A);
                }

                frameBrush = new SolidColorBrush(GuiHelper.ToWpf(frameColor));
            }
        }
예제 #3
0
		/// <summary>
		/// Calculates the brushes.
		/// </summary>
		/// <param name="scatterSymbol">ScatterSymbol, already processed via <see cref="CalculateOverriddenScatterSymbol"/></param>
		/// <param name="plotColor">The current plot color.</param>
		/// <param name="cachedPathData">The cached path data.</param>
		/// <param name="cachedBrushData">Cached brush data, which will be filled-in during this call..</param>
		/// <returns>True if new cached brush data were calculated; false if the cached data were up-to-date.</returns>
		private bool CalculateBrushes(IScatterSymbol scatterSymbol, NamedColor plotColor, CachedPathData cachedPathData, ref CachedBrushData cachedBrushData)
		{
			if (plotColor == cachedBrushData.PlotColor)
				return false; // cached data valid and could be reused;

			cachedBrushData.Clear();
			cachedBrushData.PlotColor = plotColor;

			var plotColorInfluence = _overridePlotColorInfluence ?? scatterSymbol.PlotColorInfluence;

			if (null != cachedPathData.InsetPath)
			{
				var insetColor = _overrideInsetColor ?? scatterSymbol.Inset.Color;
				if (plotColorInfluence.HasFlag(PlotColorInfluence.InsetColorFull))
					insetColor = plotColor;
				else if (plotColorInfluence.HasFlag(PlotColorInfluence.InsetColorPreserveAlpha))
					insetColor = plotColor.NewWithAlphaValue(insetColor.Color.A);

				cachedBrushData.InsetBrush = new SolidBrush(insetColor);
			}

			if (null != cachedPathData.FillPath)
			{
				var fillColor = _overrideFillColor ?? scatterSymbol.FillColor;
				if (plotColorInfluence.HasFlag(PlotColorInfluence.FillColorFull))
					fillColor = plotColor;
				else if (plotColorInfluence.HasFlag(PlotColorInfluence.FillColorPreserveAlpha))
					fillColor = plotColor.NewWithAlphaValue(fillColor.Color.A);

				cachedBrushData.FillBrush = new SolidBrush(fillColor);
			}

			if (null != cachedPathData.FramePath)
			{
				var frameColor = _overrideFrameColor ?? scatterSymbol.Frame.Color;
				if (plotColorInfluence.HasFlag(PlotColorInfluence.FrameColorFull))
					frameColor = plotColor;
				else if (plotColorInfluence.HasFlag(PlotColorInfluence.FrameColorPreserveAlpha))
					frameColor = plotColor.NewWithAlphaValue(frameColor.Color.A);

				cachedBrushData.FrameBrush = new SolidBrush(frameColor);
			}

			return true;
		}
예제 #4
0
		private void GetBrushes(IScatterSymbol scatterSymbol, NamedColor plotColor, PathGeometry fillPath, PathGeometry framePath, PathGeometry insetPath, out Brush fillBrush, out Brush frameBrush, out Brush insetBrush)
		{
			fillBrush = frameBrush = insetBrush = null;

			var plotColorInfluence = scatterSymbol.PlotColorInfluence;

			if (null != insetPath)
			{
				var insetColor = scatterSymbol.Inset.Color;
				if (plotColorInfluence.HasFlag(PlotColorInfluence.InsetColorFull))
					insetColor = plotColor;
				else if (plotColorInfluence.HasFlag(PlotColorInfluence.InsetColorPreserveAlpha))
					insetColor = plotColor.NewWithAlphaValue(insetColor.Color.A);

				insetBrush = new SolidColorBrush(GuiHelper.ToWpf(insetColor));
			}

			if (null != fillPath)
			{
				var fillColor = scatterSymbol.FillColor;
				if (plotColorInfluence.HasFlag(PlotColorInfluence.FillColorFull))
					fillColor = plotColor;
				else if (plotColorInfluence.HasFlag(PlotColorInfluence.FillColorPreserveAlpha))
					fillColor = plotColor.NewWithAlphaValue(fillColor.Color.A);

				fillBrush = new SolidColorBrush(GuiHelper.ToWpf(fillColor));
			}

			if (null != framePath)
			{
				var frameColor = scatterSymbol.Frame.Color;
				if (plotColorInfluence.HasFlag(PlotColorInfluence.FrameColorFull))
					frameColor = plotColor;
				else if (plotColorInfluence.HasFlag(PlotColorInfluence.FrameColorPreserveAlpha))
					frameColor = plotColor.NewWithAlphaValue(frameColor.Color.A);

				frameBrush = new SolidColorBrush(GuiHelper.ToWpf(frameColor));
			}
		}