@Override
        public void onCustomDraw(RelativeCanvas canvas_, BasicRelativeView view_) {

          if (_LayoutLabelMode != LAYOUTLABEL_NOTHING) {
            Paint p = new Paint();
            // _LayoutLabel.drawText(canvas);
            p.setColor(_LayoutLineColor);
            switch (_LayoutLabelMode) {
              case LAYOUTLABEL_LINE:
                if (_LayoutLabelDrawUnder) {
                  canvas_.drawLine(
                      _LayoutLabel.width() + 5,
                      height() - (_LayoutLabel.height() / 2f),
                      width() - 5,
                      height() - (_LayoutLabel.height() / 2f),
                      1,
                      p);
                } else {
                  canvas_.drawLine(
                      _LayoutLabel.width() + 5,
                      _LayoutLabel.height() / 2f,
                      width() - 5,
                      _LayoutLabel.height() / 2f,
                      1,
                      p);
                }
                break;
              case LAYOUTLABEL_SQUARE:
                if (_LayoutLabelDrawUnder) {
                  canvas_.drawLine(5, 5, width() - 5, 5, 1, p);
                  canvas_.drawLine(5, 5, 5, height() - (_LayoutLabel.height() / 2f), 1, p);
                  canvas_.drawLine(
                      width() - 5, 5, width() - 5, height() - (_LayoutLabel.height() / 2f), 1, p);
                  canvas_.drawLine(
                      _LayoutLabel.width() + 5,
                      height() - (_LayoutLabel.height() / 2f),
                      width() - 5,
                      height() - (_LayoutLabel.height() / 2f),
                      1,
                      p);
                } else {
                  canvas_.drawLine(
                      _LayoutLabel.width() + 5,
                      _LayoutLabel.height() / 2f,
                      width() - 5,
                      _LayoutLabel.height() / 2f,
                      1,
                      p);
                  canvas_.drawLine(5, _LayoutLabel.height() / 2f, 5, height() - 5, 1, p);
                  canvas_.drawLine(
                      width() - 5, _LayoutLabel.height() / 2f, width() - 5, height() - 5, 1, p);
                  canvas_.drawLine(5, height() - 5, width() - 5, height() - 5, 1, p);
                }
                break;
            }
          }
        }
예제 #2
0
 public void drawOnBitmap(DrawListener drawRoutine_) {
   if (drawRoutine_ != null && _Source != null) {
     RelativeViewAbstract nullView = new RelativeViewAbstract("nullView");
     nullView.setWH(_BitmapRect.width(), _BitmapRect.height());
     Canvas cBitmap = new Canvas(_Source);
     RelativeCanvas rCanvas = new RelativeCanvas(cBitmap, new Rect(0, 0, width(), height()));
     drawRoutine_.onCustomDraw(rCanvas, nullView);
     cBitmap = null;
     rCanvas.destroy();
     rCanvas = null;
     nullView.destroy();
     nullView = null;
   }
 }