Examples of Gradient


Examples of flash.swf.types.Gradient

    protected FillStyle createFillStyle(LinearGradientFillNode node, Rect bounds)
    {
        FillStyle fs = new FillStyle();
        fs.type = FillStyle.FILL_LINEAR_GRADIENT;
        fs.matrix = TypeHelper.linearGradientMatrix(node, bounds);
        Gradient gradient = new Gradient();
        populateGradient(gradient, node.entries, node.interpolationMethod, node.spreadMethod);
        fs.gradient = gradient;

        return fs;
    }
View Full Code Here

Examples of flash.swf.types.Gradient

    protected FillStyle createFillStyle(LinearGradientStrokeNode node, Rect bounds)
    {
        FillStyle fs = new FillStyle();
        fs.type = FillStyle.FILL_LINEAR_GRADIENT;
        fs.matrix = TypeHelper.linearGradientMatrix(node, bounds);
        Gradient gradient = new Gradient();
        populateGradient(gradient, node.entries, node.interpolationMethod, node.spreadMethod);
        fs.gradient = gradient;

        return fs;
    }
View Full Code Here

Examples of flash.swf.types.Gradient

        return s;
    }

    private Gradient decodeGradient(int shape, int filltype) throws IOException
    {
        Gradient gradient = (filltype == FillStyle.FILL_FOCAL_RADIAL_GRADIENT)? new FocalGradient() : new Gradient();
        r.syncBits();
        gradient.spreadMode = r.readUBits( 2 );
        gradient.interpolationMode = r.readUBits( 2 );
        int count = r.readUBits( 4 );
        gradient.records = new GradRecord[count];
View Full Code Here

Examples of flash.swf.types.Gradient

        return matrix;
    }

    private Gradient parseGradient(String s, boolean hasAlpha)
    {
        Gradient gradient = new Gradient(); // todo - support focal

        // todo add error checking
        //    count must be 1..8
        //    number of parts must be even
        //    ratio must be 0..255
View Full Code Here

Examples of flash.swf.types.Gradient

        fs = new FillStyle();
        fs.matrix = MatrixBuilder.build(gt);

        fs.type = FillStyle.FILL_LINEAR_GRADIENT;

                fs.gradient = new Gradient();
                fs.gradient.records = new GradRecord[2];
        fs.gradient.records[0] = new GradRecord(0, SwfUtils.colorToInt(gp.getColor1())); //from left
        fs.gradient.records[1] = new GradRecord(255,  SwfUtils.colorToInt(gp.getColor2())); //to right
      }
      else if (paint instanceof LinearGradientPaint)
      {
        LinearGradientPaint lgp = (LinearGradientPaint)paint;
                Point2D start = lgp.getStartPoint();
        Point2D end = lgp.getEndPoint();

        AffineTransform gt = objectBoundingBoxTransform(start, end, width, height, width, height);

        fs = new FillStyle();
        fs.matrix = MatrixBuilder.build(gt);

        Color[] colors = lgp.getColors();
        float[] ratios = lgp.getFractions();

        if (colors.length == 0 || colors.length != ratios.length) //Invalid fill so we skip
        {
          return null;
        }
        else if (colors.length == 1) //Solid fill
        {
          return new FillStyle(SwfUtils.colorToInt(colors[0]));
        }
        else
        {
          fs.type = FillStyle.FILL_LINEAR_GRADIENT;

          //Maximum of 8 gradient control points records
          int len = ratios.length;
          if (len > 8)
            len = 8;
                    fs.gradient = new Gradient();
                    fs.gradient.records = new GradRecord[len];

          for (int i = 0; i < len; i++)
          {
            fs.gradient.records[i] = new GradRecord((int)Math.rint(255 * ratios[i]), SwfUtils.colorToInt(colors[i]));
          }

        }
      }
      else if (paint instanceof RadialGradientPaint)
      {
        RadialGradientPaint rgp = (RadialGradientPaint)paint;

        //Note: Flash doesn't support the focal point of a radial gradient
        //Point2D cp = rgp.getCenterPoint();
        //Point2D fp = rgp.getFocusPoint();
        double diameter = rgp.getRadius() * 2.0;
        double outerX = diameter * rgp.getTransform().getScaleX();
        double outerY = diameter * rgp.getTransform().getScaleY();

        AffineTransform gt = objectBoundingBoxTransform(null, null, width, height, outerX, outerY);
        fs = new FillStyle();
        fs.matrix = MatrixBuilder.build(gt);

        fs.type = FillStyle.FILL_RADIAL_GRADIENT;

        Color[] colors = rgp.getColors();
        float[] ratios = rgp.getFractions();

                fs.gradient = new Gradient();
                fs.gradient.records = new GradRecord[ratios.length <= 8 ? ratios.length : 8];
        for (int i = 0; i < ratios.length && i < 8; i++)
        {
          fs.gradient.records[i] = new GradRecord((int)Math.rint(255 * ratios[i]), SwfUtils.colorToInt(colors[i]));
        }
View Full Code Here

Examples of gwt.g2d.client.graphics.Gradient

    Surface originalCanvas = new Surface(300, 300);
    Circle smallCircle = new Circle(150, 150, 140);
    Circle bigCircle = new Circle(150, 150, 150);
    Shape smallCircleShape = new ShapeBuilder().drawCircle(smallCircle).build();
    Shape bigCircleShape = new ShapeBuilder().drawCircle(bigCircle).build();
    Gradient radialGradient = new RadialGradient(new Circle(150, 150, 0), smallCircle)
        .addColorStop(0, KnownColor.RED)
        .addColorStop(1, KnownColor.GREEN);
    originalCanvas.setFillStyle(KnownColor.BLACK)
        .fillShape(bigCircleShape)
        .setFillStyle(radialGradient)
View Full Code Here

Examples of gwt.g2d.client.graphics.Gradient

    surface.fillRectangle(0, 0, size, size)
        .setTransform(matrix.mutableTranslate(size / 2, size / 2))
        .clipShape(new CircleShape(0, 0, size / 2.0 * .8));

    Gradient gradient = new LinearGradient(0, -size / 2, 0, size / 2)
        .addColorStop(0, new Color(35, 34, 86))
        .addColorStop(1, new Color(20, 55, 120));
   
    surface.setFillStyle(gradient)
        .fillRectangle(-size / 2, -size / 2, size, size);
View Full Code Here

Examples of micdoodle8.mods.galacticraft.core.perlin.generator.Gradient

        this.asteroidDensity = new Billowed(this.rand.nextLong(), 2, .25F);
        this.asteroidDensity.setFrequency(.009F);
        this.asteroidDensity.amplitude = .6F;

        this.asteroidTurbulance = new Gradient(this.rand.nextLong(), 1, .2F);
        this.asteroidTurbulance.setFrequency(.08F);
        this.asteroidTurbulance.amplitude = .5F;

        this.asteroidSkewX = new Gradient(this.rand.nextLong(), 1, 1);
        this.asteroidSkewX.amplitude = ChunkProviderAsteroids.MAX_ASTEROID_SKEW;
        this.asteroidSkewX.frequencyX = 0.005F;

        this.asteroidSkewY = new Gradient(this.rand.nextLong(), 1, 1);
        this.asteroidSkewY.amplitude = ChunkProviderAsteroids.MAX_ASTEROID_SKEW;
        this.asteroidSkewY.frequencyY = 0.005F;

        this.asteroidSkewZ = new Gradient(this.rand.nextLong(), 1, 1);
        this.asteroidSkewZ.amplitude = ChunkProviderAsteroids.MAX_ASTEROID_SKEW;
        this.asteroidSkewZ.frequencyZ = 0.005F;

        this.coreHandler = new SpecialAsteroidBlockHandler();
        this.coreHandler.addBlock(new SpecialAsteroidBlock(this.ASTEROID_STONE, this.ASTEROID_STONE_META_2, 5, .3));
View Full Code Here

Examples of micdoodle8.mods.galacticraft.core.perlin.generator.Gradient

    public ChunkProviderMoon(World par1World, long par2, boolean par4)
    {
        super(par1World, par2, par4);
        this.worldObj = par1World;
        this.rand = new Random(par2);
        this.noiseGen1 = new Gradient(this.rand.nextLong(), 4, 0.25F);
        this.noiseGen2 = new Gradient(this.rand.nextLong(), 4, 0.25F);
        this.noiseGen3 = new Gradient(this.rand.nextLong(), 1, 0.25F);
        this.noiseGen4 = new Gradient(this.rand.nextLong(), 1, 0.25F);
    }
View Full Code Here

Examples of micdoodle8.mods.galacticraft.core.perlin.generator.Gradient

    {
        super(par1World, seed, mapFeaturesEnabled);
        this.worldObj = par1World;
        this.rand = new Random(seed);

        this.noiseGen1 = new Gradient(this.rand.nextLong(), 4, 0.25F);
        this.noiseGen2 = new Gradient(this.rand.nextLong(), 4, 0.25F);
        this.noiseGen3 = new Gradient(this.rand.nextLong(), 4, 0.25F);
        this.noiseGen4 = new Gradient(this.rand.nextLong(), 2, 0.25F);
        this.noiseGen5 = new Gradient(this.rand.nextLong(), 1, 0.25F);
        this.noiseGen6 = new Gradient(this.rand.nextLong(), 1, 0.25F);
        this.noiseGen7 = new Gradient(this.rand.nextLong(), 1, 0.25F);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.