Package org.apache.flex.swf.types

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


    protected Matrix readMatrix()
    {
        bitStream.byteAlign();

        final Matrix matrix = new Matrix();
        if (bitStream.readBit())
        {
            final int nScaleBits = bitStream.readUB(5);
            matrix.setScale(bitStream.readFB(nScaleBits),
                            bitStream.readFB(nScaleBits));
        }

        if (bitStream.readBit())
        {
            final int nRotateBits = bitStream.readUB(5);
            matrix.setRotate(bitStream.readFB(nRotateBits), bitStream.readFB(nRotateBits));
        }

        final int nTranslateBits = bitStream.readUB(5);
        matrix.setTranslate(bitStream.readSB(nTranslateBits), bitStream.readSB(nTranslateBits));

        bitStream.byteAlign();
        return matrix;
    }
View Full Code Here


                result.setEndColor(endColor);
                break;
            case FillStyle.LINEAR_GRADIENT_FILL:
            case FillStyle.RADIAL_GRADIENT_FILL:
            case FillStyle.FOCAL_RADIAL_GRADIENT_FILL:
                final Matrix startGradientMatrix = readMatrix();
                final Matrix endGradientMatrix = readMatrix();
                final MorphGradient gradient = readMorphGradient();
                result.setStartGradientMatrix(startGradientMatrix);
                result.setEndGradientMatrix(endGradientMatrix);
                result.setGradient(gradient);
                if (fillStyleType == FillStyle.FOCAL_RADIAL_GRADIENT_FILL &&
                    tagType.getValue() == TagType.DefineMorphShape2.getValue())
                {
                    result.setRatio1(bitStream.readSI16());
                    result.setRatio2(bitStream.readSI16());
                }
                break;
            case FillStyle.REPEATING_BITMAP_FILL:
            case FillStyle.CLIPPED_BITMAP_FILL:
            case FillStyle.NON_SMOOTHED_REPEATING_BITMAP:
            case FillStyle.NON_SMOOTHED_CLIPPED_BITMAP:
                final int bitmapId = bitStream.readUI16();
                final ICharacterTag bitmap = getTagById(bitmapId, tagType);
                final Matrix startBitmapMatrix = readMatrix();
                final Matrix endBitmapMatrix = readMatrix();
                result.setBitmap(bitmap);
                result.setStartBitmapMatrix(startBitmapMatrix);
                result.setEndBitmapMatrix(endBitmapMatrix);
                break;
            default:
View Full Code Here

    {
        assert tagType == TagType.DefineText || tagType == TagType.DefineText2;

        final int characterId = bitStream.readUI16();
        final Rect textBounds = readRect();
        final Matrix textMatrix = readMatrix();
        final int glyphBits = bitStream.readUI8();
        final int advanceBits = bitStream.readUI8();
        final ArrayList<TextRecord> textRecords = new ArrayList<TextRecord>();

        while (true)
View Full Code Here

        FXGMatrix newm = new FXGMatrix(a, b, c, d, tx, ty);
        if (!newm.invert())
            throw new FXGException("MatrixNotInvertible");
        */
       
        Matrix sm = new Matrix();
        if (b != 0 || c != 0)
            sm.setRotate(b, c);       
        if (a != 0 || d != 0)
            sm.setScale(a, d);
       
        sm.setTranslate((int)(tx*ISWFConstants.TWIPS_PER_PIXEL), (int)(ty*ISWFConstants.TWIPS_PER_PIXEL));
       
        return sm;       
    }
View Full Code Here

        if (Double.isNaN(height))
            height = image.getHeight();

        // Create Fill Style
        Matrix matrix = new Matrix();
        double twx = (ISWFConstants.TWIPS_PER_PIXEL);
        matrix.setScale(twx, twx);
       
        FillStyle fs = null;
        if (fileVersion.equalTo(FXGVersion.v1_0))
        {
          if (repeat)
            fs = new FillStyle(FillStyle.REPEATING_BITMAP_FILL, matrix, image.getTag());
          else
            fs = new FillStyle(FillStyle.CLIPPED_BITMAP_FILL, matrix, image.getTag());
        }
        else
        {
          if (fillMode.equals(FillMode.REPEAT))
          {
            fs = new FillStyle(FillStyle.REPEATING_BITMAP_FILL, matrix, image.getTag());
          }
          else if (fillMode.equals(FillMode.CLIP))
          {
            fs = new FillStyle(FillStyle.CLIPPED_BITMAP_FILL, matrix, image.getTag());
          }
          else if (fillMode.equals(FillMode.SCALE))
          {
            //override the scale for matrix
              double fwidth = (width*ISWFConstants.TWIPS_PER_PIXEL)/(double)image.getWidth();
              double fheight = (height*ISWFConstants.TWIPS_PER_PIXEL)/(double)image.getHeight();
               
              //For consistency with the 4.5.1 snapshot of the flex compiler.
              fwidth = ((double)StrictMath.rint(0x10000 * fwidth))/((double)0x10000);
              fheight = ((double)StrictMath.rint(0x10000 * fheight))/((double)0x10000);
             
              matrix.setScale(fwidth, fheight);
           
            //fill style does not matter much since the entire area is filled with bitmap
            fs = new FillStyle(FillStyle.CLIPPED_BITMAP_FILL, matrix, image.getTag());
          }
        }
View Full Code Here

        FillStyleArray fillStyleArray = new FillStyleArray(9);
        LineStyleArray lineStyleArray = new LineStyleArray();
        List<ShapeRecord> shapeRecords = new ArrayList<ShapeRecord>(50);

        // Apply runtime scale of 20x for twips
        Matrix matrix = new Matrix();
       
        double twx = (ISWFConstants.TWIPS_PER_PIXEL);
        matrix.setScale(twx, twx);
       
        // Create 9 identical fillstyles as a work around
        for (int i = 0; i < 9; i++)
        {
            FillStyle fs = new FillStyle(FillStyle.NON_SMOOTHED_REPEATING_BITMAP, matrix, bitmap.getTag());
View Full Code Here

    private DefineSpriteTag buildSprite(DefineBitsTag image, DefineShapeTag shape, DefineScalingGridTag scalingGrid, Collection<ITag> tags)
    {
        tags.add(image);

        Matrix tm = new Matrix();
        tm.setScale(1, 1);

        PlaceObject2Tag po = new PlaceObject2Tag();
        po.setDepth(10);
        po.setCharacter(shape);
        po.setHasCharacter(true);
View Full Code Here

        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)
View Full Code Here

        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);
View Full Code Here

            po3.setSurfaceFilterList(filters.toArray(filterArray));
            po3.setHasFilterList(true);
        }

        // FXG angles are always clockwise.
        Matrix matrix = context.getTransform().toSWFMatrix();
        po3.setMatrix(matrix);
        po3.setHasMatrix(true);
        if (context.colorTransform != null)
        {
            ColorTransformNode t = context.colorTransform;
View Full Code Here

TOP

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

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.