static void alignRect(Rectangle r, int w, int h, IdeBackgroundUtil.Anchor anchor) {
      if (anchor == IdeBackgroundUtil.Anchor.TOP_CENTER ||
          anchor == IdeBackgroundUtil.Anchor.CENTER ||
          anchor == IdeBackgroundUtil.Anchor.BOTTOM_CENTER) {
        r.x = (w - r.width) / 2;
        r.y = anchor == IdeBackgroundUtil.Anchor.TOP_CENTER ? 0 :
              anchor == IdeBackgroundUtil.Anchor.BOTTOM_CENTER ? h - r.height :
              (h - r.height) / 2;
      }
      else {
        r.x = anchor == IdeBackgroundUtil.Anchor.TOP_LEFT ||
              anchor == IdeBackgroundUtil.Anchor.MIDDLE_LEFT ||
              anchor == IdeBackgroundUtil.Anchor.BOTTOM_LEFT ? 0 : w - r.width;
        r.y = anchor == IdeBackgroundUtil.Anchor.TOP_LEFT || anchor == IdeBackgroundUtil.Anchor.TOP_RIGHT ? 0 :
              anchor == IdeBackgroundUtil.Anchor.BOTTOM_LEFT || anchor == IdeBackgroundUtil.Anchor.BOTTOM_RIGHT ? h - r.height :
              (h - r.height) / 2;
      }
    }
static void alignRect(Rectangle r, int w, int h, IdeBackgroundUtil.Anchor anchor)