public void draw(
            GFX gfx,
            ListView listView,
            Paint paint,
            int index,
            double x,
            double y,
            double w,
            double h) {
          gfx.translate(x, y);

          if (paint instanceof PatternPaint) {
            PatternPaint pp = (PatternPaint) paint;
            double pw = pp.getImage().getWidth();
            double ph = pp.getImage().getHeight();
            double sx = w / pw;
            double sy = h / ph;
            gfx.scale(sx, sy);
            gfx.setPaint(pp);
            gfx.fillRect(0, 0, pw, ph);
            gfx.scale(1 / sx, 1 / sy);
          } else {
            gfx.setPaint(paint);
            gfx.fillRect(0, 0, w, h);
          }

          gfx.setPaint(FlatColor.BLACK);
          gfx.drawRect(0, 0, w, h);
          gfx.translate(-x, -y);
        }
 public void draw(
     GFX gfx,
     TableView table,
     Song song,
     int row,
     int column,
     double x,
     double y,
     double width,
     double height) {
   if (row % 2 == 0) {
     gfx.setPaint(new FlatColor(0xf8f8ff));
   } else {
     gfx.setPaint(new FlatColor(0xffffff));
   }
   if (row == table.getSelectedRow()) {
     if (table.isFocused()) {
       gfx.setPaint(new FlatColor("#ddddff"));
     } else {
       gfx.setPaint(new FlatColor("#dddddd"));
     }
   }
   gfx.fillRect(x, y, width, height);
   gfx.setPaint(FlatColor.BLACK);
   String text = "";
   if (song != null) {
     switch (column) {
       case 0:
         text = song.name;
         break;
       case 1:
         text = song.artist;
         break;
       case 2:
         text = song.album;
         break;
       case 3:
         text = "" + (int) (song.duration / 60) + ":" + song.duration % 60;
         break;
       case 4:
         text = song.trackNumber + " ";
         break;
       case 5:
         text = song.totalTracks + " ";
         break;
       default:
         text = "--";
     }
   }
   Font.drawCenteredVertically(gfx, text, font, x + 3, y, width, height, false);
   gfx.setPaint(new FlatColor("#d0d0d0"));
   gfx.drawLine(x + width - 1, y, x + width - 1, y + height);
 }
 @Override
 public void draw(GFX g) {
   if (!isVisible()) return;
   g.setPaint(FlatColor.BLACK);
   g.fillRect(0, 0, getWidth(), getHeight());
   g.setPaint(FlatColor.WHITE);
   g.fillRect(0 + 1, 0 + 1, getWidth() - 2, getHeight() - 2);
   g.setPaint(selectedFill);
   g.fillRect(inset, inset, getWidth() - inset * 2, getHeight() - inset * 2);
 }
  private void doDraw(GFX g, Node node) {
    String text = "Welcome to Bedrock";
    String text2 = "by josh marinacci";
    g.drawImage(image, 0, 0);

    Stage s = node.getParent().getStage();

    double x = 0;
    double y = 0;

    x = (s.getWidth() - font.getWidth(text)) / 2;
    y = (s.getHeight() / 2) - font.getDescender();
    g.setPaint(FlatColor.BLACK);
    g.drawText(text, font, x + 4, y + 4);
    g.setPaint(FlatColor.WHITE);
    g.drawText(text, font, x, y);

    x = (s.getWidth() - font2.getWidth(text2)) / 2;
    y = y + font2.getAscender() + font2.getDescender();
    g.setPaint(FlatColor.BLACK);
    g.drawText(text2, font2, x + 4, y + 4);
    g.setPaint(FlatColor.WHITE);
    g.drawText(text2, font2, x, y);
  }
Beispiel #5
0
  @Override
  public void draw(GFX g) {
    if (!isVisible()) return;
    boxPainter.draw(g, styleInfo, sizeInfo, "");

    Bounds leftArrowBounds = new Bounds(0, 0, arrowLength, getHeight());
    Bounds rightArrowBounds = new Bounds(getWidth() - arrowLength, 0, arrowLength, getHeight());
    Bounds thumbBounds = calculateThumbBounds();
    if (isVertical()) {
      leftArrowBounds = new Bounds(0, 0, getWidth(), arrowLength);
      rightArrowBounds = new Bounds(0, getHeight() - arrowLength, getWidth(), arrowLength);
    }

    Bounds trackBounds = getTrackBounds();
    trackSizeInfo.width = trackBounds.getWidth();
    trackSizeInfo.height = trackBounds.getHeight();
    g.translate(trackBounds.getX(), trackBounds.getY());
    trackPainter.draw(g, trackStyleInfo, trackSizeInfo, "");
    g.translate(-trackBounds.getX(), -trackBounds.getY());

    leftArrowSizeInfo.width = leftArrowBounds.getWidth();
    leftArrowSizeInfo.height = leftArrowBounds.getHeight();
    leftArrowPainter.draw(g, leftArrowStyleInfo, leftArrowSizeInfo, "");

    g.translate(rightArrowBounds.getX(), rightArrowBounds.getY());
    rightArrowSizeInfo.width = rightArrowBounds.getWidth();
    rightArrowSizeInfo.height = rightArrowBounds.getHeight();
    rightArrowPainter.draw(g, rightArrowStyleInfo, rightArrowSizeInfo, "");
    g.translate(-rightArrowBounds.getX(), -rightArrowBounds.getY());

    g.translate(thumbBounds.getX(), thumbBounds.getY());
    thumbSizeInfo.width = thumbBounds.getWidth();
    thumbSizeInfo.height = thumbBounds.getHeight();
    thumbPainter.draw(g, thumbStyleInfo, thumbSizeInfo, "");
    g.translate(-thumbBounds.getX(), -thumbBounds.getY());

    // draw the arrows
    /*
    g.setPaint(new FlatColor(0x303030));
    if(isVertical()) {
        GraphicsUtil.fillUpArrow(g,2,2,10);
        GraphicsUtil.fillDownArrow(g,2,getHeight()-2-10,10);
    } else {
        GraphicsUtil.fillLeftArrow(g,2,2,10);
        GraphicsUtil.fillRightArrow(g,getWidth()-2-10,2,10);
    }
    */
  }
  @Override
  public void draw(GFX gfx) {
    float[] curr = toHSB(color);
    float[] start = toHSB(startColor);

    // hue, vertical
    gfx.translate(centerPoint.getX(), centerPoint.getY());
    for (double i = 0; i < 200; i++) {
      FlatColor c = FlatColor.hsb(i / 200 * 360.0, curr[1], curr[2]);
      gfx.setPaint(c);
      double y = start[0] * 200;
      gfx.drawLine(-5, i - y, +5, i - y);
    }
    gfx.translate(-centerPoint.getX(), -centerPoint.getY());

    // saturation, 30 degrees
    gfx.translate(centerPoint.getX(), centerPoint.getY());
    for (double i = 0; i < 200; i++) {
      FlatColor c = FlatColor.hsb(curr[0] * 360, i / 200.0, curr[2]);
      gfx.setPaint(c);
      double sin = Math.sin(Math.toRadians(30));
      double cos = Math.cos(Math.toRadians(30));
      double x = cos * i - cos * start[1] * 200 + 0;
      double y = sin * i - sin * start[1] * 200 + 0;
      // tx = cos(30)*i
      // tx/cos(30) = i
      gfx.drawLine(x, y - 5, x, y + 5);
    }
    gfx.translate(-centerPoint.getX(), -centerPoint.getY());

    // brightness, 150 degrees
    gfx.translate(centerPoint.getX(), centerPoint.getY());
    for (double i = 0; i < 200; i++) {
      FlatColor c = FlatColor.hsb(curr[0] * 360, curr[1], i / 200.0);
      gfx.setPaint(c);
      double sin = Math.sin(Math.toRadians(150));
      double cos = Math.cos(Math.toRadians(150));
      double x = cos * i - cos * start[2] * 200;
      double y = sin * i - sin * start[2] * 200;
      gfx.drawLine(x, y - 5, x, y + 5);
    }
    gfx.translate(-centerPoint.getX(), -centerPoint.getY());

    gfx.setPaint(color);
    double s = 16;
    gfx.fillOval(centerPoint.getX() - s / 2, centerPoint.getY() - s / 2, s, s);
    gfx.setPaint(FlatColor.BLACK);
    gfx.drawOval(centerPoint.getX() - s / 2, centerPoint.getY() - s / 2, s, s);
    gfx.drawRect(0, 0, getWidth(), getHeight());
  }
Beispiel #7
0
 @Override
 public void draw(GFX gfx) {
   gfx.drawImage(image, 0, 0);
 }