Examples of StyleChangeRecord


Examples of flash.swf.types.StyleChangeRecord

                boolean stateMoveTo = r.readBit();

                if (stateNewStyles || stateLineStyle || stateFillStyle1 ||
                        stateFillStyle0 || stateMoveTo)
                {
                    StyleChangeRecord s = decodeStyleChangeRecord(stateNewStyles, stateLineStyle,
                                                                  stateFillStyle1, stateFillStyle0, stateMoveTo,
                                                                  shape, numFillBits, numLineBits);

                    list.add(s);
                }
View Full Code Here

Examples of flash.swf.types.StyleChangeRecord

                                                      boolean stateMoveTo,
                                                      int shape,
                                                      int[] numFillBits,
                                                      int[] numLineBits) throws IOException
    {
        StyleChangeRecord s = new StyleChangeRecord();

        s.stateNewStyles = stateNewStyles;
        s.stateLineStyle = stateLineStyle;
        s.stateFillStyle1 = stateFillStyle1;
        s.stateFillStyle0 = stateFillStyle0;
View Full Code Here

Examples of flash.swf.types.StyleChangeRecord

    {
    }

    public void styleChange(Attributes attributes) throws SAXParseException
    {
        StyleChangeRecord styleChange = new StyleChangeRecord();
        if (hasAttribute(attributes, "dx") || hasAttribute(attributes, "dy"))
        {
            styleChange.stateMoveTo = true;
            styleChange.moveDeltaX = parseInt(getAttribute(attributes, "dx"));
            styleChange.moveDeltaY = parseInt(getAttribute(attributes, "dy"));
View Full Code Here

Examples of flash.swf.types.StyleChangeRecord

        stack.push(styleChange);
    }

    public void styleChange()
    {
        StyleChangeRecord styleChange = (StyleChangeRecord)stack.pop();
        if (fillstyles.size() != 0)
        {
            styleChange.stateNewStyles = true;
        }
View Full Code Here

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

        for (ShapeRecord shape : shapes.getShapeRecords())
        {
            indent();
            if (shape instanceof StyleChangeRecord)
            {
                StyleChangeRecord styleChange = (StyleChangeRecord)shape;
                out.print("<styleChange ");
                if (styleChange.isStateMoveTo())
                {
                    out.print("dx=\"" + styleChange.getMoveDeltaX() + "\" dy=\"" +
                              styleChange.getMoveDeltaY() + "\" ");
                }
                if (styleChange.isStateFillStyle0())
                {
                    out.print("fillStyle0=\"" +
                              (styles.getFillStyles().indexOf(styleChange.getFillstyle0()) + 1) + "\" ");
                }
                if (styleChange.isStateFillStyle1())
                {
                    out.print("fillStyle1=\"" +
                              (styles.getFillStyles().indexOf(styleChange.getFillstyle1()) + 1) + "\" ");
                }
                if (styleChange.isStateLineStyle())
                {
                    out.print("lineStyle=\"" +
                              (styles.getFillStyles().indexOf(styleChange.getLinestyle()) + 1) + "\" ");
                }
                if (styleChange.isStateNewStyles())
                {
                    out.println(">");
                    indent++;
                    printFillStyles(styleChange.getStyles().getFillStyles());
                    printLineStyles(styleChange.getStyles().getLineStyles());
                    indent--;
                    indent();
                    out.println("</styleChange>");
                    styles = styleChange.getStyles();
                }
                else
                {
                    out.println("/>");
                }
View Full Code Here

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

        for (ShapeRecord shape : shapes.getShapeRecords())
        {
            indent();
            if (shape instanceof StyleChangeRecord)
            {
                StyleChangeRecord styleChange = (StyleChangeRecord)shape;

                // No longer print out number of bits in MoveDeltaX and
                // MoveDeltaY. The StyleChangeRecord record does not preserve
                // this information.
                out.print("SCR\t");
                if (styleChange.isStateMoveTo())
                {
                    out.print(styleChange.getMoveDeltaX() + "\t" + styleChange.getMoveDeltaY());

                    if (startX == 0 && startY == 0)
                    {
                        startX = styleChange.getMoveDeltaX();
                        startY = styleChange.getMoveDeltaY();
                    }

                    x = styleChange.getMoveDeltaX();
                    y = styleChange.getMoveDeltaY();

                    out.print("\t\t");
                }
            }
            else
View Full Code Here

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

                    stateLineStyle ||
                    stateFillStyle1 ||
                    stateFillStyle0 ||
                    stateMoveTo)
                {
                    final StyleChangeRecord styleChange = readStyleChangeRecord(
                            stateNewStyles,
                            stateLineStyle,
                            stateFillStyle1,
                            stateFillStyle0,
                            stateMoveTo,
View Full Code Here

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

            CurrentStyles currentStyles) throws IOException, MalformedTagException
    {
        assert tagType != null;
        assert currentStyles != null;

        final StyleChangeRecord styleChange = new StyleChangeRecord();

        // move draw point
        if (stateMoveTo)
        {
            final int moveBits = bitStream.readUB(5);
            final int moveDeltaX = bitStream.readSB(moveBits);
            final int moveDeltaY = bitStream.readSB(moveBits);
            styleChange.setMove(moveDeltaX, moveDeltaY);
        }

        // there shouldn't be any styles on a shape for fonts, as the
        // tag is a Shape, not ShapeWithStyle, but the fillStyle0 can be 1 because
        // of the following from the SWF spec:
        // "The first STYLECHANGERECORD of each SHAPE in the GlyphShapeTable does not use
        // the LineStyle and LineStyles fields. In addition, the first STYLECHANGERECORD of each
        // shape must have both fields StateFillStyle0 and FillStyle0 set to 1."
        boolean ignoreStyle = tagType == TagType.DefineFont ||
                              tagType == TagType.DefineFont2 ||
                              tagType == TagType.DefineFont3;

        // select a style
        final int indexFillStyle0 = stateFillStyle0 ? bitStream.readUB(currentStyles.numFillBits) : 0;
        final int indexFillStyle1 = stateFillStyle1 ? bitStream.readUB(currentStyles.numFillBits) : 0;
        final int indexLineStyle = stateLineStyle ? bitStream.readUB(currentStyles.numLineBits) : 0;
        final IFillStyle fillStyle0;
        if (indexFillStyle0 > 0 && !ignoreStyle)
            fillStyle0 = currentStyles.styles.getFillStyles().get(indexFillStyle0 - 1);
        else
            fillStyle0 = null;

        final IFillStyle fillStyle1;
        if (indexFillStyle1 > 0 && !ignoreStyle)
            fillStyle1 = currentStyles.styles.getFillStyles().get(indexFillStyle1 - 1);
        else
            fillStyle1 = null;

        final ILineStyle lineStyle;
        if (indexLineStyle > 0 && !ignoreStyle)
            lineStyle = currentStyles.styles.getLineStyles().get(indexLineStyle - 1);
        else
            lineStyle = null;

        styleChange.setDefinedStyles(fillStyle0, fillStyle1, lineStyle,
                stateFillStyle0, stateFillStyle1, stateLineStyle, currentStyles.styles);

        // "StateNewStyles" field is only used by DefineShape 2, 3 and 4 tags.
        final boolean isDefineShape234 = tagType == TagType.DefineShape2 ||
                                         tagType == TagType.DefineShape3 ||
                                         tagType == TagType.DefineShape4;

        // replace styles
        if (stateNewStyles && isDefineShape234)
        {
            // read from SWF
            final FillStyleArray fillStyles = readFillStyleArray(tagType);
            final LineStyleArray lineStyles = readLineStyleArray(tagType);
            bitStream.byteAlign();
            final int numFillBits = bitStream.readUB(4);
            final int numLineBits = bitStream.readUB(4);

            // update StyleChangeRecord
            final Styles newStyles = new Styles(fillStyles, lineStyles);
            styleChange.setNumFillBits(numFillBits);
            styleChange.setNumLineBits(numLineBits);
            styleChange.setNewStyles(newStyles);

            // update style context variable
            currentStyles.styles = newStyles;
            currentStyles.numFillBits = numFillBits;
            currentStyles.numLineBits = numLineBits;
View Full Code Here

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

        int dya = stt;
        int dyb = sbt - stt;
        int dyc = (int)(bitmap.getHeight() * ISWFConstants.TWIPS_PER_PIXEL) - sbt;

        // border
        StyleChangeRecord scr = new StyleChangeRecord();
        scr.setMove(0, dya);
        scr.setDefinedStyles(-1, 1, -1, styles);
        shapeRecords.add(scr);
       
        shapeRecords.add(new StraightEdgeRecord(0, -dya));
        shapeRecords.add(new StraightEdgeRecord(dxa, 0));
       
        scr = new StyleChangeRecord();
        scr.setDefinedStyles(-1, 2, -1, styles);
        shapeRecords.add(scr);
       
        shapeRecords.add(new StraightEdgeRecord(dxb, 0));
       
        scr = new StyleChangeRecord();
        scr.setDefinedStyles(-1, 3, -1, styles);
        shapeRecords.add(scr);
       
        shapeRecords.add(new StraightEdgeRecord(dxc, 0));
        shapeRecords.add(new StraightEdgeRecord(0, dya));
       
        scr = new StyleChangeRecord();
        scr.setDefinedStyles(-1, 6, -1, styles);
        shapeRecords.add(scr);
       
        shapeRecords.add(new StraightEdgeRecord(0, dyb));
       
        scr = new StyleChangeRecord();
        scr.setDefinedStyles(-1, 9, -1, styles);
        shapeRecords.add(scr);
       
        shapeRecords.add(new StraightEdgeRecord(0, dyc));
        shapeRecords.add(new StraightEdgeRecord(-dxc, 0));
       
        scr = new StyleChangeRecord();
        scr.setDefinedStyles(-1, 8, -1, styles);
        shapeRecords.add(scr);
       
        shapeRecords.add(new StraightEdgeRecord(-dxb, 0));
       
        scr = new StyleChangeRecord();
        scr.setDefinedStyles(-1, 7, -1, styles);
        shapeRecords.add(scr);
       
        shapeRecords.add(new StraightEdgeRecord(-dxa, 0));
        shapeRecords.add(new StraightEdgeRecord(0, -dyc));
       
        scr = new StyleChangeRecord();
        scr.setDefinedStyles(-1, 4, -1, styles);
        shapeRecords.add(scr);

        shapeRecords.add(new StraightEdgeRecord(0, -dyb));

        // down 1
       
        scr = new StyleChangeRecord();
        scr.setMove(dxa, 0);
        scr.setDefinedStyles(2, 1, -1, styles);
        shapeRecords.add(scr);
       
        shapeRecords.add(new StraightEdgeRecord(0, dya));
       
        scr = new StyleChangeRecord();
        scr.setDefinedStyles(5, 4, -1, styles);
        shapeRecords.add(scr);
       
        shapeRecords.add(new StraightEdgeRecord(0, dyb));
       
        scr = new StyleChangeRecord();
        scr.setDefinedStyles(8, 7, -1, styles);
        shapeRecords.add(scr);
       
        shapeRecords.add(new StraightEdgeRecord(0, dyc));

        // down 2
        scr = new StyleChangeRecord();
        scr.setMove(dxa + dxb, 0);
        scr.setDefinedStyles(3, 2, -1, styles);
        shapeRecords.add(scr);
       
        shapeRecords.add(new StraightEdgeRecord(0, dya));
       
        scr = new StyleChangeRecord();
        scr.setDefinedStyles(6, 5, -1, styles);
        shapeRecords.add(scr);
       
        shapeRecords.add(new StraightEdgeRecord(0, dyb));
       
        scr = new StyleChangeRecord();
        scr.setDefinedStyles(9, 8, -1, styles);
        shapeRecords.add(scr);
       
        shapeRecords.add(new StraightEdgeRecord(0, dyc));

        // right 1
        scr = new StyleChangeRecord();
        scr.setMove(0, dya);
        scr.setDefinedStyles(1, 4, -1, styles);
        shapeRecords.add(scr);
       
        shapeRecords.add(new StraightEdgeRecord(dxa, 0));
       
        scr = new StyleChangeRecord();
        scr.setDefinedStyles(2, 5, -1, styles);
        shapeRecords.add(scr);

        shapeRecords.add(new StraightEdgeRecord(dxb, 0));
       
        scr = new StyleChangeRecord();
        scr.setDefinedStyles(3, 6, -1, styles);
        shapeRecords.add(scr);

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

        // right 2       
        scr = new StyleChangeRecord();
        scr.setMove(0, dya + dyb);
        scr.setDefinedStyles(4, 7, -1, styles);
        shapeRecords.add(scr);
        shapeRecords.add(new StraightEdgeRecord(dxa, 0));

        scr = new StyleChangeRecord();
        scr.setDefinedStyles(5, 8, -1, styles);
        shapeRecords.add(scr);

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

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

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

        ShapeWithStyle sws = new ShapeWithStyle(styles);
View Full Code Here

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

     * @return list of ShapeRecords representing the rectangle.
     */
    public static List<ShapeRecord> implicitClosepath(double startX, double startY, double endX, double endY)
    {
        List<ShapeRecord> shapeRecords = new ArrayList<ShapeRecord>();
        StyleChangeRecord scr = move(startX, startY);
        scr.defaultStyles(false, false, true);
        shapeRecords.add(scr);
        shapeRecords.addAll(straightEdge(startX, startY, endX, endY));
        return shapeRecords;
    }
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.