Examples of ShapeWithStyle


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

        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

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

        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

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

            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

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

            po3clip.setClipDepth(po3clip.getDepth() + 1);
            po3clip.setHasClipDepth(true);
           
            Styles styles = new Styles(new FillStyleArray(), new LineStyleArray());
            // Then, process the bitmap image fill
            ShapeWithStyle sws = new ShapeWithStyle(styles);
           
            int lineStyleIndex = 0;
            int fillStyle0Index = 1;
            int fillStyle1Index = 0;

            FillStyle fillStyle = createFillStyle(fill, edgeBounds);
            if(fillStyle != null)
                sws.getFillStyles().add(fillStyle);

            if (windings.length > 0)
                ShapeHelper.setPathStyles(shapeRecords, lineStyleIndex, fillStyle0Index, fillStyle1Index, styles);
            else
                ShapeHelper.setStyles(shapeRecords, lineStyleIndex, fillStyle0Index, fillStyle1Index, styles);
           
            sws.addShapeRecords(shapeRecords);
           
            DefineShape4Tag imageShape = new DefineShape4Tag();
            imageShape.setShapes(sws);
            imageShape.setShapeBounds(edgeBounds);
            imageShape.setEdgeBounds(edgeBounds);
            if ((fill != null) &&( windings.length > 0))
            {
                Winding windingValue = windings[0];
                imageShape.setUsesFillWindingRule(windingValue == Winding.NON_ZERO);
            }
            PlaceObject3Tag po3 = PlaceObject3Tag(imageShape, context);       
            
            if (stroke != null)
            {
                //make a copy of ShapeRecord for strokes
                ArrayList<ShapeRecord> shapeRecords2 = new ArrayList<ShapeRecord>(shapeRecords);
                Collections.copy(shapeRecords2, shapeRecords);

                Styles strokeStyles = new Styles(new FillStyleArray(), new LineStyleArray());

                //generate the define sprite for the stroke object with no clipping
                ShapeWithStyle swsStroke = new ShapeWithStyle(strokeStyles);

                // Consider linestyle stroke widths with bounds calculation              
                AbstractStrokeNode strokeNode = (AbstractStrokeNode) stroke;
                LineStyle ls = createGenericLineStyle(strokeNode);
                Rect shapeBounds =  node.getBounds(shapeRecords2, ls);    
               
                LineStyle lineStyle = createLineStyle(stroke, shapeBounds);
                swsStroke.getLineStyles().add(lineStyle);
               
                lineStyleIndex = 1;
                fillStyle0Index = 0;
                fillStyle1Index = 0;
                ShapeHelper.replaceStyles(shapeRecords2, lineStyleIndex, fillStyle0Index, fillStyle1Index, strokeStyles);
        
                swsStroke.addShapeRecords(shapeRecords2);

                DefineShape4Tag strokeShape = new DefineShape4Tag();
                strokeShape.setShapes(swsStroke);
                strokeShape.setShapeBounds(shapeBounds);
                strokeShape.setEdgeBounds(edgeBounds);
View Full Code Here

Examples of tv.porst.swfretools.parser.structures.ShapeWithStyle

   */
  public static DefineShape2Tag parse(final RecordHeader header, final SWFBinaryParser parser) throws SWFParserException {

    final UINT16 shapeId = parseUINT16(parser, 0x00006, "DefineShape2::ShapeID");
    final Rect shapeBounds = RectParser.parse(parser, "DefineShape2::ShapeBounds");
    final ShapeWithStyle shapes = ShapeWithStyleParser.parse(parser, "DefineShape2::Shapes");

    return new DefineShape2Tag(header, shapeId, shapeBounds, shapes);
  }
View Full Code Here

Examples of tv.porst.swfretools.parser.structures.ShapeWithStyle

   */
  public static DefineShapeTag parse(final RecordHeader header, final SWFBinaryParser parser) throws SWFParserException {

    final UINT16 shapeId = parseUINT16(parser, 0x00006, "DefineShape::ShapeID");
    final Rect shapeBounds = RectParser.parse(parser, "DefineShape::ShapeBounds");
    final ShapeWithStyle shapes = ShapeWithStyleParser.parse(parser, "DefineShape::Shapes");

    return new DefineShapeTag(header, shapeId, shapeBounds, shapes);
  }
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.