Package limelight.os.win32

Examples of limelight.os.win32.GDI32$RECT


      binWidth = width;
      binHeight = height;

      usedRectangles.clear();
      freeRectangles.clear();
      Rect n = new Rect();
      n.x = 0;
      n.y = 0;
      n.width = width;
      n.height = height;
      freeRectangles.add(n);
View Full Code Here


      freeRectangles.add(n);
    }

    /** Packs a single image. Order is defined externally. */
    public Rect insert (Rect rect, FreeRectChoiceHeuristic method) {
      Rect newNode = scoreRect(rect, method);
      if (newNode.height == 0) return null;

      int numRectanglesToProcess = freeRectangles.size;
      for (int i = 0; i < numRectanglesToProcess; ++i) {
        if (splitFreeNode(freeRectangles.get(i), newNode)) {
          freeRectangles.removeIndex(i);
          --i;
          --numRectanglesToProcess;
        }
      }

      pruneFreeList();

      Rect bestNode = new Rect();
      bestNode.set(rect);
      bestNode.score1 = newNode.score1;
      bestNode.score2 = newNode.score2;
      bestNode.x = newNode.x;
      bestNode.y = newNode.y;
      bestNode.width = newNode.width;
View Full Code Here

    /** For each rectangle, packs each one then chooses the best and packs that. Slow! */
    public Page pack (Array<Rect> rects, FreeRectChoiceHeuristic method) {
      rects = new Array(rects);
      while (rects.size > 0) {
        int bestRectIndex = -1;
        Rect bestNode = new Rect();
        bestNode.score1 = Integer.MAX_VALUE;
        bestNode.score2 = Integer.MAX_VALUE;

        // Find the next rectangle that packs best.
        for (int i = 0; i < rects.size; i++) {
          Rect newNode = scoreRect(rects.get(i), method);
          if (newNode.score1 < bestNode.score1 || (newNode.score1 == bestNode.score1 && newNode.score2 < bestNode.score2)) {
            bestNode.set(rects.get(i));
            bestNode.score1 = newNode.score1;
            bestNode.score2 = newNode.score2;
            bestNode.x = newNode.x;
View Full Code Here

    }

    public Page getResult () {
      int w = 0, h = 0;
      for (int i = 0; i < usedRectangles.size; i++) {
        Rect rect = usedRectangles.get(i);
        w = Math.max(w, rect.x + rect.width);
        h = Math.max(h, rect.y + rect.height);
      }
      Page result = new Page();
      result.outputRects = new Array(usedRectangles);
View Full Code Here

      int height = rect.height;
      int rotatedWidth = height - settings.paddingY + settings.paddingX;
      int rotatedHeight = width - settings.paddingX + settings.paddingY;
      boolean rotate = rect.canRotate && settings.rotation;

      Rect newNode = null;
      switch (method) {
      case BestShortSideFit:
        newNode = findPositionForNewNodeBestShortSideFit(width, height, rotatedWidth, rotatedHeight, rotate);
        break;
      case BottomLeftRule:
View Full Code Here

        usedSurfaceArea += usedRectangles.get(i).width * usedRectangles.get(i).height;
      return (float)usedSurfaceArea / (binWidth * binHeight);
    }

    private Rect findPositionForNewNodeBottomLeft (int width, int height, int rotatedWidth, int rotatedHeight, boolean rotate) {
      Rect bestNode = new Rect();

      bestNode.score1 = Integer.MAX_VALUE; // best y, score2 is best x

      for (int i = 0; i < freeRectangles.size; i++) {
        // Try to place the rectangle in upright (non-rotated) orientation.
View Full Code Here

      return bestNode;
    }

    private Rect findPositionForNewNodeBestShortSideFit (int width, int height, int rotatedWidth, int rotatedHeight,
      boolean rotate) {
      Rect bestNode = new Rect();
      bestNode.score1 = Integer.MAX_VALUE;

      for (int i = 0; i < freeRectangles.size; i++) {
        // Try to place the rectangle in upright (non-rotated) orientation.
        if (freeRectangles.get(i).width >= width && freeRectangles.get(i).height >= height) {
View Full Code Here

      return bestNode;
    }

    private Rect findPositionForNewNodeBestLongSideFit (int width, int height, int rotatedWidth, int rotatedHeight,
      boolean rotate) {
      Rect bestNode = new Rect();

      bestNode.score2 = Integer.MAX_VALUE;

      for (int i = 0; i < freeRectangles.size; i++) {
        // Try to place the rectangle in upright (non-rotated) orientation.
View Full Code Here

      }
      return bestNode;
    }

    private Rect findPositionForNewNodeBestAreaFit (int width, int height, int rotatedWidth, int rotatedHeight, boolean rotate) {
      Rect bestNode = new Rect();

      bestNode.score1 = Integer.MAX_VALUE; // best area fit, score2 is best short side fit

      for (int i = 0; i < freeRectangles.size; i++) {
        int areaFit = freeRectangles.get(i).width * freeRectangles.get(i).height - width * height;
 
View Full Code Here

      }
      return score;
    }

    private Rect findPositionForNewNodeContactPoint (int width, int height, int rotatedWidth, int rotatedHeight, boolean rotate) {
      Rect bestNode = new Rect();

      bestNode.score1 = -1; // best contact score

      for (int i = 0; i < freeRectangles.size; i++) {
        // Try to place the rectangle in upright (non-rotated) orientation.
View Full Code Here

TOP

Related Classes of limelight.os.win32.GDI32$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.