Package ca.eandb.jdcp.worker.policy.win32

Examples of ca.eandb.jdcp.worker.policy.win32.GDI32$RECT


  /**
   * Updates the state of this <code>CourtesyMonitor</code>.
   */
  public synchronized void update() {
    SYSTEM_POWER_STATUS status = new SYSTEM_POWER_STATUS();
    Kernel32.INSTANCE.GetSystemPowerStatus(status);

    switch (status.ACLineStatus) {
    case 0: // battery
      allow(!requireAC
View Full Code Here


      // The window needs to be made visible once to set its WindowProc.
      msgWindow.setVisible(true);
      msgWindow.setVisible(false);

      // Get a handle to the window.
      HWND hwnd = new HWND();
      hwnd.setPointer(Native.getWindowPointer(msgWindow));

      // Set the WindowProc so that this instance receives window
      // messages.
      prevWndProc = User32.INSTANCE.SetWindowLong(hwnd,
          User32.GWL_WNDPROC, this);
View Full Code Here

      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

TOP

Related Classes of ca.eandb.jdcp.worker.policy.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.