@Override
 protected void onDraw(Canvas canvas) {
   try {
     if (mPathClip == null) {
       mPathClip = new Path();
       mPathClip.addRoundRect(
           new RectF(0, 0, getWidth(), getHeight()), mRadius, mRadius, Path.Direction.CW);
     }
     canvas.clipPath(mPathClip);
     super.onDraw(canvas);
   } catch (Exception e) {
     super.onDraw(canvas);
   }
 }
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    if (calculateRects()) {
      canvas.drawBitmap(mBitmap, mSrcRect, mDestRect, null);
    }
  }
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    if (textOverlay != null && textOverlay != "") {
      canvas.drawText(textOverlay, getWidth() / 2, getHeight() / 2 + textOverlayHeight, paint);
    }
  }
 /** 绘制焦点框 */
 @Override
 protected void onDraw(Canvas canvas) {
   super.onDraw(canvas);
   if (Style.RECTANGLE == mStyle) {
     mFocusPath.addRect(mFocusRect, Path.Direction.CCW);
     canvas.save();
     canvas.clipRect(0, 0, getWidth(), getHeight());
     canvas.clipPath(mFocusPath, Region.Op.DIFFERENCE);
     canvas.drawColor(mMaskColor);
     canvas.restore();
   } else if (Style.CIRCLE == mStyle) {
     float radius =
         Math.min(
             (mFocusRect.right - mFocusRect.left) / 2, (mFocusRect.bottom - mFocusRect.top) / 2);
     mFocusPath.addCircle(mFocusMidPoint.x, mFocusMidPoint.y, radius, Path.Direction.CCW);
     canvas.save();
     canvas.clipRect(0, 0, getWidth(), getHeight());
     canvas.clipPath(mFocusPath, Region.Op.DIFFERENCE);
     canvas.drawColor(mMaskColor);
     canvas.restore();
   }
   mBorderPaint.setColor(mBorderColor);
   mBorderPaint.setStyle(Paint.Style.STROKE);
   mBorderPaint.setStrokeWidth(mBorderWidth);
   mBorderPaint.setAntiAlias(true);
   canvas.drawPath(mFocusPath, mBorderPaint);
   mFocusPath.reset();
 }
  @Override
  protected synchronized void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    float width = getLayoutParams().width - (thumb.getWidth() / 2);
    float height = getLayoutParams().height;
    float line = 2 * (height / 4);
    float fourty = height / 4;
    // int step = Math.round(width/diriv);
    Paint p = new Paint();
    Paint e = new Paint();
    p.setColor(dis);
    e.setColor(en);

    canvas.drawRect(0, line - 1, width, line + 1, p);
    canvas.drawRect(0, line - 1, offset, line + 1, e);
    /*
            if(isScroll) {
                int ii = offsetToTime(0,Math.round(offset));
                if (!isUp && ii>=480) minus -= 1;
                else if (!isUp && offset == 0 && minus < 0) minus += 1;
            }
    */
    boolean isSmall = true;
    int beg = 1;
    if (minus < 0) beg = minus;
    if (thumb != null) {
      if (offset > width) offset = width;
      if (offset < 0) offset = 0;
      canvas.drawBitmap(thumb, offset, (height / 2) - fourty, e);
    }
    int offtime = offsetToTime(minus, Math.round(offset));
    Log.i("onDraw", "" + offtime + " offset:" + offset + " minus:" + minus);
    if (onChange != null) onChange.onTimeChanged(offtime);
    invalidate();
  }
  @Override
  protected void onDraw(Canvas canvas) {
    // TODO Auto-generated method stub
    super.onDraw(canvas);

    canvas.drawCircle(getWidth() / 2, getHeight() / 2, getHeight() / 2, mPaint);
  }
 @Override
 protected void onDraw(Canvas canvas) {
   super.onDraw(canvas);
   Paint p = new Paint();
   p.setColor(Color.parseColor("Black"));
   canvas.drawRect(0, 0, this.getWidth(), this.getHeight(), p);
 }
  /** Draws the widget on the given canvas. */
  @Override
  protected synchronized void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    // draw seek bar background line
    final RectF rect =
        new RectF(
            padding,
            0.5f * (getHeight() - lineHeight),
            getWidth() - padding,
            0.5f * (getHeight() + lineHeight));
    /*paint.setStyle(Style.FILL);
    paint.setColor(getResources().getColor(R.color.notification_baf_color));
    paint.setAntiAlias(true);
    canvas.drawRect(rect, paint);*/

    // draw seek bar active range line
    rect.left = normalizedToScreen(normalizedMinValue);
    rect.right = normalizedToScreen(normalizedMaxValue);

    // orange color
    paint.setColor(getResources().getColor(R.color.white));
    canvas.drawRect(rect, paint);

    // draw minimum thumb
    drawThumb(normalizedToScreen(normalizedMinValue), Thumb.MIN.equals(pressedThumb), canvas);

    // draw maximum thumb
    drawThumb(normalizedToScreen(normalizedMaxValue), Thumb.MAX.equals(pressedThumb), canvas);
  }
  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    int width = this.getWidth();
    int height = this.getHeight();

    if (displayName != null && !TextUtils.isEmpty(displayName)) {
      // draw site name
      mTextPaint.setTextSize(Utilities.getDensityPixels(21, mContext));
      canvas.drawText(
          displayName,
          width / 2,
          height / 2 + Utilities.getDensityPixels(17, mContext),
          mTextPaint);

      // draw site num augmented images
      mTextPaint.setTextSize(Utilities.getDensityPixels(12, mContext));
      //			mTextPaint.setTypeface(Typeface.createFromAsset(mContext.getAssets(), "Avenir
      // Book.ttf"));
      canvas.drawText(
          numAugmentedImages + " Augmented Images",
          width / 2,
          height / 2 + Utilities.getDensityPixels(33, mContext),
          mTextPaint);
    }
  }
Exemple #10
0
 protected void onDraw(Canvas canvas) {
   // TODO Auto-generated method stub
   super.onDraw(canvas);
   if (imageIds != null && imageIds.length > 0) {
     this.setImageResource(imageIds[index]);
   }
 }
  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    Drawable mDrawable = getDrawable();
    if (mDrawable == null) {
      return;
    }

    if (mDrawable.getIntrinsicWidth() == 0 || mDrawable.getIntrinsicHeight() == 0) {
      return; // nothing to draw (empty bounds)
    }

    if (null == maskBitmap) {
      return;
    }

    int saveCount = canvas.getSaveCount();
    canvas.save();
    paint.setFilterBitmap(false);
    paint.setXfermode(mXfermode);
    canvas.drawBitmap(maskBitmap, null, mRoundRect, paint);
    paint.setXfermode(null);
    canvas.restoreToCount(saveCount);
  }
 protected void onDraw(Canvas canvas) {
   canvas.clipRect(0, 0, getWidth(), getHeight());
   b.reset();
   b.addCircle(
       getWidth() / 2, getHeight() / 2, getWidth() / 2 + 1, android.graphics.Path.Direction.CW);
   canvas.clipPath(b, android.graphics.Region.Op.REPLACE);
   super.onDraw(canvas);
 }
  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    // One time call to generate the pressed/focused state -- must be called after
    // measure/layout
    mHolographicHelper.generatePressedFocusedStates(this);
  }
 @Override
 protected void onDraw(Canvas canvas) {
   // 在绘制前设置变换矩阵
   if (getDrawable() != null) {
     setImageMatrix(getCurrentImageMatrix());
   }
   super.onDraw(canvas);
 }
Exemple #15
0
 @Override
 protected void onDraw(Canvas arg0) {
   try {
     super.onDraw(arg0);
   } catch (Exception e) {
     tos();
   }
 }
 @Override
 public void onDraw(Canvas c) {
   super.onDraw(c);
   c.save();
   computeBounds(c);
   drawable.draw(c);
   c.restore();
 }
Exemple #17
0
 @Override
 protected void onDraw(Canvas calque) {
   this.setImageMatrix(ImageControls.getInstance().getTransformationMatrix());
   // mCanvas.setMatrix(ImageControls.getInstance().getTransformationMatrix());
   // mCanvas.drawPath(mPath, mPaint);
   // calque.drawBitmap(bitmap, 0, 0, mPaint);
   this.setImageBitmap(bitmap);
   super.onDraw(calque);
 }
 protected void onDraw(Canvas paramCanvas) {
   if (d != null) {
     paramCanvas.clipPath(d.a(getWidth(), getHeight()));
   }
   super.onDraw(paramCanvas);
   if (c != 0) {
     paramCanvas.drawColor(c);
   }
 }
  @Override
  protected void onDraw(Canvas canvas) {
    float radius = 5.0f; // angle of round corners
    Path clipPath = new Path();
    RectF rect = new RectF(0, 0, this.getWidth(), this.getHeight());
    clipPath.addRoundRect(rect, radius, radius, Path.Direction.CW);
    canvas.clipPath(clipPath);

    super.onDraw(canvas);
  }
 @Override
 protected void onDraw(Canvas canvas) {
   super.onDraw(canvas);
   if (mIfDrawText) {
     String text = String.format("%s%%", mProgress);
     int x = getWidth() / 2 - text.length() * mTextSize / 4;
     int y = getHeight() / 2 + mTextSize / 4;
     canvas.drawText(text, x, y, mTextPaint);
   }
 }
 @Override
 protected void onDraw(Canvas canvas) {
   super.onDraw(canvas);
   if (isFirst) {
     isFirst = false;
     init();
   }
   canvas.setDrawFilter(
       new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG));
 }
  @Override
  public void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    Paint imagePaint = mEditStickersController.getStickerDrawPaint();

    for (MongoImage image : mImages) {
      image.drawImage(canvas, imagePaint);
    }
  }
Exemple #23
0
  @SuppressLint("DrawAllocation")
  @Override
  protected void onDraw(Canvas canvas) {
    if (!isInEditMode()) {
      int i = canvas.saveLayer(0.0f, 0.0f, getWidth(), getHeight(), null, Canvas.ALL_SAVE_FLAG);
      try {
        Bitmap bitmap = mWeakBitmap != null ? mWeakBitmap.get() : null;
        // Bitmap not loaded.
        if (bitmap == null || bitmap.isRecycled()) {
          Drawable drawable = getDrawable();
          if (drawable != null) {
            // Allocation onDraw but it's ok because it will not always be called.
            bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
            Canvas bitmapCanvas = new Canvas(bitmap);
            drawable.setBounds(0, 0, getWidth(), getHeight());
            drawable.draw(bitmapCanvas);

            // If mask is already set, skip and use cached mask.
            if (mMaskBitmap == null || mMaskBitmap.isRecycled()) {
              mMaskBitmap = getBitmap();
            }

            // Draw Bitmap.
            mPaint.reset();
            mPaint.setFilterBitmap(false);
            mPaint.setXfermode(sXfermode);
            //                        mBitmapShader = new BitmapShader(mMaskBitmap,
            //                                Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
            //                        mPaint.setShader(mBitmapShader);
            bitmapCanvas.drawBitmap(mMaskBitmap, 0.0f, 0.0f, mPaint);

            mWeakBitmap = new WeakReference<Bitmap>(bitmap);
          }
        }

        // Bitmap already loaded.
        if (bitmap != null) {
          mPaint.setXfermode(null);
          //                    mPaint.setShader(null);
          canvas.drawBitmap(bitmap, 0.0f, 0.0f, mPaint);
          return;
        }
      } catch (Exception e) {
        System.gc();

        LogUtil.e(
            TAG,
            String.format("Failed to draw, Id :: %s. Error occurred :: %s", getId(), e.toString()));
      } finally {
        canvas.restoreToCount(i);
      }
    } else {
      super.onDraw(canvas);
    }
  }
 @Override
 protected void onDraw(Canvas canvas) {
   super.onDraw(canvas);
   // looks weird, but it's neccessary: saveRoi must be after onDraw,
   // otherwise getImageMatrix did not return proper values
   if (notDrawedRoi != null) {
     saveRoi(notDrawedRoi);
     notDrawedRoi = null;
   }
   drawRoiRectangle(canvas);
   drawAllMarkers(canvas);
 }
  @Override
  protected void onDraw(Canvas canvas) {
    // TODO Auto-generated method stub
    super.onDraw(canvas);
    this.canvas = canvas;

    viewRadius = this.getWidth() / 2; // 整个view半径

    if (isVisibilityIcon) { // 初始化吸管
      canvas.drawBitmap(
          iconBitMap, iconPoint.x - iconRadius, iconPoint.y - iconRadius, mBitmapPaint);
    }
  }
 @Override
 protected void onDraw(Canvas canvas) {
   super.onDraw(canvas);
   Paint paint = new Paint();
   paint.setColor(Color.RED);
   paint.setStyle(Paint.Style.STROKE);
   paint.setStrokeWidth(10);
   float leftx = mImageViewer.X;
   float topy = mImageViewer.Y;
   float rightx = mImageViewer.X + mImageViewer.width;
   float bottomy = mImageViewer.Y + mImageViewer.height;
   canvas.drawRect(leftx, topy, rightx, bottomy, paint);
 }
 @Override
 protected void onDraw(Canvas canvas) {
   super.onDraw(canvas);
   if (!allowInert) return;
   final float deltaX = lastDelta.x * velocity, deltaY = lastDelta.y * velocity;
   if (deltaX > width || deltaY > height) {
     return;
   }
   velocity *= FRICTION;
   if (Math.abs(deltaX) < 0.1 && Math.abs(deltaY) < 0.1) return;
   checkAndSetTranslate(deltaX, deltaY);
   setImageMatrix(matrix);
 }
  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    // centerX = (float) this.getWidth() / 2;
    // centerY = (float) this.getHeight() / 2;
    centerX = (float) this.getHeight() / 2;
    centerY = (float) this.getHeight() / 2;

    if (Count == 0) {
      ((FourModuleChooseActivity) currentContext).setMargin(this.getWidth(), this.getHeight());
      Count++;
    }
  }
  @Override
  protected void onDraw(Canvas canvas) {
    // TODO Auto-generated method stub
    super.onDraw(canvas);
    Logger.info("DottedCircleImage", "Width :" + this.getWidth() + ", Height:" + this.getHeight());
    for (int i = 0; i < circleCount; i++) {

      int randomX = (int) Util.randInt(0, this.getWidth());
      int randomY = (int) Util.randInt(0, this.getHeight());
      Logger.info("DottedCircleImage", "Random X :" + randomX + ", RandomY:" + randomY);
      canvas.drawCircle(randomX, randomY, 10, paint);
    }
  }
Exemple #30
0
 @Override
 protected void onDraw(Canvas canvas) {
   onDrawReady = true;
   imageRenderedAtLeastOnce = true;
   if (delayedZoomVariables != null) {
     setZoom(
         delayedZoomVariables.scale,
         delayedZoomVariables.focusX,
         delayedZoomVariables.focusY,
         delayedZoomVariables.scaleType);
     delayedZoomVariables = null;
   }
   super.onDraw(canvas);
 }