Package flash.swf.types

Examples of flash.swf.types.Rect


    else
      {
        height = configuration.defaultHeight();
      }

    size = new Rect(width * 20, height * 20);

        if ((configuration.scriptLimitsSet()))
        {
            scriptLimits = new ScriptLimits( configuration.getScriptRecursionLimit(),
                                             configuration.getScriptTimeLimit() );
View Full Code Here


  private void init()
  {
    defineTags = new TagList();
    graphicContext.validateTransformStack();
    bounds = new Rect();
  }
View Full Code Here

    gvtRoot.paint(swf2d);
    tags = swf2d.getTags();

    //Override width and height based on the SWF-specific bounds of the sprite contents
    //However we have to correct co-ordinates back to pixels... TODO: Remove all TWIPS references!
    Rect bounds = swf2d.getBounds();
    width = (int)Math.rint((bounds.xMax - bounds.xMin)/20.0);
    height = (int)Math.rint((bounds.yMax - bounds.yMin)/20.0);
    }
View Full Code Here

    private Rect decodeRect() throws IOException
    {
        r.syncBits();

        Rect rect = new Rect();

        int nBits = r.readUBits(5);
        rect.xMin = r.readSBits(nBits);
        rect.xMax = r.readSBits(nBits);
        rect.yMin = r.readSBits(nBits);
View Full Code Here

    }

    private Rect parseRect(String s)
    {
        String[] parts = StringUtils.split(s, "x");
        return new Rect(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]));
    }
View Full Code Here

            writeU32(out, u.getAssets().count());

      Movie movie = new Movie();
      movie.version = configuration.getTargetPlayerMajorVersion();
      assert movie.version >= 9;
      movie.size = new Rect(100 * 20, 100 * 20);
      movie.framerate = 12;

      Frame frame = new Frame();
      movie.frames = new ArrayList<Frame>();
      movie.frames.add(frame);
View Full Code Here

    {
    }

    public static Rect build(Rectangle2D r)
    {
        Rect rect = new Rect();

        rect.xMin = (int)Math.rint(r.getMinX() * SwfConstants.TWIPS_PER_PIXEL);
        rect.yMin = (int)Math.rint(r.getMinY() * SwfConstants.TWIPS_PER_PIXEL);
        rect.xMax = (int)Math.rint(r.getMaxX() * SwfConstants.TWIPS_PER_PIXEL);
        rect.yMax = (int)Math.rint(r.getMaxY() * SwfConstants.TWIPS_PER_PIXEL);
 
View Full Code Here

  private void init()
  {
    defineTags = new TagList();
    graphicContext.validateTransformStack();
    bounds = new Rect();
  }
View Full Code Here

   * @see #create()
   */
  private SpriteGraphics2D(SpriteGraphics2D swf2d)
  {
    super((GraphicContext)swf2d.graphicContext.clone());
    bounds = new Rect();
    defineTags = swf2d.getTags();
  }
View Full Code Here

   */
  public static Rect getBounds(List records, List lineStyles)
  {
    if (records == null || records.size() == 0)
    {
      return new Rect();
    }
    else
    {
      int x1 = 0;
      int y1 = 0;
      int x2 = 0;
      int y2 = 0;
      int x = 0;
      int y = 0;
      boolean firstMove = true;

            Iterator it = records.iterator();
      while (it.hasNext())
      {
        ShapeRecord r = (ShapeRecord)it.next();
        if (r == null)
          continue;

        if (r instanceof StyleChangeRecord)
        {
          StyleChangeRecord scr = (StyleChangeRecord)r;
          x = scr.moveDeltaX;
          y = scr.moveDeltaY;
          if (firstMove)
          {
            x1 = x;
            y1 = y;
            x2 = x;
            y2 = y;
            firstMove = false;
          }
        }
        else if (r instanceof StraightEdgeRecord)
        {
          StraightEdgeRecord ser = (StraightEdgeRecord)r;
          x = x + ser.deltaX;
          y = y + ser.deltaY;
        }
        else if (r instanceof CurvedEdgeRecord)
        {
          CurvedEdgeRecord cer = (CurvedEdgeRecord)r;
          x = x + cer.controlDeltaX + cer.anchorDeltaX;
          y = y + cer.controlDeltaY + cer.anchorDeltaY;
        }

        if (x < x1) x1 = x;
        if (y < y1) y1 = y;
        if (x > x2) x2 = x;
        if (y > y2) y2 = y;
      }

      if (lineStyles != null && lineStyles.size() > 0)
      {
        it = lineStyles.iterator();
        int width = SwfConstants.TWIPS_PER_PIXEL;
        while (it.hasNext())
        {
          LineStyle ls = (LineStyle)it.next();
          if (ls == null)
            continue;
          else
          {
            if (width < ls.width)
            width = ls.width;
          }
        }

        double stroke = (int)Math.rint(width * 0.5);
        x1 = (int)Math.rint(x1 - stroke);
        y1 = (int)Math.rint(y1 - stroke);
        x2 = (int)Math.rint(x2 + stroke);
        y2 = (int)Math.rint(y2 + stroke);
      }

      return new Rect(x1, x2, y1, y2);
    }
  }
View Full Code Here

TOP

Related Classes of flash.swf.types.Rect

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.