Пример #1
0
  protected void drawToolTipOutline(
      DrawContext dc, double width, double height, ToolTipAttributes attributes) {
    GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.

    this.applyColor(dc, attributes.getOutlineColor(), attributes.getOutlineOpacity());
    gl.glLineWidth((float) getOutlineWidth());

    // Draw a line loop around the background rectangle. Inset the lines slightly to compensate for
    // OpenGL's line
    // rasterization algorithm. We want the line to straddle the rectangle pixels.
    double inset = 0.5;
    gl.glBegin(GL2.GL_LINE_LOOP);
    gl.glVertex2d(inset, inset);
    gl.glVertex2d(width - inset, inset);
    gl.glVertex2d(width - inset, height - inset);
    gl.glVertex2d(inset, height - inset);
    gl.glEnd();
  }
Пример #2
0
  private void recursiveDraw(
      int level, double x1, double y1, double x2, double y2, double x3, double y3) {
    if (level < 1) {
      return;
    }

    gl.glBegin(GL2.GL_LINE_LOOP);
    gl.glVertex2d(x1, y1);
    gl.glVertex2d(x2, y2);
    gl.glVertex2d(x3, y3);
    gl.glEnd();

    for (int i = 0; i < transitions; i += 1) {
      x1 = rotate_scale_xx[i] * x1 + rotate_scale_xy[i] * y1 + trans_x[i];
      y1 = rotate_scale_yx[i] * x1 + rotate_scale_yy[i] * y1 + trans_y[i];
      x2 = rotate_scale_xx[i] * x2 + rotate_scale_xy[i] * y2 + trans_x[i];
      y2 = rotate_scale_yx[i] * x2 + rotate_scale_yy[i] * y2 + trans_y[i];
      x3 = rotate_scale_xx[i] * x3 + rotate_scale_xy[i] * y3 + trans_x[i];
      y3 = rotate_scale_yx[i] * x3 + rotate_scale_yy[i] * y3 + trans_y[i];

      recursiveDraw(level - 1, x1, y1, x2, y2, x3, y3);
    }
  }