Esempio n. 1
0
        public virtual void NoStrategyProvidedTest()
        {
            AbstractLinearGradientBuilder gradientBuilder = new StrategyBasedLinearGradientBuilder().AddColorStop(new
                                                                                                                  GradientColorStop(ColorConstants.RED.GetColorValue(), 0d, GradientColorStop.OffsetType.RELATIVE)).AddColorStop
                                                                (new GradientColorStop(ColorConstants.GREEN.GetColorValue(), 0.5, GradientColorStop.OffsetType.RELATIVE
                                                                                       )).AddColorStop(new GradientColorStop(ColorConstants.BLUE.GetColorValue(), 1d, GradientColorStop.OffsetType
                                                                                                                             .RELATIVE));

            GenerateAndComparePdfs("noStrategyProvidedTest.pdf", null, gradientBuilder);
        }
Esempio n. 2
0
        public virtual void BuilderToBottomRightTest()
        {
            AbstractLinearGradientBuilder gradientBuilder = new StrategyBasedLinearGradientBuilder().SetGradientDirectionAsStrategy
                                                                (StrategyBasedLinearGradientBuilder.GradientStrategy.TO_BOTTOM_RIGHT).AddColorStop(new GradientColorStop
                                                                                                                                                       (ColorConstants.RED.GetColorValue(), 0d, GradientColorStop.OffsetType.RELATIVE)).AddColorStop(new GradientColorStop
                                                                                                                                                                                                                                                         (ColorConstants.GREEN.GetColorValue(), 0.5, GradientColorStop.OffsetType.RELATIVE)).AddColorStop(new GradientColorStop
                                                                                                                                                                                                                                                                                                                                                              (ColorConstants.BLUE.GetColorValue(), 1d, GradientColorStop.OffsetType.RELATIVE));

            GenerateAndComparePdfs("builderToBottomRightTest.pdf", null, gradientBuilder);
        }
Esempio n. 3
0
        public virtual void BuilderNegativeAngleTest()
        {
            AbstractLinearGradientBuilder gradientBuilder = new StrategyBasedLinearGradientBuilder().SetGradientDirectionAsCentralRotationAngle
                                                                (-Math.PI / 3).AddColorStop(new GradientColorStop(ColorConstants.RED.GetColorValue(), 0d, GradientColorStop.OffsetType
                                                                                                                  .RELATIVE)).AddColorStop(new GradientColorStop(ColorConstants.GREEN.GetColorValue(), 0.5, GradientColorStop.OffsetType
                                                                                                                                                                 .RELATIVE)).AddColorStop(new GradientColorStop(ColorConstants.BLUE.GetColorValue(), 1d, GradientColorStop.OffsetType
                                                                                                                                                                                                                .RELATIVE));

            GenerateAndComparePdfs("builderNegativeAngleTest.pdf", null, gradientBuilder);
        }
Esempio n. 4
0
        public virtual void BuilderWithToCornerAndInnerStopsAndPadSpreadingTest()
        {
            AbstractLinearGradientBuilder gradientBuilder = new StrategyBasedLinearGradientBuilder().SetGradientDirectionAsStrategy
                                                                (StrategyBasedLinearGradientBuilder.GradientStrategy.TO_TOP_RIGHT).SetSpreadMethod(GradientSpreadMethod
                                                                                                                                                   .PAD).AddColorStop(new GradientColorStop(ColorConstants.RED.GetColorValue(), 0.3d, GradientColorStop.OffsetType
                                                                                                                                                                                            .RELATIVE)).AddColorStop(new GradientColorStop(ColorConstants.GREEN.GetColorValue(), 0.4, GradientColorStop.OffsetType
                                                                                                                                                                                                                                           .RELATIVE)).AddColorStop(new GradientColorStop(ColorConstants.BLUE.GetColorValue(), 0.5d, GradientColorStop.OffsetType
                                                                                                                                                                                                                                                                                          .RELATIVE));

            GenerateAndComparePdfs("builderWithToCornerAndInnerStopsAndPadSpreadingTest.pdf", null, gradientBuilder);
        }
Esempio n. 5
0
        public virtual void BuilderWithNoneSpreadingAndCanvasTransformTest()
        {
            AbstractLinearGradientBuilder gradientBuilder = new StrategyBasedLinearGradientBuilder().SetGradientDirectionAsStrategy
                                                                (StrategyBasedLinearGradientBuilder.GradientStrategy.TO_RIGHT).SetSpreadMethod(GradientSpreadMethod.NONE
                                                                                                                                               ).AddColorStop(new GradientColorStop(ColorConstants.RED.GetColorValue(), 0d, GradientColorStop.OffsetType
                                                                                                                                                                                    .RELATIVE)).AddColorStop(new GradientColorStop(ColorConstants.GREEN.GetColorValue(), 0.5, GradientColorStop.OffsetType
                                                                                                                                                                                                                                   .RELATIVE)).AddColorStop(new GradientColorStop(ColorConstants.BLUE.GetColorValue(), 1d, GradientColorStop.OffsetType
                                                                                                                                                                                                                                                                                  .RELATIVE));
            AffineTransform canvasTransform = AffineTransform.GetTranslateInstance(50, -50);

            canvasTransform.Scale(0.8, 1.1);
            canvasTransform.Rotate(Math.PI / 3, 400f, 550f);
            GenerateAndComparePdfs("builderWithNoneSpreadingAndCanvasTransformTest.pdf", canvasTransform, gradientBuilder
                                   );
        }