예제 #1
0
 public DictGradientMap(string filename, bool type)
 {
     c_points = new SortedDictionary<double, ColorValue>();
       c_type = GradientType.GRADIENT_MAP_RGB;
       LoadFromFile(filename, type);
       c_shift = 0;
 }
예제 #2
0
 public DictGradientMap()
 {
     c_points = new SortedDictionary<double, ColorValue>();
       c_type = GradientType.GRADIENT_MAP_RGB;
       c_points[0] = new ColorValue(true, 0.0, 0.0, 0.0);
       c_points[1] = new ColorValue(true, 1.0, 1.0, 1.0);
       c_shift = 0;
 }
예제 #3
0
 public DictGradientMap(ColorValue start, ColorValue end)
 {
     c_points = new SortedDictionary<double, ColorValue>();
       c_type = GradientType.GRADIENT_MAP_RGB;
       c_points[0] = start;
       c_points[1] = end;
       c_shift = 0;
 }
예제 #4
0
 public GradientDefinition(Color c1,Color c2,PointF p1,PointF p2,GradientType type)
 {
     color1 = c1;
     color2 = c2;
     point1 = p1;
     point2 = p2;
     gradientType = type;
 }
예제 #5
0
 /// <summary>
 /// Creates a new instance of a Gradient Pattern using the specified colors and angle
 /// </summary>
 /// <param name="startColor">The start color</param>
 /// <param name="endColor">The end color</param>
 /// <param name="angle">The direction of the gradient, measured in degrees clockwise from the x-axis</param>
 public GradientPattern(Color startColor, Color endColor, double angle)
 {
     _gradientType = GradientType.Linear;
     _colors = new Color[2];
     _colors[0] = startColor;
     _colors[1] = endColor;
     _positions = new[] { 0F, 1F };
     _angle = angle;
 }
예제 #6
0
 /// <summary>
 /// Creates a new instance of GradientPattern
 /// </summary>
 public GradientPattern()
 {
     _gradientType = GradientType.Linear;
     _colors = new Color[2];
     _colors[0] = SymbologyGlobal.RandomLightColor(1F);
     _colors[1] = _colors[0].Darker(.3F);
     _positions = new[] { 0F, 1F };
     _angle = -45;
 }
예제 #7
0
 public GradientDefinition()
 {
     color1 = Color.White;
     color2 = Color.Black;
     point1 = new PointF(0.0f, 0.0f);
     point2 = new PointF(1.0f, 0.0f);
     blendPosition1 = 0.0f;
     blendPosition2 = 1.0f;
     gradientType = GradientType.Linear;
 }
예제 #8
0
 public Gradient(GradientType type)
 {
     this.OffsetX = 0;
     this.OffsetY = 0;
     this.Rotation = 0;
     this.Type = GradientType.LinearGradient;
     this.PercentScaleX = 100;
     this.PercentScaleY = 100;
     this.Type = type;
 }
예제 #9
0
        public GradientPanel()
        {
            startPosition = Point.Empty;
            endPosition = Point.Empty;
            borderPen = new Pen(Color.Black, 2);
            gradType = GradientType.Linear;

            //to reduce blinking
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.SupportsTransparentBackColor, false);
        }
 public void Init(
     System.Drawing.Brush brushText,
     System.Drawing.Color clrOutline1,
     System.Drawing.Color clrOutline2,
     int nThickness,
     GradientType useCurveGradient)
 {
     m_brushText    = brushText;
     m_bClrText     = false;
     m_clrOutline1  = clrOutline1;
     m_clrOutline2  = clrOutline2;
     m_nThickness   = nThickness;
     m_GradientType = useCurveGradient;
 }
 public void Init(
     Color clrText,
     Color clrOutline1,
     Color clrOutline2,
     int nThickness,
     GradientType useCurveGradient)
 {
     m_clrText      = clrText;
     m_bClrText     = true;
     m_clrOutline1  = clrOutline1;
     m_clrOutline2  = clrOutline2;
     m_nThickness   = nThickness;
     m_GradientType = useCurveGradient;
 }
예제 #12
0
 private GradientStroke(string name, GradientType gradientType, AnimatableGradientColorValue gradientColor, AnimatableIntegerValue opacity, AnimatablePointValue startPoint, AnimatablePointValue endPoint, AnimatableFloatValue width, ShapeStroke.LineCapType capType, ShapeStroke.LineJoinType joinType, IList <AnimatableFloatValue> lineDashPattern, AnimatableFloatValue dashOffset)
 {
     Name            = name;
     GradientType    = gradientType;
     GradientColor   = gradientColor;
     Opacity         = opacity;
     StartPoint      = startPoint;
     EndPoint        = endPoint;
     Width           = width;
     CapType         = capType;
     JoinType        = joinType;
     LineDashPattern = lineDashPattern;
     DashOffset      = dashOffset;
 }
예제 #13
0
 public GradientFill(string name, GradientType gradientType, PathFillType fillType,
                     AnimatableGradientColorValue gradientColor, AnimatableIntegerValue opacity, AnimatablePointValue startPoint,
                     AnimatablePointValue endPoint, AnimatableFloatValue highlightLength, AnimatableFloatValue highlightAngle)
 {
     GradientType    = gradientType;
     FillType        = fillType;
     GradientColor   = gradientColor;
     Opacity         = opacity;
     StartPoint      = startPoint;
     EndPoint        = endPoint;
     Name            = name;
     HighlightLength = highlightLength;
     HighlightAngle  = highlightAngle;
 }
 public void Init(
     ICanvasBrush brushText,
     Color clrOutline1,
     Color clrOutline2,
     int nThickness,
     GradientType useCurveGradient)
 {
     m_brushText    = brushText;
     m_bClrText     = false;
     m_clrOutline1  = clrOutline1;
     m_clrOutline2  = clrOutline2;
     m_nThickness   = nThickness;
     m_GradientType = useCurveGradient;
 }
예제 #15
0
 public static Legend CreateLegend(Chart chart, string legendName
                                   , Color backColor, Color backGradientEndColor, Color borderColor
                                   , Font font
                                   , GradientType gradientType, ChartHatchStyle chartHatchStyle
                                   , bool positionAuto, float positionX, float positionY, float positionWidth, float positionHeight)
 {
     return(CreateLegend(chart, legendName
                         , backColor, backGradientEndColor, borderColor
                         , font
                         , gradientType, chartHatchStyle
                         , -1, ChartDashStyle.NotSet
                         , -1, Color.Empty
                         , positionAuto, positionX, positionX, positionWidth, positionHeight));
 }
예제 #16
0
        internal override void ParseXml(XmlReader xmlNode)
        {
            Utilities.Instance.get_float4(ins.Vector, xmlNode.GetAttribute("vector"));
            var t = xmlNode.GetAttribute("type");

            if (!string.IsNullOrEmpty(t))
            {
                GradientType gt = GradientType.Diagonal;
                if (Enum.TryParse(t, out gt))
                {
                    Gradient = gt;
                }
            }
        }
예제 #17
0
 public GradientStroke(string name, GradientType gradientType, AnimatableGradientColorValue gradientColor, AnimatableIntegerValue opacity, AnimatablePointValue startPoint, AnimatablePointValue endPoint, AnimatableFloatValue width, ShapeStroke.LineCapType capType, ShapeStroke.LineJoinType joinType, float miterLimit, List <AnimatableFloatValue> lineDashPattern, AnimatableFloatValue dashOffset, bool hidden)
 {
     Name            = name;
     GradientType    = gradientType;
     GradientColor   = gradientColor;
     Opacity         = opacity;
     StartPoint      = startPoint;
     EndPoint        = endPoint;
     Width           = width;
     CapType         = capType;
     JoinType        = joinType;
     MiterLimit      = miterLimit;
     LineDashPattern = lineDashPattern;
     DashOffset      = dashOffset;
     IsHidden        = hidden;
 }
예제 #18
0
    private void Reset()
    {
        //Tricks and hacks to ensure that the Reset method is called, even when adding the component at runtime
        if (_resetCalled)
        {
            return;
        }

        _resetCalled = true;

        //Setup a cool-looking gradient by default
        GradientType = GradientType.RadialAspectFitWidth;
        GradientColorKey colorKeyOne = new GradientColorKey(new Color(0.9f, 0.9f, 0.9f, 1.0f), 0f);
        GradientColorKey colorKeyTwo = new GradientColorKey(new Color(0.7f, 0.7f, 0.7f, 1.0f), 1f);

        Gradient.colorKeys = new [] { colorKeyOne, colorKeyTwo };
    }
예제 #19
0
        public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
        {
            if (propertyValues == null)
            {
                throw new ArgumentNullException("propertyValues");
            }

            // we allow user to change only next gradient values:
            Color        c1 = (Color)propertyValues["Color1"];
            Color        c2 = (Color)propertyValues["Color2"];
            GradientType gt = (GradientType)propertyValues["GradientType"];

            GradientDefinition gd = ((RectangleShape)context.Instance).GradientDefinition;

            //and another (Point1, Point2) are just copyed from instance item...
            return(new GradientDefinition(c1, c2, gd.Point1, gd.Point2, gt));
        }
        internal GradientStrokeContent(LottieDrawable lottieDrawable, BaseLayer layer, GradientStroke stroke) : base(lottieDrawable, layer, ShapeStroke.LineCapTypeToPaintCap(stroke.CapType), ShapeStroke.LineJoinTypeToPaintLineJoin(stroke.JoinType), stroke.Opacity, stroke.Width, stroke.LineDashPattern, stroke.DashOffset)
        {
            Name        = stroke.Name;
            _type       = stroke.GradientType;
            _cacheSteps = (int)(lottieDrawable.Composition.Duration / CacheStepsMs);

            _colorAnimation = (KeyframeAnimation <GradientColor>)stroke.GradientColor.CreateAnimation();
            _colorAnimation.ValueChanged += OnValueChanged;
            layer.AddAnimation(_colorAnimation);

            _startPointAnimation = (KeyframeAnimation <PointF>)stroke.StartPoint.CreateAnimation();
            _startPointAnimation.ValueChanged += OnValueChanged;
            layer.AddAnimation(_startPointAnimation);

            _endPointAnimation = (KeyframeAnimation <PointF>)stroke.EndPoint.CreateAnimation();
            _endPointAnimation.ValueChanged += OnValueChanged;
            layer.AddAnimation(_endPointAnimation);
        }
예제 #21
0
        public static void modifyVertices(
            List <UIVertex> vertexList, Fn <Color32, float, Color32> f, GradientType type, bool useGraphicAlpha
            )
        {
            switch (type)
            {
            case GradientType.Vertical:
                modifyVertices(vertexList, f, v => v.y, useGraphicAlpha);
                break;

            case GradientType.Horizontal:
                modifyVertices(vertexList, f, v => v.x, useGraphicAlpha);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
예제 #22
0
 public void SetGradient(GradientType grad)
 {
     if (grad == GradientType.Backwards)
     {
         body.colorGradient  = backwardGradient;
         leftHead.startColor = leftHead.endColor = rightHead.startColor = rightHead.endColor = bc2;
     }
     else if (grad == GradientType.Forwards)
     {
         body.colorGradient  = forwardGradient;
         leftHead.startColor = leftHead.endColor = rightHead.startColor = rightHead.endColor = fc2;
     }
     else
     {
         body.colorGradient  = downwardGradient;
         leftHead.startColor = leftHead.endColor = rightHead.startColor = rightHead.endColor = dc2;
     }
 }
        private static GradientShape CreateGradientShape(GradientType gradientType, GradientRepeatType repeatType, PointDouble startPoint, PointDouble endPoint)
        {
            if (startPoint == endPoint)
            {
                return(null);
            }
            switch (gradientType)
            {
            case GradientType.LinearClamped:
                return(new GradientShapes.LinearStraight(startPoint, endPoint));

            case GradientType.LinearReflected:
                return(new GradientShapes.LinearReflected(startPoint, endPoint));

            case GradientType.LinearDiamond:
                return(new GradientShapes.LinearDiamond(startPoint, endPoint));

            case GradientType.Radial:
                return(new GradientShapes.Radial(startPoint, endPoint));

            case GradientType.Conical:
                if (repeatType != GradientRepeatType.NoRepeat)
                {
                    return(new GradientShapes.Conical(startPoint, endPoint));
                }
                return(new GradientShapes.ConicalNoRepeat(startPoint, endPoint));

            case GradientType.Spiral:
                if (repeatType != GradientRepeatType.RepeatReflected)
                {
                    return(new GradientShapes.Spiral(startPoint, endPoint));
                }
                return(new GradientShapes.SpiralReflected(startPoint, endPoint));

            case GradientType.SpiralCounterClockwise:
                if (repeatType != GradientRepeatType.RepeatReflected)
                {
                    return(new GradientShapes.SpiralCCW(startPoint, endPoint));
                }
                return(new GradientShapes.SpiralReflectedCCW(startPoint, endPoint));
            }
            throw ExceptionUtil.InvalidEnumArgumentException <GradientType>(gradientType, "gradientType");
        }
예제 #24
0
        public void SetAttributes(DataPointAttributes attrib, bool area3D)
        {
            this.borderColor            = attrib.BorderColor;
            this.borderWidth            = attrib.BorderWidth;
            this.borderStyle            = attrib.BorderStyle;
            this.markerStyle            = attrib.MarkerStyle;
            this.markerSize             = attrib.MarkerSize;
            this.markerImage            = attrib.MarkerImage;
            this.markerImageTranspColor = attrib.MarkerImageTransparentColor;
            this.markerColor            = attrib.MarkerColor;
            this.markerBorderColor      = attrib.MarkerBorderColor;
            this.markerBorderWidth      = attrib.MarkerBorderWidth;
            float num = 96f;

            if (this.common != null)
            {
                num = this.common.graph.Graphics.DpiX;
            }
            int num2 = (int)Math.Round(2.0 * num / 96.0);

            if (this.markerBorderWidth > num2)
            {
                this.markerBorderWidth = num2;
            }
            if (attrib.MarkerBorderWidth <= 0)
            {
                this.markerBorderColor = Color.Transparent;
            }
            if (this.style == LegendImageStyle.Line && this.borderWidth <= (int)Math.Round(num / 96.0))
            {
                this.borderWidth = num2;
            }
            if (!area3D)
            {
                this.backGradientType     = attrib.BackGradientType;
                this.backGradientEndColor = attrib.BackGradientEndColor;
                this.backImageTranspColor = attrib.BackImageTransparentColor;
                this.backImage            = attrib.BackImage;
                this.backImageMode        = attrib.BackImageMode;
                this.backImageAlign       = attrib.BackImageAlign;
                this.backHatchStyle       = attrib.BackHatchStyle;
            }
        }
예제 #25
0
        internal void SetAttributes(DataPointAttributes attrib, bool area3D)
        {
            borderColor            = attrib.BorderColor;
            borderWidth            = attrib.BorderWidth;
            borderStyle            = attrib.BorderStyle;
            markerStyle            = attrib.MarkerStyle;
            markerSize             = attrib.MarkerSize;
            markerImage            = attrib.MarkerImage;
            markerImageTranspColor = attrib.MarkerImageTransparentColor;
            markerColor            = attrib.MarkerColor;
            markerBorderColor      = attrib.MarkerBorderColor;
            markerBorderWidth      = attrib.MarkerBorderWidth;
            float num = 96f;

            if (common != null)
            {
                num = common.graph.Graphics.DpiX;
            }
            int num2 = (int)Math.Round(2f * num / 96f);

            if (markerBorderWidth > num2)
            {
                markerBorderWidth = num2;
            }
            if (attrib.MarkerBorderWidth <= 0)
            {
                markerBorderColor = Color.Transparent;
            }
            if (style == LegendImageStyle.Line && borderWidth <= (int)Math.Round(num / 96f))
            {
                borderWidth = num2;
            }
            if (!area3D)
            {
                backGradientType     = attrib.BackGradientType;
                backGradientEndColor = attrib.BackGradientEndColor;
                backImageTranspColor = attrib.BackImageTransparentColor;
                backImage            = attrib.BackImage;
                backImageMode        = attrib.BackImageMode;
                backImageAlign       = attrib.BackImageAlign;
                backHatchStyle       = attrib.BackHatchStyle;
            }
        }
예제 #26
0
 public static void DrawBackground(Graphics g, Color settingsColor1, Color settingsColor2,
                                   float width, float height, GradientType gradientType)
 {
     if (settingsColor1.A > 0 ||
         gradientType != GradientType.Plain &&
         settingsColor2.A > 0)
     {
         var gradientBrush = new LinearGradientBrush(
             new PointF(0, 0),
             gradientType == GradientType.Horizontal
                     ? new PointF(width, 0)
                     : new PointF(0, height),
             settingsColor1,
             gradientType == GradientType.Plain
                     ? settingsColor1
                     : settingsColor2);
         g.FillRectangle(gradientBrush, 0, 0, width, height);
     }
 }
예제 #27
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));
        }
예제 #28
0
        public void Draw()
        {
            gradientType = (GradientType)EditorGUILayout.EnumPopup("Fill", gradientType);

            gradient = EditorGUILayout.GradientField("Color", gradient);

            if (gradientType == GradientType.RADIAL)
            {
                radialMaskThreshold = EditorGUILayout.FloatField("Mask threshold", radialMaskThreshold);

                if (GUI.changed)
                {
                    if (radialMaskThreshold < 0)
                    {
                        radialMaskThreshold = 0;
                    }
                }
            }

            flip = EditorGUILayout.Toggle("Flip", flip);
        }
예제 #29
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 bool IsAntialiasingRequiredForShape(GradientType gradientType, GradientRepeatType gradientRepeatType, PointDouble startPoint, PointDouble endPoint)
        {
            if (gradientRepeatType == GradientRepeatType.RepeatReflected)
            {
                VectorDouble num2 = (VectorDouble)(endPoint - startPoint);
                return(num2.Length < 8.0);
            }
            switch (gradientType)
            {
            case GradientType.LinearClamped:
            case GradientType.LinearReflected:
            case GradientType.LinearDiamond:
            case GradientType.Radial:
                return(gradientRepeatType == GradientRepeatType.RepeatWrapped);

            case GradientType.Conical:
            case GradientType.Spiral:
            case GradientType.SpiralCounterClockwise:
                return(true);
            }
            throw ExceptionUtil.InvalidEnumArgumentException <GradientType>(gradientType, "gradientType");
        }
예제 #31
0
        public static void CreateGradient(UIView view, nfloat cornerRadius, GradientType gradientType = GradientType.Orange)
        {
            var gradient = new CAGradientLayer();

            gradient.Frame      = view.Bounds;
            gradient.StartPoint = StartGradientPoint;
            gradient.EndPoint   = EndGradientPoint;

            switch (gradientType)
            {
            case GradientType.Blue:
                gradient.Colors = BlueGradient;
                break;

            default:
                gradient.Colors = OrangeGradient;
                break;
            }

            gradient.CornerRadius = cornerRadius;
            view.Layer.InsertSublayer(gradient, 0);
        }
예제 #32
0
        public Brush GetBackBrush(GaugeGraphics g)
        {
            RectangleF      absoluteRectangle = g.GetAbsoluteRectangle(new RectangleF(0f, 0f, 100f, 100f));
            Brush           brush             = null;
            Color           color             = this.BackColor;
            Color           color2            = this.BackGradientEndColor;
            GradientType    gradientType      = this.BackGradientType;
            GaugeHatchStyle gaugeHatchStyle   = this.BackHatchStyle;

            if (gaugeHatchStyle != 0)
            {
                brush = GaugeGraphics.GetHatchBrush(gaugeHatchStyle, color, color2);
            }
            else if (gradientType != 0)
            {
                brush = g.GetGradientBrush(absoluteRectangle, color, color2, gradientType);
                if (this.Angle != 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(this.Angle, 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(this.Angle, MatrixOrder.Append);
                        ((PathGradientBrush)brush).TranslateTransform(pointF.X, pointF.Y, MatrixOrder.Append);
                    }
                }
            }
            else
            {
                brush = new SolidBrush(color);
            }
            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));
        }
예제 #34
0
    private static string GetKeywodForGradientType(GradientType gradientType)
    {
        switch (gradientType)
        {
        case GradientType.Horizontal:
            return("HORIZONTAL_GRADIENT");

        case GradientType.Vertical:
            return("VERTICAL_GRADIENT");

        case GradientType.Radial:
            return("RADIAL_FIT_GRADIENT");

        case GradientType.RadialAspectFitWidth:
            return("RADIAL_ASPECT_WIDTH_GRADIENT");

        case GradientType.RadialAspectFitHeight:
            return("RADIAL_ASPECT_HEIGHT_GRADIENT");

        default:
            throw new ArgumentOutOfRangeException("gradientType", gradientType, null);
        }
    }
예제 #35
0
 public static void DundasChartBase(Chart chart
                                    , ChartImageType chartImageType
                                    , int width
                                    , int height
                                    , BorderSkinStyle borderSkinStyle
                                    , Color borderLineColor
                                    , int borderLineWidth
                                    , Color backColor
                                    , Color backGradientEndColor
                                    , Color borderColor
                                    , ChartDashStyle chartDashStyle
                                    , int borderWidth
                                    , ChartHatchStyle chartHatchStyle
                                    , GradientType gradientType
                                    , AntiAliasing antiAliasing
                                    )
 {
     DundasChartBase(chart
                     , chartImageType
                     , width, height
                     , borderSkinStyle
                     , borderLineColor
                     , borderLineWidth
                     , backColor
                     , backGradientEndColor
                     , borderColor
                     , chartDashStyle
                     , borderWidth
                     , chartHatchStyle
                     , gradientType
                     , antiAliasing
                     , null
                     , ChartImageWrapMode.Unscaled
                     , ChartImageAlign.TopRight
                     , Color.Empty);
 }
예제 #36
0
        internal GradientFillContent(LottieDrawable lottieDrawable, BaseLayer layer, GradientFill fill)
        {
            Name            = fill.Name;
            _lottieDrawable = lottieDrawable;
            _type           = fill.GradientType;
            _path.FillType  = fill.FillType;
            _cacheSteps     = (int)(lottieDrawable.Composition.Duration / CacheStepsMs);

            _colorAnimation = (KeyframeAnimation <GradientColor>)fill.GradientColor.CreateAnimation();
            _colorAnimation.ValueChanged += OnValueChanged;
            layer.AddAnimation(_colorAnimation);

            _opacityAnimation = (KeyframeAnimation <int?>)fill.Opacity.CreateAnimation();
            _opacityAnimation.ValueChanged += OnValueChanged;
            layer.AddAnimation(_opacityAnimation);

            _startPointAnimation = (KeyframeAnimation <PointF>)fill.StartPoint.CreateAnimation();
            _startPointAnimation.ValueChanged += OnValueChanged;
            layer.AddAnimation(_startPointAnimation);

            _endPointAnimation = (KeyframeAnimation <PointF>)fill.EndPoint.CreateAnimation();
            _endPointAnimation.ValueChanged += OnValueChanged;
            layer.AddAnimation(_endPointAnimation);
        }
예제 #37
0
 /// <summary>
 /// Creates a new instance of a Gradient Pattern using the specified colors and angle
 /// </summary>
 /// <param name="startColor">The start color</param>
 /// <param name="endColor">The end color</param>
 /// <param name="angle">The direction of the gradient, measured in degrees clockwise from the x-axis</param>
 /// <param name="style">Controls how the gradient is drawn</param>
 public PolygonSymbolizer(Color startColor, Color endColor, double angle, GradientType style)
 {
     _patterns = new CopyList<IPattern>();
     _patterns.Add(new GradientPattern(startColor, endColor, angle, style));
 }
예제 #38
0
 public static void SetGradient(this UIView view, GradientType type, IList <GradientStop> gradients, float angle)
 {
     view.SetGradient(type, gradients, angle, view.Bounds);
 }
예제 #39
0
 /// <summary>
 /// Creates a new instance of a Gradient Pattern using the specified colors and angle
 /// </summary>
 /// <param name="startColor">The start color</param>
 /// <param name="endColor">The end color</param>
 /// <param name="angle">The direction of the gradient</param>
 /// <param name="style">The type of gradient to use</param>
 /// <param name="outlineColor">The color to use for the border symbolizer</param>
 /// <param name="outlineWidth">The width of the line to use for the border symbolizer</param>
 public PolygonCategory(Color startColor, Color endColor, double angle, GradientType style, Color outlineColor, double outlineWidth)
 {
     Symbolizer          = new PolygonSymbolizer(startColor, endColor, angle, style, outlineColor, outlineWidth);
     SelectionSymbolizer = new PolygonSymbolizer(Color.LightCyan, Color.DarkCyan, angle, style, Color.DarkCyan, outlineWidth);
 }
예제 #40
0
 /// <summary>
 /// Creates a new instance of a Gradient Pattern using the specified colors and angle
 /// </summary>
 /// <param name="startColor">The start color</param>
 /// <param name="endColor">The end color</param>
 /// <param name="angle">The direction of the gradient, measured in degrees clockwise from the x-axis</param>
 /// <param name="style">The type of gradient to use</param>
 /// <param name="outlineColor">The color to use for the border symbolizer</param>
 /// <param name="outlineWidth">The width of the line to use for the border symbolizer</param>
 public PolygonSymbolizer(Color startColor, Color endColor, double angle, GradientType style, Color outlineColor, double outlineWidth)
 {
     _patterns = new CopyList <IPattern>();
     _patterns.Add(new GradientPattern(startColor, endColor, angle, style));
     OutlineSymbolizer = new LineSymbolizer(outlineColor, outlineWidth);
 }
예제 #41
0
 static extern bool gimp_edit_blend(Int32 drawable_ID,
     BlendMode blend_mode,
     LayerModeEffects paint_mode,
     GradientType gradient_type,
     double opacity,
     double offset,
     RepeatMode repeat,
     bool reverse,
     bool supersample,
     int max_depth,
     double threshold,
     bool dither,
     double x1,
     double y1,
     double x2,
     double y2);
예제 #42
0
 public Gradient(GradientType type, int Angle)
     : this(type)
 {
     this.Rotation = Angle;
 }
예제 #43
0
                public static void DrawTab(Graphics g, Rectangle r, Corners corner, GradientType gradient, Color darkColor, Color lightColor, Color edgeColor, bool closed)
                {
                    //dims
                    Point[] points;
                    GraphicsPath path;
                    Region Region;
                    LinearGradientBrush linearBrush;
                    Brush brush = null;
                    Pen pen;
                    r.Inflate(- 1, - 1);
                    //set brushes
                    switch (gradient)
                    {
                        case GradientType.Flat:
                            brush = new SolidBrush(darkColor);
                            break;
                        case GradientType.Linear:
                            brush = new LinearGradientBrush(r, darkColor, lightColor, LinearGradientMode.Vertical);
                            break;
                        case GradientType.Bell:
                            linearBrush = new LinearGradientBrush(r, darkColor, lightColor, LinearGradientMode.Vertical);
                            linearBrush.SetSigmaBellShape((float) (0.17F), (float) (0.67F));
                            brush = linearBrush;
                            break;
                    }
                    pen = new pen(edgeColor, 1);
                    //generic points
                    points = new Point[12] {new Point(r.Left, r.Bottom), new Point(r.Left, r.Bottom - bshift), new Point(r.Left, r.Top + bshift), new Point(r.Left, r.Top), new Point(r.Left + bshift, r.Top), new Point(r.Right - bshift, r.Top), new Point(r.Right, r.Top), new Point(r.Right, r.Top + bshift), new Point(r.Right, r.Bottom - bshift), new Point(r.Right, r.Bottom), new Point(r.Right - bshift, r.Bottom), new Point(r.Left + bshift, r.Bottom)};

                    path = new GraphicsPath();
                    switch (corner)
                    {
                        case Corners.LeftBottom:
                            path.AddLine(points[3], points[1]);
                            path.AddBezier(points[1], points[0], points[0], points[11]);
                            path.AddLine(points[11], points[9]);
                            path.AddLine(points[9], points[6]);
                            path.AddLine(points[6], points[3]);
                            Region = new Region(path);
                            g.FillRegion(brush, Region);
                            g.DrawLine(pen, points[3], points[1]);
                            g.DrawBezier(pen, points[1], points[0], points[0], points[11]);
                            g.DrawLine(pen, points[11], points[9]);
                            g.DrawLine(pen, points[9], points[6]);
                            if (closed)
                            {
                                g.DrawLine(pen, points[6], points[3]);
                            }
                            break;
                        case Corners.LeftTop:
                            path.AddLine(points[0], points[2]);
                            path.AddBezier(points[2], points[3], points[3], points[4]);
                            path.AddLine(points[4], points[6]);
                            path.AddLine(points[6], points[9]);
                            path.AddLine(points[9], points[0]);
                            Region = new Region(path);
                            g.FillRegion(brush, Region);
                            g.DrawLine(pen, points[0], points[2]);
                            g.DrawBezier(pen, points[2], points[3], points[3], points[4]);
                            g.DrawLine(pen, points[4], points[6]);
                            g.DrawLine(pen, points[6], points[9]);
                            if (closed)
                            {
                                g.DrawLine(pen, points[9], points[0]);
                            }
                            break;
                        case Corners.Bottom:

                            path.AddLine(points[1], points[3]);
                            path.AddBezier(points[1], points[0], points[0], points[11]);
                            path.AddLine(points[11], points[10]);
                            path.AddBezier(points[10], points[9], points[9], points[8]);
                            path.AddLine(points[8], points[6]);
                            path.AddLine(points[6], points[3]);
                            Region = new Region(path);
                            g.FillRegion(brush, Region);

                            g.DrawLine(pen, points[1], points[3]);
                            g.DrawBezier(pen, points[1], points[0], points[0], points[11]);
                            g.DrawLine(pen, points[11], points[10]);
                            g.DrawBezier(pen, points[10], points[9], points[9], points[8]);
                            g.DrawLine(pen, points[8], points[6]);

                            if (closed)
                            {
                                g.DrawLine(pen, points[6], points[3]);
                            }

                            break;

                        case Corners.Top:
                            path.AddLine(points[0], points[2]);
                            path.AddBezier(points[2], points[3], points[3], points[4]);
                            path.AddLine(points[4], points[5]);
                            path.AddBezier(points[5], points[6], points[6], points[7]);
                            path.AddLine(points[7], points[9]);
                            path.AddLine(points[9], points[0]);
                            Region = new Region(path);
                            g.FillRegion(brush, Region);

                            g.DrawLine(pen, points[0], points[2]);
                            g.DrawBezier(pen, points[2], points[3], points[3], points[4]);
                            g.DrawLine(pen, points[4], points[5]);
                            g.DrawBezier(pen, points[5], points[6], points[6], points[7]);
                            g.DrawLine(pen, points[7], points[9]);

                            if (closed)
                            {
                                g.DrawLine(pen, points[9], points[0]);
                            }

                            break;

                        case Corners.RightBottom:
                            path.AddLine(points[3], points[0]);
                            path.AddLine(points[0], points[10]);
                            path.AddBezier(points[10], points[9], points[9], points[8]);
                            path.AddLine(points[8], points[6]);
                            path.AddLine(points[6], points[3]);
                            Region = new Region(path);
                            g.FillRegion(brush, Region);
                            g.DrawLine(pen, points[3], points[0]);
                            g.DrawLine(pen, points[0], points[10]);
                            g.DrawBezier(pen, points[10], points[9], points[9], points[8]);
                            g.DrawLine(pen, points[8], points[6]);
                            if (closed)
                            {
                                g.DrawLine(pen, points[6], points[3]);
                            }
                            break;
                        case Corners.RightTop:
                            path.AddLine(points[0], points[3]);
                            path.AddLine(points[3], points[5]);
                            path.AddBezier(points[5], points[6], points[6], points[7]);
                            path.AddLine(points[7], points[9]);
                            path.AddLine(points[9], points[0]);
                            Region = new Region(path);
                            g.FillRegion(brush, Region);
                            g.DrawLine(pen, points[0], points[3]);
                            g.DrawLine(pen, points[3], points[5]);
                            g.DrawBezier(pen, points[5], points[6], points[6], points[7]);
                            g.DrawLine(pen, points[7], points[9]);
                            if (closed)
                            {
                                g.DrawLine(pen, points[9], points[0]);
                            }
                            break;
                    }
                }
예제 #44
0
 public GradientInfo(GradientType gradientType, bool alphaOnly)
 {
     this.gradientType = gradientType;
     this.alphaOnly = alphaOnly;
 }
예제 #45
0
 public Gradient(GradientType type, int offsetX, int offsetY)
     : this(type)
 {
     this.OffsetX = offsetX;
     this.OffsetY = offsetY;
 }
예제 #46
0
 /// <summary>
 /// Creates a new instance of a Gradient Pattern using the specified colors and angle
 /// </summary>
 /// <param name="startColor">The start color</param>
 /// <param name="endColor">The end color</param>
 /// <param name="angle">The direction of the gradient</param>
 /// <param name="style">The type of gradient to use</param>
 /// <param name="outlineColor">The color to use for the border symbolizer</param>
 /// <param name="outlineWidth">The width of the line to use for the border symbolizer</param>
 public PolygonCategory(Color startColor, Color endColor, double angle, GradientType style, Color outlineColor, double outlineWidth)
 {
     Symbolizer = new PolygonSymbolizer(startColor, endColor, angle, style, outlineColor, outlineWidth);
     SelectionSymbolizer = new PolygonSymbolizer(Color.LightCyan, Color.DarkCyan, angle, style, Color.DarkCyan, outlineWidth);
 }
예제 #47
0
        public void Load(RectangleShape shape, XmlNode element)
        {
            UnitsManager unitMng = new UnitsManager();
            XmlNode node;

            // Load shading definition
            node = element.SelectSingleNode("Shading");
            if (node != null)
            {
                this.gradientType = (GradientType)Convert.ToInt32(node.Attributes["Type"].Value);
            }

            // Load axial cords
            node = element.SelectSingleNode("AxialCoords");
            if (node != null)
            {
                float x = (float)Convert.ToDouble(node.Attributes["FromX"].Value);
                float y = (float)Convert.ToDouble(node.Attributes["FromY"].Value);
                this.Point1 = new PointF(x, y);

                x = (float)Convert.ToDouble(node.Attributes["ToX"].Value);
                y = (float)Convert.ToDouble(node.Attributes["ToY"].Value);
                this.Point2 = new PointF(x, y);
            }

            // Load function
            node = element.SelectSingleNode("Function");
            if (node != null)
            {
                this.functionType = Convert.ToInt32(node.Attributes["Type"]);
            }

            // Load color
            node = element.SelectSingleNode("Color");
            if (node != null)
            {
                int r = Convert.ToInt32(node.Attributes["FromR"].Value);
                int g = Convert.ToInt32(node.Attributes["FromG"].Value);
                int b = Convert.ToInt32(node.Attributes["FromB"].Value);
                this.Color1 = Color.FromArgb(r, g, b);

                r = Convert.ToInt32(node.Attributes["ToR"].Value);
                g = Convert.ToInt32(node.Attributes["ToG"].Value);
                b = Convert.ToInt32(node.Attributes["ToB"].Value);
                this.Color2 = Color.FromArgb(r, g, b);
            }

            //Load gradient definition
            node = element.SelectSingleNode("GradientDefinition");
            if(node != null)
            {
                this.Angle = (float)Convert.ToDouble(node.Attributes["Angle"].Value);
                this.BlendPosition1 = (float)Convert.ToDouble(node.Attributes["BlendPosition1"].Value);
                this.BlendPosition2 = (float)Convert.ToDouble(node.Attributes["BlendPosition2"].Value);
            }
        }
예제 #48
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GradientBackground"/> class.
 /// </summary>
 /// <param name="borderColor">The gradient border color.</param>
 /// <param name="gradientStartColor">The gradient start color.</param>
 /// <param name="gradientEndColor">The gradient end color.</param>
 /// <param name="roundCornerRadius">The gradient round corner radius.</param>
 /// <param name="borderWidth">The gradient border width.</param>
 /// <param name="type">The gradient type.</param>
 /// <param name="innerBorderColor">The gradient inner border color.</param>
 /// <param name="innerBorderWidth">The gradient inner border width.</param>
 public GradientBackground(Color borderColor, Color gradientStartColor, Color gradientEndColor,
     int roundCornerRadius, int borderWidth, GradientType type, Color innerBorderColor, int innerBorderWidth)
 {
     this.borderColor = borderColor;
     this.gradientStartColor = gradientStartColor;
     this.gradientEndColor = gradientEndColor;
     this.roundCornerRadius = roundCornerRadius;
     this.borderWidth = borderWidth;
     this.type = type;
     this.innerBorderColor = innerBorderColor;
     this.innerBorderWidth = innerBorderWidth;
 }
예제 #49
0
 public void EditBlend(BlendMode blend_mode,
     LayerModeEffects paint_mode,
     GradientType gradient_type,
     double opacity,
     double offset,
     RepeatMode repeat,
     bool reverse,
     bool supersample,
     int max_depth,
     double threshold,
     bool dither,
     double x1,
     double y1,
     double x2,
     double y2)
 {
     if (!gimp_edit_blend(ID, blend_mode, paint_mode, gradient_type,
        opacity, offset, repeat, reverse, supersample,
        max_depth, threshold, dither, x1, y1, x2, y2))
     {
       throw new GimpSharpException();
     }
 }
예제 #50
0
 /// <summary>
 /// Creates a new instance of a Gradient Pattern using the specified colors and angle
 /// </summary>
 /// <param name="startColor">The start color</param>
 /// <param name="endColor">The end color</param>
 /// <param name="angle">The direction of the gradient, measured in degrees clockwise from the x-axis</param>
 /// <param name="style">The type of gradient to use</param>
 /// <param name="outlineColor">The color to use for the border symbolizer</param>
 /// <param name="outlineWidth">The width of the line to use for the border symbolizer</param>
 public PolygonSymbolizer(Color startColor, Color endColor, double angle, GradientType style, Color outlineColor, double outlineWidth)
 {
     _patterns = new CopyList<IPattern>();
     _patterns.Add(new GradientPattern(startColor, endColor, angle, style));
     OutlineSymbolizer = new LineSymbolizer(outlineColor, outlineWidth);
 }