Package org.apache.flex.swf.types

Examples of org.apache.flex.swf.types.ShapeWithStyle


    private DefineShapeTag readDefineShape() throws IOException, MalformedTagException
    {
        final DefineShapeTag tag = new DefineShapeTag();
        tag.setCharacterID(bitStream.readUI16());
        tag.setShapeBounds(readRect());
        final ShapeWithStyle shapeWithStyle = readShapeWithStyle(TagType.DefineShape);
        tag.setShapes(shapeWithStyle);
        return tag;
    }
View Full Code Here


    private DefineShape2Tag readDefineShape2() throws IOException, MalformedTagException
    {
        final DefineShape2Tag tag = new DefineShape2Tag();
        tag.setCharacterID(bitStream.readUI16());
        tag.setShapeBounds(readRect());
        final ShapeWithStyle shapeWithStyle = readShapeWithStyle(TagType.DefineShape2);
        tag.setShapes(shapeWithStyle);
        return tag;
    }
View Full Code Here

    private DefineShape3Tag readDefineShape3() throws IOException, MalformedTagException
    {
        final DefineShape3Tag tag = new DefineShape3Tag();
        tag.setCharacterID(bitStream.readUI16());
        tag.setShapeBounds(readRect());
        final ShapeWithStyle shapeWithStyle = readShapeWithStyle(TagType.DefineShape3);
        tag.setShapes(shapeWithStyle);
        return tag;
    }
View Full Code Here

        bitStream.readUB(5); // skip reserved UB[5]
        tag.setUsesFillWindingRule(bitStream.readBit());
        tag.setUsesNonScalingStrokes(bitStream.readBit());
        tag.setUsesScalingStrokes(bitStream.readBit());
        // 8 bits. No need to align.
        final ShapeWithStyle shapeWithStyle = readShapeWithStyle(TagType.DefineShape4);
        tag.setShapes(shapeWithStyle);
        return tag;
    }
View Full Code Here

        currentStyles.styles = styles;
        currentStyles.numFillBits = numFillBits;
        currentStyles.numLineBits = numLineBits;

        // Create ShapeWithStyle tag.
        final ShapeWithStyle shapes = new ShapeWithStyle(styles);
        shapes.setNumFillBits(numFillBits);
        shapes.setNumLineBits(numLineBits);

        // Read ShapeRecords and passing in the style context.
        final List<ShapeRecord> shapeRecords = readShapeRecords(tagType, shapes, currentStyles);
        shapes.addShapeRecords(shapeRecords);
        return shapes;
    }
View Full Code Here

        styleArray.add(fs);
        LineStyleArray lineStyleArray = new LineStyleArray();
       
        Styles styles = new Styles(styleArray, lineStyleArray);

        ShapeWithStyle sws = new ShapeWithStyle(styles);
       
        // Build Raw SWF Shape
        List<ShapeRecord> shapeRecords = ShapeHelper.rectangle(width, height);
        ShapeHelper.setStyles(shapeRecords, 0, 1, 0, styles);
        sws.addShapeRecords(shapeRecords);
       

        // Wrap up into a SWF DefineShape Tag
        DefineShape4Tag defineShape = new DefineShape4Tag();
        defineShape.setShapeBounds(TypeHelper.rect(width, height));
View Full Code Here

        scr.setDefinedStyles(6, 9, -1, styles);
        shapeRecords.add(scr);

        shapeRecords.add(new StraightEdgeRecord(dxc, 0));

        ShapeWithStyle sws = new ShapeWithStyle(styles);
        sws.addShapeRecords(shapeRecords);
       
        DefineShape4Tag shape = new DefineShape4Tag();
        shape.setShapeBounds(TypeHelper.rect(width, height));
        shape.setEdgeBounds(shape.getShapeBounds());
        shape.setShapes(sws);
View Full Code Here

        shape.setEdgeBounds(bounds);

        FillStyleArray fillStyles = new FillStyleArray();
        LineStyleArray lineStyles = new LineStyleArray();
        Styles styles = new Styles(fillStyles, lineStyles);
        ShapeWithStyle shapeWithStyle = new ShapeWithStyle(styles);
        shape.setShapes(shapeWithStyle);

        // translate into source bitmap
        Matrix tsm = new Matrix();
        // unity in twips
        tsm.setScale(ISWFConstants.TWIPS_PER_PIXEL, ISWFConstants.TWIPS_PER_PIXEL);

        // 9 identical fillstyles to fool things
        // not sure why this is needed, and why we're indexing into
        // the into, as the values are identical.  Was ported over from hero.
        for (int i = 0; i < 9; ++i)
        {
            FillStyle fs = new FillStyle();
            fs.setBitmapCharacter(image);
            fs.setBitmapMatrix(tsm);
            fs.setFillStyleType(FillStyle.NON_SMOOTHED_REPEATING_BITMAP);
            fillStyles.add(fs);
        }

        int slt = r.xMin();
        int srt = r.xMax();
        int stt = r.yMin();
        int sbt = r.yMax();
        int dxa = slt;
        int dxb = srt - slt;
        int dxc = width - srt;

        int dya = stt;
        int dyb = sbt - stt;
        int dyc = height - sbt;

        StyleChangeRecord startStyle = new StyleChangeRecord();
        startStyle.setMove(0, dya);
        shapeWithStyle.addShapeRecord(startStyle);

        // border
        addEdgesWithFill(styles, shapeWithStyle, new int[][] { {0, -dya}, {dxa, 0}}, 0, 1);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{dxb, 0}}, 0, 2);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] { {dxc, 0}, {0, dya}}, 0, 3);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{0, dyb}}, 0, 6);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] { {0, dyc}, {-dxc, 0}}, 0, 9);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{-dxb, 0}}, 0, 8);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] { {-dxa, 0}, {0, -dyc}}, 0, 7);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{0, -dyb}}, 0, 4);

        // down 1
        StyleChangeRecord down1Style = new StyleChangeRecord();
        down1Style.setMove(dxa, 0);
        shapeWithStyle.addShapeRecord(down1Style);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{0, dya}}, 2, 1);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{0, dyb}}, 5, 4);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{0, dyc}}, 8, 7);

        // down 2
        StyleChangeRecord down2Style = new StyleChangeRecord();
        down2Style.setMove(dxa + dxb, 0);
        shapeWithStyle.addShapeRecord(down2Style);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{0, dya}}, 3, 2);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{0, dyb}}, 6, 5);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{0, dyc}}, 9, 8);

        // right 1
        StyleChangeRecord right1Style = new StyleChangeRecord();
        right1Style.setMove(0, dya);
        shapeWithStyle.addShapeRecord(right1Style);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{dxa, 0}}, 1, 4);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{dxb, 0}}, 2, 5);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{dxc, 0}}, 3, 6);

        // right 2
        StyleChangeRecord right2Style = new StyleChangeRecord();
        right2Style.setMove(0, dya + dyb);
        shapeWithStyle.addShapeRecord(right2Style);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{dxa, 0}}, 4, 7);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{dxb, 0}}, 5, 8);
        addEdgesWithFill(styles, shapeWithStyle, new int[][] {{dxc, 0}}, 6, 9);

        return shape;
View Full Code Here

        shape.setShapeBounds(bounds);

        final FillStyleArray fillStyles = new FillStyleArray();
        final LineStyleArray lineStyles = new LineStyleArray();
        Styles styles = new Styles(fillStyles, lineStyles);
        ShapeWithStyle shapeWithStyle = new ShapeWithStyle(styles);
        shape.setShapes(shapeWithStyle);

        // translate into source bitmap
        Matrix tsm = new Matrix();
        // unity in twips
        tsm.setScale(ISWFConstants.TWIPS_PER_PIXEL, ISWFConstants.TWIPS_PER_PIXEL);

        FillStyle fs = new FillStyle();
        fs.setBitmapCharacter(image);
        fs.setBitmapMatrix(tsm);
        fs.setFillStyleType(FillStyle.CLIPPED_BITMAP_FILL);
        fillStyles.add(fs);

        StyleChangeRecord startStyle = new StyleChangeRecord();
        // We use fillstyle1, because it matches what FlashAuthoring generates.
        startStyle.setDefinedStyles(null, fs, null, styles);
        startStyle.setMove(width, height);
        shapeWithStyle.addShapeRecord(startStyle);

        // border
        shapeWithStyle.addShapeRecord(new StraightEdgeRecord(-1 * width, 0));
        shapeWithStyle.addShapeRecord(new StraightEdgeRecord(0, -1 * height));
        shapeWithStyle.addShapeRecord(new StraightEdgeRecord(width, 0));
        shapeWithStyle.addShapeRecord(new StraightEdgeRecord(0, height));

        return shape;
    }
View Full Code Here

            ShapeHelper.setPathStyles(shapeRecords, lineStyleIndex, fillStyle0Index, fillStyle1Index, styles);
        else
            ShapeHelper.setStyles(shapeRecords, lineStyleIndex, fillStyle0Index, fillStyle1Index, styles);

       
        ShapeWithStyle sws = new ShapeWithStyle(styles);
        sws.addShapeRecords(shapeRecords);
       
        DefineShape4Tag DefineShapeTag4 = new DefineShape4Tag();
        DefineShapeTag4.setShapes(sws);
        DefineShapeTag4.setShapeBounds(shapeBounds);
        DefineShapeTag4.setEdgeBounds(edgeBounds);
View Full Code Here

TOP

Related Classes of org.apache.flex.swf.types.ShapeWithStyle

Copyright © 2018 www.massapicom. 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.