Ejemplo n.º 1
0
  protected void paintSelection(TGPainter painter, float fromX, float fromY) {
    if (!this.selectionPaintDisabled
        && this.clientArea != null
        && !TuxGuitar.instance().getPlayer().isRunning()) {
      selectionFinish();
      if (this.selection >= 0) {
        this.selectionPaintDisabled = true;

        int x = Math.round(fromX);
        int y = Math.round(fromY + ((this.maxNote - this.selection) * this.lineHeight));
        int width = Math.round(this.bufferWidth);
        int height = Math.round(this.lineHeight);

        TGImage selectionArea = new TGImageImpl(this.editor.getDisplay(), width, height);
        painter.copyArea(selectionArea, x, y);
        painter.setAlpha(100);
        painter.setBackground(new TGColorImpl(this.config.getColorLine(2)));
        painter.initPath(TGPainter.PATH_FILL);
        painter.setAntialias(false);
        painter.addRectangle(x, y, width, height);
        painter.closePath();

        this.selectionX = x;
        this.selectionY = y;
        this.selectionBackBuffer = selectionArea;
        this.selectionPaintDisabled = false;
      }
    }
  }