Package org.apache.flex.compiler.internal.fxg.swf

Examples of org.apache.flex.compiler.internal.fxg.swf.DefineImage


    //
    // --------------------------------------------------------------------------

    protected DefineImage createDefineBitsTag(IFXGNode node, String source)
    {
        DefineImage imageTag = imageMap.get(source);
        if (imageTag == null)
        {
            try
            {               
                InputStream stream = resourceResolver.openStream(source);
View Full Code Here


                // Missing source attribute in <BitmapGraphic> or <BitmapFill>.
                problems.add(new FXGMissingAttributeProblem(node.getDocumentPath(), node.getStartLine(),
                        node.getStartColumn(), FXGConstants.FXG_SOURCE_ATTRIBUTE, node.getNodeName()));
                return null;
            }
            DefineImage defImage = createDefineBitsTag(fill, source);
            if(defImage == null)
                return null;

            //process the filters later to avoid masking
            List<IFilterNode> filters = null;
            if (context.filters != null)      
            {  
                filters = context.filters;
                context.filters = null;
                DefineSpriteTag filterSprite = createDefineSpriteTag("MaskFilter");
                spriteStack.push(filterSprite);
            }

            DefineSpriteTag imageSprite = createDefineSpriteTag("BitmapFill");
            spriteStack.push(imageSprite);
           
            // First, generate the clipping mask
            DefineSpriteTag clipSprite = createDefineSpriteTag("BitmapFill_Clip");
            spriteStack.push(clipSprite);
           
            List<ShapeRecord> clipRectRecords = ShapeHelper.rectangle(0.0, 0.0, defImage.getWidth(), defImage.getHeight());
            DefineShapeTag clipShape = createDefineShapeTag(null, clipRectRecords, new SolidColorFillNode(), null, context.getTransform());
            FXGMatrix bitmapMatrix = TypeHelper.bitmapFillMatrix(fillNode, defImage, edgeBounds);
            FXGMatrix clipMatrix = new FXGMatrix(bitmapMatrix.a, bitmapMatrix.b, bitmapMatrix.c, bitmapMatrix.d, 0, 0);
            clipMatrix.scale(1.0/ISWFConstants.TWIPS_PER_PIXEL, 1.0/ISWFConstants.TWIPS_PER_PIXEL);
            clipMatrix.translate(bitmapMatrix.tx, bitmapMatrix.ty);
View Full Code Here

            problems.add(new FXGMissingAttributeProblem(fill.getDocumentPath(), fill.getStartLine(),
                    fill.getStartColumn(), FXGConstants.FXG_SOURCE_ATTRIBUTE, fill.getNodeName()));
            return null;
        }

        DefineImage img = createDefineBitsTag(fill, sourceFormatted);
        if(img != null)
        {
            fs.setBitmapCharacter(img.getTag());
       
            fs.setBitmapMatrix(TypeHelper.bitmapFillMatrix(fill, img, bounds).toSWFMatrix());
        }
        return fs;
    }
View Full Code Here

            problems.add(new FXGMissingAttributeProblem(node.getDocumentPath(), node.getStartLine(),
                    node.getStartColumn(), FXGConstants.FXG_SOURCE_ATTRIBUTE, node.getNodeName()));
            return null;
       }
       
        DefineImage imageTag = createDefineBitsTag(node, source);
        if(imageTag == null)
            return null;
       
        if ((node.visible) && (!node.isPartofClipMask))
        {
      
            DefineShapeTag imageShape;
            ScalingGrid scalingGrid = context.scalingGrid;
            if (scalingGrid != null)
            {
                Rect grid = TypeHelper.rect(scalingGrid.scaleGridLeft, scalingGrid.scaleGridTop, scalingGrid.scaleGridRight, scalingGrid.scaleGridBottom);
                imageShape = ImageHelper.create9SlicedShape(imageTag, grid, Double.NaN, Double.NaN);
                PlaceObject3Tag po3 = PlaceObject3Tag(imageShape, context);
                return po3;
            }
            else
            {
              if (ImageHelper.bitmapImageNeedsClipping(imageTag, node))
              {
                PlaceObject3Tag p03 = bitmapWithClip(imageTag, node);
                return p03;
              }
              else
              {
                imageShape = ImageHelper.createShapeForImage(imageTag, node);
                PlaceObject3Tag po3 = PlaceObject3Tag(imageShape, context);
                return po3;
              }
            }           
        }
        else
        {
          if (!ImageHelper.bitmapImageNeedsClipping(imageTag, node))
          {          
               double width = (Double.isNaN(node.width)) ? imageTag.getWidth() : node.width;
                 double height = (Double.isNaN(node.height)) ? imageTag.getHeight() : node.height;
             List<ShapeRecord>  shapeRecords = ShapeHelper.rectangle(0.0, 0.0, width, height);       
               DefineShapeTag shape = createDefineShapeTag(null, shapeRecords, new SolidColorFillNode(), null, context.getTransform());
             PlaceObject3Tag po3 = PlaceObject3Tag(shape, context);
             return po3;
          }
          else
          {
                double width = ((imageTag.getWidth() < node.width) || Double.isNaN(node.width)) ? imageTag.getWidth() : node.width;
                double height = ((imageTag.getHeight() < node.height) || (Double.isNaN(node.height))) ? imageTag.getHeight() : node.height;
              List<ShapeRecord>  shapeRecords = ShapeHelper.rectangle(0.0, 0.0, width, height);       
                 DefineShapeTag shape = createDefineShapeTag(null, shapeRecords, new SolidColorFillNode(), null, context.getTransform());
              PlaceObject3Tag po3 = PlaceObject3Tag(shape, context);
              return po3;
          }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.internal.fxg.swf.DefineImage

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.