Examples of PlaceObject


Examples of flash.swf.tags.PlaceObject

        DefineShape ds3 = ImageShapeBuilder.buildImage(defineBits, width, height);
        defineTags.defineShape3(ds3);
        applyBounds(ds3.bounds.xMin, ds3.bounds.yMin, ds3.bounds.xMax, ds3.bounds.yMax);

                PlaceObject po2 = new PlaceObject(ds3, depth++);
                po2.setMatrix(MatrixBuilder.build(graphicContext.getTransform()));
                po2.setName(name);

        defineTags.placeObject2(po2);
      }
      finally
      {
View Full Code Here

Examples of flash.swf.tags.PlaceObject

      taglist.defineBitsJPEG2(defineBits);

      DefineShape ds3 = ImageShapeBuilder.buildImage(defineBits, image.getWidth(), image.getHeight());
      taglist.defineShape3(ds3);

      PlaceObject po2 = new PlaceObject(ds3, 1);
      po2.setMatrix(new Matrix());
      // po2.setName(name);

      taglist.placeObject2(po2);
    }
    catch (IOException ex)
View Full Code Here

Examples of flash.swf.tags.PlaceObject

        DefineShape clipShape = createDefineShape(null, shapeRecords, new SolidColorFillNode(), null, context.getTransform());
        placeObject(clipShape, new GraphicContext());
        spriteStack.pop();
       
        //place the clipping mask in the imageSprite
        PlaceObject po3clip = placeObject(clipSprite, context);
        po3clip.setClipDepth(po3clip.depth+1);
       
        // Then, process the image
        DefineShape imageShape = ImageHelper.createShapeForImage(imageTag, node);
        placeObject(imageShape, context);       
        spriteStack.pop();
       
        PlaceObject po3 = placeObject(imageSprite, new GraphicContext());
       
        // If filters were not processed, place the topmost sprite in display list and apply filters
        // This is done to force processing of masks before filters
        if (filters != null)
        {
            DefineSprite sprite = spriteStack.pop();   
            GraphicContext gc = new GraphicContext();
            gc.filters = filters;
            PlaceObject poFilter = placeObject(sprite, gc);
            return poFilter;           
        }
        return po3;
    }
View Full Code Here

Examples of flash.swf.tags.PlaceObject

            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);
                PlaceObject po3 = placeObject(imageShape, context);
                return po3;
            }
            else
            {
              if (ImageHelper.bitmapImageNeedsClipping(imageTag, node))
              {
                PlaceObject p03 = bitmapWithClip(imageTag, node);
                return p03;
              }
              else
              {
                imageShape = ImageHelper.createShapeForImage(imageTag, node);
                PlaceObject po3 = placeObject(imageShape, context);
                return po3;
              }
            }           
        }
        else
        {
          if (!ImageHelper.bitmapImageNeedsClipping(imageTag, node))
          {          
               double width = (Double.isNaN(node.width)) ? imageTag.width : node.width;
                 double height = (Double.isNaN(node.height)) ? imageTag.height : node.height;
             List<ShapeRecord>  shapeRecords = ShapeHelper.rectangle(0.0, 0.0, width, height);       
               DefineShape shape = createDefineShape(null, shapeRecords, new SolidColorFillNode(), null, context.getTransform());
             PlaceObject po3 = placeObject(shape, context);
             return po3;
          }
          else
          {
                double width = ((imageTag.width < node.width) || Double.isNaN(node.width)) ? imageTag.width : node.width;
                double height = ((imageTag.height < node.height) || (Double.isNaN(node.height))) ? imageTag.height : node.height;
              List<ShapeRecord>  shapeRecords = ShapeHelper.rectangle(0.0, 0.0, width, height);       
                 DefineShape shape = createDefineShape(null, shapeRecords, new SolidColorFillNode(), null, context.getTransform());
              PlaceObject po3 = placeObject(shape, context);
              return po3;
          }
        }

    }
View Full Code Here

Examples of flash.swf.tags.PlaceObject

        }
    }

    protected PlaceObject graphicContentNode(GraphicContentNode node)
    {
        PlaceObject po3 = null;

      if (!node.visible)
        {
            ColorTransformNode ct = new ColorTransformNode();
            ct.alphaMultiplier = 0;
            ct.alphaOffset = 0;
            ct.blueMultiplier = 1;
            ct.blueOffset = 0;
            ct.greenMultiplier = 1;
            ct.greenOffset = 0;
            ct.redMultiplier = 1;
            ct.redOffset = 0;
            node.colorTransform = ct;
           
            if (node instanceof AbstractShapeNode)
            {
                AbstractShapeNode shapeNode = (AbstractShapeNode)node;
                shapeNode.fill = null;
                shapeNode.stroke = null;
            }
           
        }

        if (node instanceof GroupNode)
        {
            group((GroupNode)node);
        }
        else
        {
            if (node.blendMode == BlendMode.AUTO)
                node.blendMode = BlendMode.NORMAL;
           
            // For non-group nodes, we process mask to clip only this shape
            // node. Process the mask first to ensure the depth is correct.
            List<FilterNode> filters = null;
            if (node.mask != null)
            {
                // Remove the filters from context and process them later to force Flash Player to process the masks first
                if (node.filters != null)
                {  
                    filters = node.filters;
                    node.filters = null;
                    DefineSprite filterSprite = createDefineSprite("MaskFilter");
                    spriteStack.push(filterSprite);
                }
                DefineSprite parentSprite = spriteStack.peek();
                mask(node, parentSprite);
            }
           
            if (node instanceof EllipseNode)
                po3 = ellipse((EllipseNode)node);
            else if (node instanceof LineNode)
                po3 = line((LineNode)node);
            else if (node instanceof PathNode)
                po3 = path((PathNode)node);
            else if (node instanceof RectNode)
                po3 = rect((RectNode)node);
            else if (node instanceof PlaceObjectNode)
                po3 = placeObjectInstance((PlaceObjectNode)node);
            else if (node instanceof BitmapGraphicNode)
                po3 = bitmap((BitmapGraphicNode)node);
            else if (node instanceof TextGraphicNode)
                po3 = text((TextGraphicNode)node);
            else if (node instanceof RichTextNode)
                po3 = richtext((RichTextNode)node);
           
            // If filters were not processed, place the topmost sprite in display list and apply filters
            // This is done to force processing of masks before filters
            if (filters != null)
            {
                DefineSprite sprite = spriteStack.pop();   
                GraphicContext gc = new GraphicContext();
                gc.filters = filters;
                PlaceObject poFilter = placeObject(sprite, gc);
                return poFilter;           
            }
        }

        return po3;
View Full Code Here

Examples of flash.swf.tags.PlaceObject

            DefineScalingGrid grid = createDefineScalingGrid(context.scalingGrid);
            grid.scalingTarget = groupSprite;
            groupSprite.scalingGrid = grid;
        }

        PlaceObject po3 = placeObject(groupSprite, context);
        spriteStack.push(groupSprite);

        // First, process mask (if present)
        List <FilterNode> filters = null;
        if (node.mask != null)
        {   
            // Remove the filters from context and process them later to force Flash Player to process the masks first
            filters = node.filters;
            if (filters == null)
            {
                List<GraphicContentNode> children = node.children;
                if (children != null)
                {
                    GraphicContentNode gcNode0 = (GraphicContentNode) children.get(0);
                    filters = gcNode0.filters;
                    if (filters != null)
                    {
                        //check if all the nodes share the same filter
                        for (int i = 1; ((i < children.size()) && filters!= null); i++)
                        {
                            GraphicContentNode gcNodeI = (GraphicContentNode) children.get(i);
                            if (gcNodeI.filters != filters)
                                filters = null;
                        }
                    }

                    if (filters != null)
                    {
                        for (int i = 0; (i < children.size()) ; i++)
                        {
                            GraphicContentNode gcNodeI = (GraphicContentNode) children.get(i);
                            gcNodeI.filters = null;
                        }                       
                    }
                   
                }
            }
            else
            {
                node.filters = null;
            }
            if (filters != null)      
            {   
                DefineSprite filterSprite = createDefineSprite("MaskFilter");
                spriteStack.push(filterSprite);
            }
            DefineSprite sprite = spriteStack.peek();
            mask(node, sprite);
        }

        // Then process child nodes.
        if (node.children != null)
            graphicContentNodes(node.children);
       
        // If filters were not processed, place the topmost sprite in display list and apply filters
        // This is done to force processing of masks before filters
        if (filters != null)
        {
            DefineSprite sprite = spriteStack.pop();   
            GraphicContext gc = new GraphicContext();
            gc.filters = filters;
            PlaceObject poFilter = placeObject(sprite, gc);
            return poFilter;           
        }
        spriteStack.pop();
        return po3;
    }
View Full Code Here

Examples of flash.swf.tags.PlaceObject

    protected PlaceObject line(LineNode node)
    {
        List<ShapeRecord> shapeRecords = ShapeHelper.line(node.xFrom, node.yFrom, node.xTo, node.yTo);
        GraphicContext context = node.createGraphicContext();
        PlaceObject po3 = placeDefineShape(node, shapeRecords, node.fill, node.stroke, context);
        return po3;
    }
View Full Code Here

Examples of flash.swf.tags.PlaceObject

        return po3;
    }

    protected PlaceObject mask(MaskableNode node, DefineSprite parentSprite)
    {
        PlaceObject po3 = null;

        MaskingNode mask = node.getMask();
        if (mask instanceof GroupNode)
        {
            // According to FXG Spec.: The masking element inherits the target
            // group's coordinate space, as though it were a direct child
            // element. In the case when mask is inside a shape, it doesn't
            // automatically inherit the coordinates from the shape node
            // but inherits from its parent node which is also parent of
            // the shape node. To fix it, specifically concatenating the
            // shape node matrix to the masking node matrix.
            if (!(node instanceof GroupNode || node instanceof GraphicNode))
            {
                FXGMatrix nodeMatrix = null;
                MatrixNode matrixNodeShape = ((GraphicContentNode)node).matrix;
                if (matrixNodeShape == null)
                    // Convert shape node's discreet transform attributes to
                    // matrix.
                    nodeMatrix = FXGMatrix.convertToMatrix(((GraphicContentNode)node).scaleX, ((GraphicContentNode)node).scaleY, ((GraphicContentNode)node).rotation, ((GraphicContentNode)node).x, ((GraphicContentNode)node).y);
                else
                    nodeMatrix = new FXGMatrix(matrixNodeShape);
                // Get masking node matrix.
                MatrixNode matrixNodeMasking = ((GraphicContentNode)mask).matrix;
                // Create a new MatrixNode if the masking node doesn't have one.
                if (matrixNodeMasking == null)
                {
                    // Convert masking node's transform attributes to matrix
                    // so we can concatenate the shape node's matrix to it.
                    ((GraphicContentNode)mask).convertTransformAttrToMatrix();
                    matrixNodeMasking = ((GraphicContentNode)mask).matrix;
                }
                FXGMatrix maskMatrix = new FXGMatrix(matrixNodeMasking);
                // Concatenate the shape node's matrix to the masking node's
                // matrix.
                maskMatrix.concat(nodeMatrix);
                // Set the masking node's matrix with the concatenated values.
                maskMatrix.setMatrixNodeValue(matrixNodeMasking);
            }
           
            markLeafNodesAsMask(node, (GroupNode) mask);
            po3 = group((GroupNode)mask);
        }
        else if (mask instanceof PlaceObjectNode)
        {
            po3 = placeObjectInstance((PlaceObjectNode)mask);
        }

        if (po3 != null)
        {
            int clipDepth = 1;

            // If we had a graphic or group, clip the depths for all children.
            if (node instanceof GroupNode)
            {
                GroupNode group = (GroupNode)node;
                if (group.children != null)
                    clipDepth = parentSprite.depthCounter + group.children.size();
            }
            else if (node instanceof GraphicNode)
            {
                GraphicNode graphic = (GraphicNode)node;
                if (graphic.children != null)
                    clipDepth = parentSprite.depthCounter + graphic.children.size();
            }
            // ... otherwise, just clip the shape itself.
            else
            {
                clipDepth = po3.depth + 1;
            }

            po3.setClipDepth(clipDepth);

            if (node.getMaskType() == MaskType.ALPHA)
            {
                po3.setCacheAsBitmap(true);
            }
        }

        return po3;
    }
View Full Code Here

Examples of flash.swf.tags.PlaceObject

    {
        List<ShapeRecord> shapeRecords = ShapeHelper.path(node, (node.fill != null));
        GraphicContext context = node.createGraphicContext();
        Winding winding[] = new Winding[1];
        winding[0] = node.winding;
        PlaceObject po3 = placeDefineShape(node, shapeRecords, node.fill, node.stroke, context, winding);
        return po3;
    }
View Full Code Here

Examples of flash.swf.tags.PlaceObject

   
    protected PlaceObject placeObject(DefineTag symbol, GraphicContext context)
    {
        DefineSprite sprite = spriteStack.peek();

        PlaceObject po3 = new PlaceObject(Tag.stagPlaceObject3);
        // po3.setName(name);
        po3.setRef(symbol);
        po3.depth = ++sprite.depthCounter;

        if (context.blendMode != null)
        {
            if (!context.blendMode.needsPixelBenderSupport())
            {
                int blendMode = createBlendMode(context.blendMode);
                po3.setBlendMode(blendMode);
            }
            else
            {
                setPixelBenderBlendMode(po3, context.blendMode);
            }
        }
       
        if (context.filters != null)
        {
            List<Filter> filters = createFilters(context.filters);
            po3.setFilterList(filters);
        }

        // FXG angles are always clockwise.
        Matrix matrix = context.getTransform().toSWFMatrix();
        po3.setMatrix(matrix);

        if (context.colorTransform != null)
        {
            ColorTransformNode t = context.colorTransform;
            CXFormWithAlpha cx = TypeHelper.cxFormWithAlpha(t.alphaMultiplier, t.redMultiplier, t.greenMultiplier, t.blueMultiplier, t.alphaOffset, t.redOffset, t.greenOffset, t.blueOffset);
            po3.setCxform(cx);
        }

       
        if (context.maskType == MaskType.ALPHA)
        {
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.