Example #1
0
        ShapeFill ComposeFills(ShapeFill a, ShapeFill b)
        {
            if (a is null)
            {
                return(b);
            }
            else if (b is null)
            {
                return(a);
            }

            if (a.FillKind != b.FillKind)
            {
                Translation.Issues.MultipleFillsIsNotSupported();
                return(b);
            }

            switch (a.FillKind)
            {
            case ShapeFill.ShapeFillKind.SolidColor:
                return(ComposeSolidColorFills((SolidColorFill)a, (SolidColorFill)b));
            }

            Translation.Issues.MultipleFillsIsNotSupported();
            return(b);
        }
Example #2
0
        internal FillContent(LottieDrawable lottieDrawable, BaseLayer layer, ShapeFill fill)
        {
            _layer          = layer;
            Name            = fill.Name;
            _lottieDrawable = lottieDrawable;
            if (fill.Color == null || fill.Opacity == null)
            {
                _colorAnimation   = null;
                _opacityAnimation = null;
                return;
            }

            _path.FillType = fill.FillType;

            _colorAnimation = fill.Color.CreateAnimation();
            _colorAnimation.ValueChanged += (sender, args) =>
            {
                _lottieDrawable.InvalidateSelf();
            };
            layer.AddAnimation(_colorAnimation);
            _opacityAnimation = fill.Opacity.CreateAnimation();
            _opacityAnimation.ValueChanged += (sender, args) =>
            {
                _lottieDrawable.InvalidateSelf();
            };
            layer.AddAnimation(_opacityAnimation);
        }
Example #3
0
 public Card(CardShape _shape, ShapeCount _shapeCount, ShapeColor _shapeColor, ShapeFill _shapeFill)
 {
     Shape      = _shape;
     ShapeCount = _shapeCount;
     ShapeColor = _shapeColor;
     ShapeFill  = _shapeFill;
     IsClicked  = false;
 }
Example #4
0
        public void AutoShapeFill_ReturnsNull_WhenAutoShapeIsNotFilled()
        {
            // Arrange
            IAutoShape autoShape = (IAutoShape)_fixture.Pre009.Slides[1].Shapes.First(sp => sp.Id == 6);

            // Act
            ShapeFill shapeFill = autoShape.Fill;

            // Assert
            shapeFill.Should().BeNull();
        }
Example #5
0
        public ShapeFillfrm(ShapeFill _shapefill)
        {
            //m_shapefill = _shapefill;
            tempshapefill = new ShapeFill(_shapefill);
            //tempshapefill = _shapefill;
            InitializeComponent();

            int i = 0;

            foreach (FillGradientType val in Enum.GetValues(typeof(FillGradientType)))
            {
                i++;
            }

            int j = i / 3;

            if (i % 3 != 0)
            {
                j++;
            }
            styleList1.Height = 6 + (4 + 49) * j;

            colorComboStartColor.Title     = "Start Color";
            colorComboStartColor.FillColor = tempshapefill.FillColor11;

            colorComboEndColor.Title     = "End Color";
            colorComboEndColor.FillColor = tempshapefill.FillColor21;

            if (tempshapefill.FillType == FillTypePatern.Transparent)
            {
                radioButtonNoFill.Checked   = true;
                radioButtonSolid.Checked    = false;
                radioButtonGradient.Checked = false;
            }
            if (tempshapefill.FillType == FillTypePatern.Solid)
            {
                radioButtonNoFill.Checked   = false;
                radioButtonSolid.Checked    = true;
                radioButtonGradient.Checked = false;
            }
            if (tempshapefill.FillType == FillTypePatern.Gradient)
            {
                radioButtonNoFill.Checked   = false;
                radioButtonSolid.Checked    = false;
                radioButtonGradient.Checked = true;;
            }
            checkBoxBlinking.Checked = tempshapefill.Blinking;

            this.colorComboStartColor.ColorChanged += new EventHandler(colorComboStartColor_ColorChanged);
            this.colorComboEndColor.ColorChanged   += new EventHandler(colorComboEndColor_ColorChanged);
        }
Example #6
0
        // Overrides the ConvertTo method of TypeConverter.
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            ShapeFill v = value as ShapeFill;

            //foreach (AlarmObject alarmobject in v)
            //{
            //    str += alarmobject.StatusTxt;
            //    str += ",";
            //}
            if (destinationType == typeof(string))
            {
                return(v.FillColor);
            }
            return(base.ConvertTo(context, culture, value, destinationType));
        }
Example #7
0
    static public void DrawFill(ShapeFill shape)
    {
        Vector2  pointInWorld;
        Vector2D pointInWorld2D = Vector2D.Zero();

        foreach (Vector2D point in shape.pointsIn)
        {
            pointInWorld = shape.transform.TransformPoint(point.ToVector2());

            pointInWorld2D.x = pointInWorld.x;
            pointInWorld2D.y = pointInWorld.y;

            if (ShapeObject.PointInShapes(pointInWorld2D) == false)
            {
                ShapeDraw.Draw(pointInWorld, shape.transform);
            }
        }
    }
Example #8
0
        YamlObject FromShapeFill(ShapeFill content, YamlMap superclassContent)
        {
            superclassContent.Add(nameof(content.Opacity), FromAnimatable(content.Opacity));
            superclassContent.Add(nameof(content.FillType), Scalar(content.FillType));
            switch (content.FillKind)
            {
            case ShapeFill.ShapeFillKind.SolidColor:
                return(FromSolidColorFill((SolidColorFill)content, superclassContent));

            case ShapeFill.ShapeFillKind.LinearGradient:
                return(FromLinearGradientFill((LinearGradientFill)content, superclassContent));

            case ShapeFill.ShapeFillKind.RadialGradient:
                return(FromRadialGradientFill((RadialGradientFill)content, superclassContent));

            default:
                throw Unreachable;
            }
        }
Example #9
0
    public ShapeFillResult(ShapeFill shapeFill)
    {
        allPoints = shapeFill.pointsIn.Count;

        pointsIn = 0;

        Vector2  pointInWorld;
        Vector2D pointInWorld2D = Vector2D.Zero();

        foreach (Vector2D point in shapeFill.pointsIn)
        {
            pointInWorld = shapeFill.transform.TransformPoint(point.ToVector2());

            pointInWorld2D.x = pointInWorld.x;
            pointInWorld2D.y = pointInWorld.y;

            if (ShapeObject.PointInShapes(pointInWorld2D) == false)
            {
                pointsIn++;
            }
        }

        percentage = (float)pointsIn / allPoints;
    }
Example #10
0
 override public String ToString()
 {
     return("Card(" + Shape.ToString() + ", " + ShapeCount.ToString() + ", " + ShapeColor.ToString() + ", " + ShapeFill.ToString() + ")");
 }