Package org.jvnet.substance.painter.highlight

Examples of org.jvnet.substance.painter.highlight.SubstanceHighlightPainter


    // fix for bug 65
    if ((rect.width <= 0) || (rect.height <= 0))
      return;

    Component compForQuerying = (rendererPane != null) ? rendererPane : c;
    SubstanceHighlightPainter highlightPainter = SubstanceCoreUtilities
        .getSkin(compForQuerying).getHighlightPainter();
    SubstanceBorderPainter highlightBorderPainter = SubstanceCoreUtilities
        .getHighlightBorderPainter(compForQuerying);
    Graphics2D g2d = (Graphics2D) g.create(rect.x, rect.y, rect.width,
        rect.height);

    if (openSides == null) {
      openSides = EnumSet.noneOf(Side.class);
    }
    if (rect.width * rect.height < 100000) {
      String openKey = "";
      for (Side oSide : openSides) {
        openKey += oSide.name() + "-";
      }

      HashMapKey key = SubstanceCoreUtilities.getHashKey(highlightPainter
          .getDisplayName(), highlightBorderPainter.getDisplayName(),
          rect.width, rect.height, currScheme.getDisplayName(),
          prevScheme.getDisplayName(), currBorderScheme
              .getDisplayName(), prevBorderScheme
              .getDisplayName(), cyclePos, borderAlpha, openKey);
      BufferedImage result = smallCache.get(key);
      if (result == null) {
        // System.out.println("Cache miss");
        result = SubstanceCoreUtilities.getBlankImage(rect.width,
            rect.height);
        Graphics2D resGraphics = result.createGraphics();
        highlightPainter.paintHighlight(resGraphics, c, rect.width,
            rect.height, openSides, currScheme, prevScheme,
            cyclePos);
        paintHighlightBorder(resGraphics, c, rect.width, rect.height,
            borderAlpha, openSides, highlightBorderPainter,
            currBorderScheme, prevBorderScheme, cyclePos);
        resGraphics.dispose();
        smallCache.put(key, result);
      } else {
        // System.out.println("Cache hit");
      }
      g2d.drawImage(result, 0, 0, null);
      return;
    }

    highlightPainter.paintHighlight(g2d, c, rect.width, rect.height,
        openSides, currScheme, prevScheme, cyclePos);
    paintHighlightBorder(g2d, c, rect.width, rect.height, borderAlpha,
        openSides, highlightBorderPainter, currBorderScheme,
        prevBorderScheme, cyclePos);

View Full Code Here

TOP

Related Classes of org.jvnet.substance.painter.highlight.SubstanceHighlightPainter

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.