Package org.andrewberman.ui

Examples of org.andrewberman.ui.Color


    regStroke = 1f;

    dimColor = foregroundColor.brighter(200);
    dimStroke = 2f;

    hoverColor = new Color(100, 150, 255);
    hoverStroke = 2f;

    copyColor = new Color(255, 0, 0);
    copyStroke = 2f;

    nodeSizeMultiplier = 0.5f;
    lineThicknessMultiplier = 1f;
  }
View Full Code Here


      g2.setRenderingHints(rh);
    } else
    {
      int alpha = (int) (menu.alpha * 255);
      int color;
      Color c;
      canvas.beginShape(PApplet.QUADS);
      canvas.stroke(canvas.color(style.strokeColor.getRGB(), alpha));
      c = style.menuGradLo;
      color = canvas.color(c.getRed(), c.getGreen(), c.getBlue(), alpha);
      canvas.fill(color);
      canvas.vertex((float) drawRect.getMinX(), (float) drawRect
          .getMinY());
      canvas.vertex((float) drawRect.getMaxX(), (float) drawRect
          .getMinY());
      c = style.menuGradHi;
      color = canvas.color(c.getRed(), c.getGreen(), c.getBlue(), alpha);
      canvas.fill(color);
      canvas.vertex((float) drawRect.getMaxX(), (float) drawRect
          .getMaxY());
      canvas.vertex((float) drawRect.getMinX(), (float) drawRect
          .getMaxY());
      canvas.endShape();
    }

    if (hovered != null)
    {
      MenuItem i = hovered;
      float fontSize = origWidth/2f;
      float ascent = UIUtils.getTextAscent(menu.canvas.g,
          menu.style.font, fontSize, false);
      float descent = UIUtils.getTextDescent(menu.canvas.g,
          menu.style.font, fontSize, false);
      float tHeight = (ascent + descent);
      float tWidth = UIUtils.getTextWidth(menu.canvas.g, menu.style.font,
          fontSize, i.getName(), false);

      float tX = 0;
      float tY = 0;
      switch (rotation.rot)
      {
        case (LEFT):
          menu.canvas.textAlign(PApplet.LEFT);
          tX = inset + maxPossibleWidth + menu.style.padX;
          tY = i.getY() + i.getHeight() / 2 + tHeight / 2 - descent
              / 2;
          break;
        case (RIGHT):
          menu.canvas.textAlign(PApplet.LEFT);
          tX = menu.canvas.width - inset - maxPossibleWidth
              - menu.style.padX - tWidth;
          tY = i.getY() + i.getHeight() / 2 + tHeight / 2 - descent
              / 2;
          break;
        case (TOP):
          menu.canvas.textAlign(PApplet.CENTER);
          tX = i.getX() + i.getWidth() / 2;
          tY = inset + maxPossibleWidth + menu.style.padX + tHeight
              - descent;
          break;
        case (BOTTOM):
          menu.canvas.textAlign(PApplet.CENTER);
          tX = i.getX() + i.getWidth() / 2;
          tY = menu.canvas.width - inset - maxPossibleWidth
              - menu.style.padX;
          break;
      }

      if (usesJava2D)
      {
        MenuUtils.drawWhiteTextRect(this, tX-menu.style.padX, tY-ascent-menu.style.padX,tWidth+menu.style.padX*2,tHeight+menu.style.padX*2);
      }
     
      Color c = menu.style.textColor;
      int alpha = (int) (menu.alpha * 255);
      menu.canvas.fill(menu.canvas.color(c.getRed(), c.getGreen(), c
          .getBlue(), alpha));
      // menu.canvas.fill(0,alpha);
      menu.canvas.textFont(FontLoader.instance.vera);
      menu.canvas.textSize(fontSize);
      menu.canvas.text(i.getName(), tX, tY);
      menu.canvas.textAlign(PApplet.LEFT);
    }

    if (lastPressed != null && triangleOnSelected)
    {
      MenuItem i = lastPressed;
      PGraphics pg = canvas.g;
      int alpha = (int) (menu.alpha * 255);
      Color c = menu.style.strokeColor;
      pg.fill(menu.canvas.color(c.getRed(), c.getGreen(), c.getBlue(),
          alpha));

      float height = i.getWidth() / 8;
      switch (rotation.rot)
      {
View Full Code Here

    strokeWidth = .5f;
    stroke = new BasicStroke(strokeWidth, BasicStroke.CAP_ROUND,
        BasicStroke.JOIN_ROUND);
    noStroke = new BasicStroke(0, BasicStroke.CAP_ROUND,
        BasicStroke.JOIN_ROUND);
    strokeColor = new Color(Color.black);
    /*
     * Menu-specific colors.
     */
    menuBackground = new Color(245, 245, 255);
    stateColors = new Color[4];
    Color baseState = new Color(220, 230, 255);
    stateColors[MenuItem.UP] = baseState;
    stateColors[MenuItem.OVER] = baseState.brighter(20);
    stateColors[MenuItem.DOWN] = baseState.darker(20);
    stateColors[MenuItem.DISABLED] = baseState.darker(45);
    menuGradLo = new Color(245, 245, 255);
    menuGradHi = new Color(190, 210, 245);
    /*
     * Text stuff.
     */
    fontSize = 12;
    font = FontLoader.instance.vera;
    font.font = font.font.deriveFont(fontSize);
    textColor = new Color(0, 0, 0);
    selectionColor = new Color(40, 40, 255);
    /*
     * "Layout" stuff
     */
    padY = Math.round(fontSize / 3);
    padX = padY * 1.5f;
 
View Full Code Here

TOP

Related Classes of org.andrewberman.ui.Color

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.