Examples of FXGMatrix


Examples of org.apache.flex.compiler.internal.fxg.types.FXGMatrix

        GraphicContext graphicContext = new GraphicContext();

        if (parentGraphicContext != null)
            graphicContext.scalingGrid = parentGraphicContext.scalingGrid;

        FXGMatrix transform = graphicContext.getTransform();
        if (matrix != null)
        {
            FXGMatrix t = new FXGMatrix(matrix);
            transform.concat(t);
        }
        else
        {
View Full Code Here

Examples of org.apache.flex.compiler.internal.fxg.types.FXGMatrix

    {
        try
        {
            MatrixNode matrixNode = MatrixNode.class.newInstance();
            // Convert discreet transform attributes to FXGMatrix.
            FXGMatrix matrix = FXGMatrix.convertToMatrix(scaleX, scaleY, rotation, x, y);
            // Set matrix attributes to FXGMatrix values.
            matrix.setMatrixNodeValue(matrixNode);
            // Reset all discreet transform attributes since matrix
            // and discreet transform attributes cannot coexist.
            resetTransformAttr();
            // Add child matrix to the node.
            this.addChild(matrixNode, problems);
View Full Code Here

Examples of org.apache.flex.compiler.internal.fxg.types.FXGMatrix

    public ScalingGrid scalingGrid;

    public FXGMatrix getTransform()
    {
        if (transform == null)
            transform = new FXGMatrix();

        return transform;
    }
View Full Code Here

Examples of org.apache.flex.compiler.internal.fxg.types.FXGMatrix

        MatrixNode mtxNode = gradient.getMatrixNode();
        if (mtxNode != null)
        {
            double tx = mtxNode.tx;
            double ty = mtxNode.ty;
            FXGMatrix fxgMtx = new FXGMatrix(mtxNode.a, mtxNode.b, mtxNode.c, mtxNode.d, 0, 0);
            fxgMtx.scale(ISWFConstants.TWIPS_PER_PIXEL/(float)ISWFConstants.GRADIENT_SQUARE, ISWFConstants.TWIPS_PER_PIXEL/(float)ISWFConstants.GRADIENT_SQUARE);
            fxgMtx.translate(tx, ty);
            return fxgMtx.toSWFMatrix();
        }            
         
        double w = !Double.isNaN(gradient.getScaleX()) ? gradient.getScaleX()*ISWFConstants.TWIPS_PER_PIXEL : pathBounds.getWidth();
        double h = !Double.isNaN(gradient.getScaleY()) ? gradient.getScaleY()*ISWFConstants.TWIPS_PER_PIXEL: pathBounds.getHeight();
        double tx = (!Double.isNaN(gradient.getX()) ? gradient.getX() : (pathBounds.xMax() + pathBounds.xMin()) / (2.0*ISWFConstants.TWIPS_PER_PIXEL));
        double ty = (!Double.isNaN(gradient.getY()) ? gradient.getY() (pathBounds.yMax() + pathBounds.yMin()) / (2.0*ISWFConstants.TWIPS_PER_PIXEL));
           
        FXGMatrix matrix = new FXGMatrix();
        matrix.scale(w/ISWFConstants.GRADIENT_SQUARE, h/ISWFConstants.GRADIENT_SQUARE);
        if (!Double.isNaN(gradient.getRotation()) && (gradient.getRotation() != 0))
            matrix.rotate(gradient.getRotation());
        matrix.translate(tx, ty);
       
        return matrix.toSWFMatrix();
    }
View Full Code Here

Examples of org.apache.flex.compiler.internal.fxg.types.FXGMatrix

     * @return a SWF Matrix to apply for a linear gradient.
     */
    public static Matrix linearGradientMatrix(IScalableGradientNode gradient, Rect pathBounds)
    {
        FXGMatrix matrix = new FXGMatrix();

        //support for node matrix
        MatrixNode mtxNode = gradient.getMatrixNode();
        if (mtxNode != null)
        {
            matrix.translate(GRADIENT_DIMENSION/2.0, GRADIENT_DIMENSION/2.0);
            matrix.scale(1.0/GRADIENT_DIMENSION, 1.0/GRADIENT_DIMENSION);
            FXGMatrix nodeMatrix = new FXGMatrix(mtxNode);
            matrix.concat(nodeMatrix);
            return matrix.toSWFMatrix();
        }

        double width = (pathBounds.xMax() - pathBounds.xMin()) / (double)ISWFConstants.TWIPS_PER_PIXEL;
View Full Code Here

Examples of org.apache.flex.compiler.internal.fxg.types.FXGMatrix

        MatrixNode mtxNode = fill.matrix;
        if (mtxNode != null)
        {
            double tx = mtxNode.tx;
            double ty = mtxNode.ty;
            FXGMatrix fxgMtx = new FXGMatrix(mtxNode.a, mtxNode.b, mtxNode.c, mtxNode.d, 0, 0);
            fxgMtx.scale(ISWFConstants.TWIPS_PER_PIXEL, ISWFConstants.TWIPS_PER_PIXEL);
            fxgMtx.translate(tx, ty);
            return fxgMtx;
        }

        FXGMatrix matrix = new FXGMatrix();
        double tx;
        double ty;
        double scaleX;
        double scaleY;
        if ((fill.getFileVersion() != FXGVersion.v1_0) && (fill.fillMode.equals(FillMode.SCALE)))
        {
          tx = (Double.isNaN(fill.x)) ? pathBounds.xMin()/(double)ISWFConstants.TWIPS_PER_PIXEL : fill.x;
          ty = (Double.isNaN(fill.y)) ? pathBounds.yMin()/(double)ISWFConstants.TWIPS_PER_PIXEL : fill.y;
          scaleX = (Double.isNaN(fill.scaleX)) ? (pathBounds.getWidth()/(double) img.getWidth()) :
                              ISWFConstants.TWIPS_PER_PIXEL * fill.scaleX;
          scaleY = (Double.isNaN(fill.scaleY)) ? (pathBounds.getHeight()/(double) img.getHeight()) :
                              ISWFConstants.TWIPS_PER_PIXEL * fill.scaleY;
        }
        else
        {
          tx = (Double.isNaN(fill.x)) ? pathBounds.xMin()/(double)ISWFConstants.TWIPS_PER_PIXEL : fill.x;
          ty = (Double.isNaN(fill.y)) ? pathBounds.yMin()/(double)ISWFConstants.TWIPS_PER_PIXEL : fill.y;
          scaleX = (Double.isNaN(fill.scaleX)) ? ISWFConstants.TWIPS_PER_PIXEL : ISWFConstants.TWIPS_PER_PIXEL * fill.scaleX;
          scaleY = (Double.isNaN(fill.scaleY)) ? ISWFConstants.TWIPS_PER_PIXEL : ISWFConstants.TWIPS_PER_PIXEL * fill.scaleY;    
        }
      double angle = fill.rotation;
      while (angle < 0)
        angle += 360;
      angle %= 360;
        matrix.scale(scaleX, scaleY);
        matrix.rotate(angle);
        matrix.translate(tx, ty);

        return matrix;
       
    }
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.