Exemplo n.º 1
0
        public Brush GetBackBrush(MapGraphics g, GraphicsPath path)
        {
            RectangleF    bounds        = path.GetBounds();
            Brush         brush         = null;
            Color         color         = this.ApplyLayerTransparency(this.ColorInt);
            Color         color2        = this.ApplyLayerTransparency(this.SecondaryColorInt);
            GradientType  gradientType  = this.GradientTypeInt;
            MapHatchStyle mapHatchStyle = this.HatchStyleInt;

            if (mapHatchStyle != 0)
            {
                return(MapGraphics.GetHatchBrush(mapHatchStyle, color, color2));
            }
            if (gradientType != 0)
            {
                return(g.GetGradientBrush(bounds, color, color2, gradientType));
            }
            return(new SolidBrush(color));
        }
Exemplo n.º 2
0
        public Brush GetBackBrush(MapGraphics g)
        {
            RectangleF    absoluteRectangle  = g.GetAbsoluteRectangle(new RectangleF(0f, 0f, 100f, 100f));
            Brush         brush              = null;
            Color         backColor          = this.BackColor;
            Color         backSecondaryColor = this.BackSecondaryColor;
            GradientType  backGradientType   = this.BackGradientType;
            MapHatchStyle backHatchStyle     = this.BackHatchStyle;

            if (backHatchStyle != 0)
            {
                brush = MapGraphics.GetHatchBrush(backHatchStyle, backColor, backSecondaryColor);
            }
            else if (backGradientType != 0)
            {
                brush = g.GetGradientBrush(absoluteRectangle, backColor, backSecondaryColor, backGradientType);
                float num = this.DetermineAngle();
                if (num != 0.0)
                {
                    PointF pointF = new PointF((float)(absoluteRectangle.X + absoluteRectangle.Width / 2.0), (float)(absoluteRectangle.Y + absoluteRectangle.Height / 2.0));
                    if (brush is LinearGradientBrush)
                    {
                        ((LinearGradientBrush)brush).TranslateTransform((float)(0.0 - pointF.X), (float)(0.0 - pointF.Y), MatrixOrder.Append);
                        ((LinearGradientBrush)brush).RotateTransform(num, MatrixOrder.Append);
                        ((LinearGradientBrush)brush).TranslateTransform(pointF.X, pointF.Y, MatrixOrder.Append);
                    }
                    else if (brush is PathGradientBrush)
                    {
                        ((PathGradientBrush)brush).TranslateTransform((float)(0.0 - pointF.X), (float)(0.0 - pointF.Y), MatrixOrder.Append);
                        ((PathGradientBrush)brush).RotateTransform(num, MatrixOrder.Append);
                        ((PathGradientBrush)brush).TranslateTransform(pointF.X, pointF.Y, MatrixOrder.Append);
                    }
                }
            }
            else
            {
                brush = new SolidBrush(backColor);
            }
            return(brush);
        }
        private Brush CreateColorBoxBrush(MapGraphics g, RectangleF colorBoxBoundsAbs, int colorIndex)
        {
            if (colorIndex < 0)
            {
                return(new SolidBrush(this.RangeGapColor));
            }
            Brush         brush          = null;
            SwatchColor   swatchColor    = this.Colors[colorIndex];
            Color         color          = swatchColor.Color;
            Color         secondaryColor = swatchColor.SecondaryColor;
            GradientType  gradientType   = swatchColor.GradientType;
            MapHatchStyle hatchStyle     = swatchColor.HatchStyle;

            if (hatchStyle != 0)
            {
                return(MapGraphics.GetHatchBrush(hatchStyle, color, secondaryColor));
            }
            if (gradientType != 0)
            {
                return(g.GetGradientBrush(colorBoxBoundsAbs, color, secondaryColor, gradientType));
            }
            return(new SolidBrush(color));
        }