public static void rectToHighlight(
      final int[] highlight, int page, final PdfDecoderInt decode_pdf) {
    int x = 0, y = 0, w = 0, h = 0;
    final int insetW = decode_pdf.getInsetW();
    final int insetH = decode_pdf.getInsetH();
    final float scaling = decode_pdf.getScaling();
    final int scrollInterval = decode_pdf.getScrollInterval();

    final int displayView = decode_pdf.getDisplayView();
    if (page < 1 || page > decode_pdf.getPageCount() || displayView == Display.SINGLE_PAGE) {
      page = decode_pdf.getPageNumber();
    }

    final PdfPageData pageData = decode_pdf.getPdfPageData();
    final int cropW = pageData.getCropBoxWidth(page);
    final int cropH = pageData.getCropBoxHeight(page);
    final int cropX = pageData.getCropBoxX(page);
    final int cropY = pageData.getCropBoxY(page);

    switch (decode_pdf.getDisplayRotation()) {
      case 0:
        x = (int) ((highlight[0] - cropX) * scaling) + insetW;
        y = (int) ((cropH - (highlight[1] - cropY)) * scaling) + insetH;
        w = (int) (highlight[2] * scaling);
        h = (int) (highlight[3] * scaling);

        break;
      case 90:
        x = (int) ((highlight[1] - cropY) * scaling) + insetH;
        y = (int) ((highlight[0] - cropX) * scaling) + insetW;
        w = (int) (highlight[3] * scaling);
        h = (int) (highlight[2] * scaling);

        break;
      case 180:
        x = (int) ((cropW - (highlight[0] - cropX)) * scaling) + insetW;
        y = (int) ((highlight[1] - cropY) * scaling) + insetH;
        w = (int) (highlight[2] * scaling);
        h = (int) (highlight[3] * scaling);

        break;
      case 270:
        x = (int) ((cropH - (highlight[1] - cropY)) * scaling) + insetH;
        y = (int) ((cropW - (highlight[0] - cropX)) * scaling) + insetW;
        w = (int) (highlight[3] * scaling);
        h = (int) (highlight[2] * scaling);

        break;
    }

    if (displayView != Display.SINGLE_PAGE && displayView != Display.PAGEFLOW) {
      x += decode_pdf.getPages().getXCordForPage(page);
      y += decode_pdf.getPages().getYCordForPage(page);
    }

    //
  }
  public static void execute(final GUIFactory currentGUI, final PdfDecoderInt decode_pdf) {
    if (decode_pdf.getDisplayView() == Display.SINGLE_PAGE) {

      /** remove any outline and reset variables used to track change */
      decode_pdf.getTextLines().clearHighlights(); // remove highlighted text
      decode_pdf.repaintPane(0);
      decode_pdf.getPages().setHighlightedImage(null); // remove image highlight
      decode_pdf.getPages().refreshDisplay();
    } else {
      currentGUI.showMessageDialog(Messages.getMessage("PageLayoutMessage.SinglePageOnly"));
    }
  }