コード例 #1
0
  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    /** 画最外层的大圆环 */
    int centre = getWidth() / 2; // 获取圆心的x坐标
    int radius = (int) (centre - roundWidth / 2); // 圆环的半径
    paint.setColor(roundColor); // 设置圆环的颜色
    paint.setStyle(Paint.Style.STROKE); // 设置空心
    paint.setStrokeWidth(roundWidth); // 设置圆环的宽度
    paint.setAntiAlias(true); // 消除锯齿
    PathEffect effects = new DashPathEffect(new float[] {8, 2}, 1);
    paint.setPathEffect(effects);
    canvas.drawCircle(centre, centre, radius, paint); // 画出圆环

    /** 画进度百分比 */
    paint.setStrokeWidth(0);
    paint.setColor(textColor);
    paint.setTextSize(textSize);
    paint.setTypeface(Typeface.DEFAULT_BOLD); // 设置字体
    int percent = (int) (((float) progress / (float) max) * 100); // 中间的进度百分比,先转换成float在进行除法运算,不然都为0
    float textWidth = paint.measureText(percent + "%"); // 测量字体宽度,我们需要根据字体的宽度设置在圆环中间

    if (textIsDisplayable && percent != 0 && style == STROKE) {
      canvas.drawText(
          percent + "%", centre - textWidth / 2, centre + textSize / 2, paint); // 画出进度百分比
    }

    /** 画圆弧 ,画圆环的进度 */

    // 设置进度是实心还是空心
    paint2.setStrokeWidth(roundWidth); // 设置圆环的宽度
    paint2.setShader(lg); // 设置渐变色
    paint2.setAntiAlias(true); // 消除锯齿
    //        paint.setColor(roundProgressColor);  //设置进度的颜色
    paint2.setPathEffect(null);
    RectF oval =
        new RectF(
            centre - radius, centre - radius, centre + radius, centre + radius); // 用于定义的圆弧的形状和大小的界限

    switch (style) {
      case STROKE:
        {
          paint2.setStyle(Paint.Style.STROKE);
          canvas.drawArc(oval, 0, 360 * progress / max, false, paint2); // 根据进度画圆弧
          break;
        }
      case FILL:
        {
          paint2.setStyle(Paint.Style.FILL_AND_STROKE);
          if (progress != 0) canvas.drawArc(oval, 0, 360 * progress / max, true, paint2); // 根据进度画圆弧
          break;
        }
    }
  }
コード例 #2
0
  private void updatePath() {
    float radius = getWidth() / 20;
    float arrowHeight = getHeight() / 4;

    Rect rect = new Rect(2, 2, this.getWidth() - 4, this.getHeight() - 4);

    mPath = new Path();
    mPath.moveTo(rect.left + radius, rect.top);
    mPath.lineTo(rect.right, rect.top);
    mPath.lineTo(rect.right, rect.bottom - arrowHeight);
    mPath.lineTo(rect.exactCenterX(), rect.bottom);
    mPath.lineTo(rect.left, rect.bottom - arrowHeight);
    mPath.lineTo(rect.left, rect.top);
    mPath.close();

    int color = this.getContext().getResources().getColor(R.color.tag_unselected_outline);
    if (mIsActive) color = this.getContext().getResources().getColor(R.color.tag_selected_outline);

    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(color);
    mPaint.setStyle(Paint.Style.FILL);
    mPaint.setStrokeWidth(0);
    mPaint.setStrokeJoin(Paint.Join.ROUND); // set the join to round you
    // want
    mPaint.setStrokeCap(Paint.Cap.ROUND); // set the paint cap to round too
    mPaint.setPathEffect(new CornerPathEffect(radius)); // set the path
    // effect when they

    color = this.getContext().getResources().getColor(R.color.tag_unselected);
    if (mIsActive) color = this.getContext().getResources().getColor(R.color.tag_selected);
    mShader = new LinearGradient(0, 0, 0, getHeight(), color, color, Shader.TileMode.CLAMP);
  }
コード例 #3
0
 private void initInternalCirclePainter() {
   progressPaint = new Paint();
   progressPaint.setAntiAlias(true);
   progressPaint.setStrokeWidth(internalStrokeWidth);
   progressPaint.setColor(color);
   progressPaint.setStyle(Paint.Style.STROKE);
   progressPaint.setPathEffect(new DashPathEffect(new float[] {dashWith, dashSpace}, dashSpace));
 }
コード例 #4
0
  /**
   * Constructor: create a new TrackingOverlay.
   *
   * @param loggermap
   * @param segmentUri
   * @param color
   * @param avgSpeed
   * @param mapView
   */
  public SegmentOverlay(
      LoggerMap loggermap,
      Uri segmentUri,
      int color,
      double avgSpeed,
      MapView mapView,
      Handler handler) {
    super();
    mHandler = handler;
    mLoggerMap = loggermap;
    mMapView = mapView;
    mTrackColoringMethod = color;
    mAvgSpeed = avgSpeed;
    mSegmentUri = segmentUri;
    mMediaUri = Uri.withAppendedPath(mSegmentUri, "media");
    mWaypointsUri = Uri.withAppendedPath(mSegmentUri, "waypoints");
    mResolver = mLoggerMap.getContentResolver();
    mRequeryFlag = true;
    mCurrentColor = Color.rgb(255, 0, 0);
    mProjection = mapView.getProjection();

    dotpaint = new Paint();
    radiusPaint = new Paint();
    radiusPaint.setColor(Color.YELLOW);
    radiusPaint.setAlpha(100);
    routePaint = new Paint();
    routePaint.setStyle(Paint.Style.STROKE);
    routePaint.setStrokeWidth(6);
    routePaint.setAntiAlias(true);
    routePaint.setPathEffect(new CornerPathEffect(10));
    defaultPaint = new Paint();
    mScreenPoint = new Point();
    mMediaScreenPoint = new Point();
    startStopCirclePoint = new Point();
    mScreenPointBackup = new Point();
    mPrevDrawnScreenPoint = new Point();

    mDotPath = new Vector<DotVO>();
    mDotPathCalculation = new Vector<DotVO>();
    mPath = new Path();
    mPathCalculation = new Path();
    mMediaPath = new Vector<MediaVO>();
    mMediaPathCalculation = new Vector<MediaVO>();

    mTrackSegmentsObserver =
        new ContentObserver(new Handler()) {

          @Override
          public void onChange(boolean selfUpdate) {
            if (!selfUpdate) {
              mRequeryFlag = true;
            } else {
              Log.w(this, "mTrackSegmentsObserver skipping change on " + mSegmentUri);
            }
          }
        };
    mResolver.registerContentObserver(mWaypointsUri, false, mTrackSegmentsObserver);
  }
コード例 #5
0
 private void setupPaint() {
   mPaint.setAntiAlias(true);
   mPaint.setStrokeWidth(getStrokeWidth());
   mPaint.setStyle(Paint.Style.STROKE);
   mPaint.setStrokeJoin(Paint.Join.MITER);
   mPaint.setPathEffect(
       new DashPathEffect(
           new float[] {mPathFullLineSize, mPathDottedLineSize}, mPathDottedLineSize));
 }
コード例 #6
0
 protected final int h(int paramInt, Object... paramVarArgs) {
   switch (paramInt) {
   }
   for (; ; ) {
     return 0;
     return 46;
     return 46;
     Canvas localCanvas = (Canvas) paramVarArgs[0];
     paramVarArgs = (Looper) paramVarArgs[1];
     c.e(paramVarArgs);
     c.d(paramVarArgs);
     Object localObject = c.h(paramVarArgs);
     ((Paint) localObject).setFlags(385);
     ((Paint) localObject).setStyle(Paint.Style.FILL);
     Paint localPaint1 = c.h(paramVarArgs);
     localPaint1.setFlags(385);
     localPaint1.setStyle(Paint.Style.STROKE);
     ((Paint) localObject).setColor(-16777216);
     localPaint1.setStrokeWidth(1.0F);
     localPaint1.setStrokeCap(Paint.Cap.BUTT);
     localPaint1.setStrokeJoin(Paint.Join.MITER);
     localPaint1.setStrokeMiter(4.0F);
     localPaint1.setPathEffect(null);
     Paint localPaint2 = c.a(localPaint1, paramVarArgs);
     localPaint2.set(localPaint1);
     localPaint2.setStrokeWidth(1.0F);
     localCanvas.save();
     localPaint1 = c.a((Paint) localObject, paramVarArgs);
     localPaint1.set((Paint) localObject);
     localPaint1.setColor(-8744017);
     localObject = c.i(paramVarArgs);
     ((Path) localObject).moveTo(30.430653F, 34.178318F);
     ((Path) localObject).cubicTo(27.249908F, 36.57749F, 23.291077F, 38.0F, 19.0F, 38.0F);
     ((Path) localObject).cubicTo(8.50659F, 38.0F, 0.0F, 29.49341F, 0.0F, 19.0F);
     ((Path) localObject).cubicTo(0.0F, 8.50659F, 8.50659F, 0.0F, 19.0F, 0.0F);
     ((Path) localObject).cubicTo(29.49341F, 0.0F, 38.0F, 8.50659F, 38.0F, 19.0F);
     ((Path) localObject)
         .cubicTo(38.0F, 23.291077F, 36.57749F, 27.249908F, 34.178318F, 30.430653F);
     ((Path) localObject).lineTo(45.619164F, 41.8715F);
     ((Path) localObject).lineTo(41.8715F, 45.619164F);
     ((Path) localObject).lineTo(30.430653F, 34.178318F);
     ((Path) localObject).close();
     ((Path) localObject).moveTo(27.062714F, 30.44662F);
     ((Path) localObject).cubicTo(24.783264F, 32.055153F, 22.001972F, 33.0F, 19.0F, 33.0F);
     ((Path) localObject).cubicTo(11.268014F, 33.0F, 5.0F, 26.731987F, 5.0F, 19.0F);
     ((Path) localObject).cubicTo(5.0F, 11.268014F, 11.268014F, 5.0F, 19.0F, 5.0F);
     ((Path) localObject).cubicTo(26.731987F, 5.0F, 33.0F, 11.268014F, 33.0F, 19.0F);
     ((Path) localObject)
         .cubicTo(33.0F, 22.001972F, 32.055153F, 24.783264F, 30.44662F, 27.062714F);
     ((Path) localObject).lineTo(27.062714F, 30.44662F);
     ((Path) localObject).close();
     WeChatSVGRenderC2Java.setFillType((Path) localObject, 2);
     localCanvas.drawPath((Path) localObject, localPaint1);
     localCanvas.restore();
     c.g(paramVarArgs);
   }
 }
コード例 #7
0
ファイル: MyMapActivity.java プロジェクト: tiemptit/travelh2v
 public void initPaint() {
   if (paint == null) paint = new Paint();
   paint.setColor(Color.RED);
   paint.setStyle(Style.STROKE);
   paint.setAntiAlias(true);
   paint.setStrokeWidth(LINE_WIDTH);
   PathEffect effect = new CornerPathEffect(LINE_WIDTH);
   paint.setPathEffect(effect);
 }
コード例 #8
0
 protected final int i(int paramInt, Object... paramVarArgs) {
   switch (paramInt) {
   }
   for (; ; ) {
     return 0;
     return 168;
     return 168;
     Canvas localCanvas = (Canvas) paramVarArgs[0];
     paramVarArgs = (Looper) paramVarArgs[1];
     Object localObject1 = c.d(paramVarArgs);
     Object localObject2 = c.c(paramVarArgs);
     Paint localPaint1 = c.g(paramVarArgs);
     localPaint1.setFlags(385);
     localPaint1.setStyle(Paint.Style.FILL);
     Paint localPaint2 = c.g(paramVarArgs);
     localPaint2.setFlags(385);
     localPaint2.setStyle(Paint.Style.STROKE);
     localPaint1.setColor(-16777216);
     localPaint2.setStrokeWidth(1.0F);
     localPaint2.setStrokeCap(Paint.Cap.BUTT);
     localPaint2.setStrokeJoin(Paint.Join.MITER);
     localPaint2.setStrokeMiter(4.0F);
     localPaint2.setPathEffect(null);
     c.a(localPaint2, paramVarArgs).setStrokeWidth(1.0F);
     localPaint1 = c.a(localPaint1, paramVarArgs);
     localPaint1.setColor(-9473160);
     localCanvas.save();
     localObject2 = c.a((float[]) localObject2, 1.0F, 0.0F, 51.0F, 0.0F, 1.0F, 39.0F);
     ((Matrix) localObject1).reset();
     ((Matrix) localObject1).setValues((float[]) localObject2);
     localCanvas.concat((Matrix) localObject1);
     localCanvas.save();
     localObject1 = c.a(localPaint1, paramVarArgs);
     localObject2 = c.h(paramVarArgs);
     ((Path) localObject2).moveTo(31.624044F, 90.34997F);
     ((Path) localObject2)
         .cubicTo(32.383965F, 91.14044F, 33.629753F, 91.13373F, 34.386406F, 90.3389F);
     ((Path) localObject2).cubicTo(34.386406F, 90.3389F, 66.0F, 58.57656F, 66.0F, 33.461914F);
     ((Path) localObject2).cubicTo(66.0F, 14.90092F, 51.225395F, 0.0F, 33.47826F, 0.0F);
     ((Path) localObject2).cubicTo(14.774603F, 0.0F, 0.0F, 14.90092F, 0.0F, 33.461914F);
     ((Path) localObject2).cubicTo(0.0F, 58.57656F, 31.624044F, 90.34997F, 31.624044F, 90.34997F);
     ((Path) localObject2).close();
     ((Path) localObject2).moveTo(33.0F, 44.30819F);
     ((Path) localObject2).cubicTo(39.07513F, 44.30819F, 44.0F, 39.348827F, 44.0F, 33.231144F);
     ((Path) localObject2).cubicTo(44.0F, 27.113459F, 39.07513F, 22.154095F, 33.0F, 22.154095F);
     ((Path) localObject2).cubicTo(26.924868F, 22.154095F, 22.0F, 27.113459F, 22.0F, 33.231144F);
     ((Path) localObject2).cubicTo(22.0F, 39.348827F, 26.924868F, 44.30819F, 33.0F, 44.30819F);
     ((Path) localObject2).close();
     WeChatSVGRenderC2Java.setFillType((Path) localObject2, 2);
     localCanvas.drawPath((Path) localObject2, (Paint) localObject1);
     localCanvas.restore();
     localCanvas.restore();
     c.f(paramVarArgs);
   }
 }
コード例 #9
0
 public Paint getCutoffDashedPaint(int color, int stroke_width, PathEffect effects) {
   if (paint_cutoff_dashed == null) {
     paint_cutoff_dashed = new Paint();
     paint_cutoff_dashed.setAntiAlias(true);
     paint_cutoff_dashed.setStyle(Paint.Style.STROKE);
   }
   paint_cutoff_dashed.setColor(color);
   paint_cutoff_dashed.setStrokeWidth(stroke_width);
   paint_cutoff_dashed.setPathEffect(effects);
   return paint_cutoff_dashed;
 }
コード例 #10
0
ファイル: Frog.java プロジェクト: hubby1981/JumpingFrogs
  @Override
  protected void onDraw(Canvas canvas) {
    try {
      int height = getHeight() / 10;
      Bitmap state =
          State == 7
              ? StateSplash4
              : State == 6
                  ? StateSplash3
                  : State == 5
                      ? StateSplash2
                      : State == 4
                          ? StateSplash1
                          : State == 3
                              ? StateLand
                              : State == 2 ? StateFly : State == 1 ? StateJump : StateSit;

      if (Position == null) {
        X = (int) GameStat.RoseStart.exactCenterX();
        Y = (int) GameStat.RoseStart.exactCenterY();

        Y -= height;
        X -= height / 2;

        Position = new Rect(X, Y, X + height, Y + height);
      }

      if (Charge > 0 && State == 0) {

        int si = Charge + 5;
        Drop.setStrokeWidth(Position.width() / 2);
        Drop.setPathEffect(
            new DashPathEffect(new float[] {Position.width() / 8, Position.width()}, 0));

        Path p = new Path();
        p.moveTo(Position.exactCenterX(), Position.exactCenterY());
        p.lineTo(MovePoint.x, MovePoint.y);

        canvas.drawPath(p, Drop);
      }
      Scorer.setTextSize(getHeight() / 8);
      Scorer.setFakeBoldText(true);
      // Scorer.setShadowLayer(10, 10, 10, Color.DKGRAY);

      canvas.drawText(
          String.valueOf(Score),
          FontHelper.drawTextX(String.valueOf(Score), Scorer, getWidth() / 2),
          0 + getHeight() / 8,
          Scorer);

      BitmapHelper.drawIn(canvas, Position, state);
    } catch (Exception e) {
    }
  }
コード例 #11
0
 private void initPainter() {
   paint = new Paint();
   paint.setAntiAlias(true);
   paint.setStrokeWidth(strokeWidth);
   paint.setColor(color);
   paint.setStyle(Paint.Style.STROKE);
   Path path = new Path();
   path.addRoundRect(new RectF(0, 0, lineWidth, strokeWidth), 5, 5, Path.Direction.CCW);
   paint.setPathEffect(
       new PathDashPathEffect(path, lineSpace, 0, PathDashPathEffect.Style.ROTATE));
 }
コード例 #12
0
  public RotateView(Context context, AttributeSet attrs) {
    super(context, attrs);

    dashStrokePaint = new Paint();
    dashStrokePaint.setAntiAlias(true);
    dashStrokePaint.setStyle(Paint.Style.STROKE);
    dashStrokePaint.setPathEffect(new DashPathEffect(new float[] {15.0f, 5.0f}, 1.0f));
    dashStrokePaint.setStrokeWidth(2f);
    gridsColor = context.getResources().getColor(R.color.translucent_white);
    referenceColor = context.getResources().getColor(R.color.translucent_cyan);
  }
コード例 #13
0
 public SelectionShapeDrawController(Context context, float f1, RectF rectf, Rect rect)
 {
     w = new CornerPathEffect(3F);
     x = new DashPathEffect(u, 0.0F);
     y = new DashPathEffect(v, 1.0F);
     z = new ComposePathEffect(w, x);
     A = new ComposePathEffect(w, y);
     d = new Path();
     e = null;
     i = false;
     j = false;
     k = false;
     p = new Matrix();
     q = new RectF();
     r = new RectF();
     a = f1;
     b = rectf;
     c = rect;
     f = new Paint();
     f.setFilterBitmap(true);
     f1 = (Utils.a(1.0F, context) * 2.0F) / 3F;
     g = new Paint();
     g.setAntiAlias(true);
     g.setStyle(android.graphics.Paint.Style.STROKE);
     g.setStrokeJoin(android.graphics.Paint.Join.ROUND);
     g.setStrokeCap(android.graphics.Paint.Cap.ROUND);
     g.setStrokeWidth(f1);
     g.setFilterBitmap(true);
     g.setColor(-1);
     g.setPathEffect(z);
     h = new Paint();
     h.setAntiAlias(true);
     h.setStyle(android.graphics.Paint.Style.STROKE);
     h.setStrokeJoin(android.graphics.Paint.Join.ROUND);
     h.setStrokeCap(android.graphics.Paint.Cap.ROUND);
     h.setStrokeWidth(f1);
     h.setFilterBitmap(true);
     h.setColor(0xff000000);
     h.setPathEffect(A);
     a(SelectionShapeType.RECTANGLE);
 }
コード例 #14
0
ファイル: Line.java プロジェクト: harley1011/PaintApp-Android
  @Override
  public void draw(Paint paint, Canvas canvas) {

    // reset any path effect
    paint.setPathEffect(null);

    paint.setStyle(Paint.Style.STROKE);
    paint.setColor(strokeColor);
    paint.setStrokeWidth(strokeWidth);
    paint.setStrokeCap(Paint.Cap.ROUND);
    canvas.drawLine(x1, y1, x2, y2, paint);
  }
コード例 #15
0
  public void onStartPostProcessing() {
    LayoutInflater inflator = ApplicationScreen.instance.getLayoutInflater();
    postProcessingView =
        inflator.inflate(R.layout.plugin_processing_sequence_postprocessing, null, false);

    mImgView = ((ImageView) postProcessingView.findViewById(R.id.sequenceImageHolder));

    if (PreviewBmp != null) {
      PreviewBmp.recycle();
    }

    paint = new Paint();
    paint.setColor(0xFF00AAEA);
    paint.setStrokeWidth(5);
    paint.setPathEffect(new DashPathEffect(new float[] {5, 5}, 0));

    PreviewBmp = mAlmaCLRShot.getPreviewBitmap();

    if (PreviewBmp != null) {
      Matrix matrix = new Matrix();
      matrix.postRotate(90);
      Bitmap rotated =
          Bitmap.createBitmap(
              PreviewBmp, 0, 0, PreviewBmp.getWidth(), PreviewBmp.getHeight(), matrix, true);
      mImgView.setImageBitmap(rotated);
      mImgView.setRotation(
          mCameraMirrored
              ? ((mDisplayOrientation == 0 || mDisplayOrientation == 180) ? 0 : 180)
              : 0);
    }

    sequenceView = ((OrderControl) postProcessingView.findViewById(R.id.seqView));
    final Bitmap[] thumbnailsArray = new Bitmap[thumbnails.size()];
    for (int i = 0; i < thumbnailsArray.length; i++) {
      Bitmap bmp = thumbnails.get(i);
      Matrix matrix = new Matrix();
      matrix.postRotate(
          mCameraMirrored
              ? ((mDisplayOrientation == 0 || mDisplayOrientation == 180) ? 270 : 90)
              : 90);
      Bitmap rotated =
          Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
      thumbnailsArray[i] = rotated;
    }
    sequenceView.setContent(thumbnailsArray, this);
    LayoutParams lp = (LayoutParams) sequenceView.getLayoutParams();
    lp.height = thumbnailsArray[0].getHeight();
    sequenceView.setLayoutParams(lp);

    sequenceView.setRotation(mCameraMirrored ? 180 : 0);

    mHandler.sendEmptyMessage(MSG_END_OF_LOADING);
  }
コード例 #16
0
 protected final int i(int paramInt, Object... paramVarArgs) {
   switch (paramInt) {
   }
   for (; ; ) {
     return 0;
     return 28;
     return 16;
     Canvas localCanvas = (Canvas) paramVarArgs[0];
     paramVarArgs = (Looper) paramVarArgs[1];
     c.d(paramVarArgs);
     c.c(paramVarArgs);
     Paint localPaint = c.g(paramVarArgs);
     localPaint.setFlags(385);
     localPaint.setStyle(Paint.Style.FILL);
     Object localObject = c.g(paramVarArgs);
     ((Paint) localObject).setFlags(385);
     ((Paint) localObject).setStyle(Paint.Style.STROKE);
     localPaint.setColor(-16777216);
     ((Paint) localObject).setStrokeWidth(1.0F);
     ((Paint) localObject).setStrokeCap(Paint.Cap.BUTT);
     ((Paint) localObject).setStrokeJoin(Paint.Join.MITER);
     ((Paint) localObject).setStrokeMiter(4.0F);
     ((Paint) localObject).setPathEffect(null);
     c.a((Paint) localObject, paramVarArgs).setStrokeWidth(1.0F);
     localCanvas.save();
     localPaint = c.a(localPaint, paramVarArgs);
     localPaint.setColor(-3355444);
     localObject = c.h(paramVarArgs);
     ((Path) localObject).moveTo(13.962992F, 10.188502F);
     ((Path) localObject)
         .cubicTo(13.08834F, 9.283867F, 12.178382F, 8.349955F, 11.50355F, 7.6751227F);
     ((Path) localObject).lineTo(3.828427F, 8.881784E-16F);
     ((Path) localObject).lineTo(1.0F, 2.828427F);
     ((Path) localObject).lineTo(13.9616785F, 15.961207F);
     ((Path) localObject).lineTo(13.994814F, 15.928072F);
     ((Path) localObject).lineTo(14.008518F, 15.941776F);
     ((Path) localObject).lineTo(15.711977F, 14.210909F);
     ((Path) localObject).lineTo(16.790106F, 13.13278F);
     ((Path) localObject)
         .cubicTo(16.790106F, 13.13278F, 16.787266F, 13.1298F, 16.781706F, 13.123969F);
     ((Path) localObject).lineTo(26.914213F, 2.828427F);
     ((Path) localObject).lineTo(24.085787F, -5.3290705E-15F);
     ((Path) localObject).lineTo(16.410664F, 7.6751227F);
     ((Path) localObject)
         .cubicTo(15.7343025F, 8.351483F, 14.829623F, 9.285367F, 13.962992F, 10.188502F);
     ((Path) localObject).close();
     WeChatSVGRenderC2Java.setFillType((Path) localObject, 2);
     localCanvas.drawPath((Path) localObject, localPaint);
     localCanvas.restore();
     c.f(paramVarArgs);
   }
 }
コード例 #17
0
ファイル: Layer.java プロジェクト: aquabluefish/GDSview
 // Stroke Setting
 public boolean sSetting(Paint paint, int alpha) {
   if (scolor != code("None")) {
     paint.reset();
     paint.setColor(this.scolor);
     paint.setAlpha(alpha);
     paint.setStrokeWidth(this.width);
     if (this.effect != null) paint.setPathEffect(this.effect);
     //			else
     //				paint.setPathEffect(PathType.solid.effect());
     paint.setStyle(Style.STROKE);
     return true;
   }
   return false;
 }
コード例 #18
0
  private void drawPathEffect(Canvas canvas) {
    mPaint.setColor(Color.BLACK);
    mPaint.setStyle(Style.STROKE);
    mPaint.setStrokeWidth(10);

    // float[] intervals = {20, 10, 10, 5};
    // DashPathEffect patheffect = new DashPathEffect(intervals, 10);

    PathDashPathEffect patheffect =
        new PathDashPathEffect(mArrowPath, 10, 0, PathDashPathEffect.Style.ROTATE);
    mPaint.setPathEffect(patheffect);
    // canvas.drawRect(100, 100, 300, 300, mPaint);
    canvas.drawCircle(200, 200, 100, mPaint);
  }
コード例 #19
0
 protected final int i(int paramInt, Object... paramVarArgs) {
   switch (paramInt) {
   }
   for (; ; ) {
     return 0;
     return 100;
     return 100;
     Canvas localCanvas = (Canvas) paramVarArgs[0];
     paramVarArgs = (Looper) paramVarArgs[1];
     c.d(paramVarArgs);
     c.c(paramVarArgs);
     Paint localPaint = c.g(paramVarArgs);
     localPaint.setFlags(385);
     localPaint.setStyle(Paint.Style.FILL);
     Object localObject = c.g(paramVarArgs);
     ((Paint) localObject).setFlags(385);
     ((Paint) localObject).setStyle(Paint.Style.STROKE);
     localPaint.setColor(-16777216);
     ((Paint) localObject).setStrokeWidth(1.0F);
     ((Paint) localObject).setStrokeCap(Paint.Cap.BUTT);
     ((Paint) localObject).setStrokeJoin(Paint.Join.MITER);
     ((Paint) localObject).setStrokeMiter(4.0F);
     ((Paint) localObject).setPathEffect(null);
     c.a((Paint) localObject, paramVarArgs).setStrokeWidth(1.0F);
     localPaint = c.a(localPaint, paramVarArgs);
     localPaint.setColor(-4210753);
     localCanvas.save();
     localPaint = c.a(localPaint, paramVarArgs);
     localObject = c.h(paramVarArgs);
     ((Path) localObject).moveTo(47.0F, 0.0F);
     ((Path) localObject).lineTo(53.0F, 0.0F);
     ((Path) localObject).lineTo(53.0F, 47.0F);
     ((Path) localObject).lineTo(100.0F, 47.0F);
     ((Path) localObject).lineTo(100.0F, 53.0F);
     ((Path) localObject).lineTo(53.0F, 53.0F);
     ((Path) localObject).lineTo(53.0F, 100.0F);
     ((Path) localObject).lineTo(47.0F, 100.0F);
     ((Path) localObject).lineTo(47.0F, 53.0F);
     ((Path) localObject).lineTo(0.0F, 53.0F);
     ((Path) localObject).lineTo(0.0F, 47.0F);
     ((Path) localObject).lineTo(47.0F, 47.0F);
     ((Path) localObject).cubicTo(47.01F, 31.33F, 47.0F, 15.67F, 47.0F, 0.0F);
     ((Path) localObject).lineTo(47.0F, 0.0F);
     ((Path) localObject).close();
     WeChatSVGRenderC2Java.setFillType((Path) localObject, 2);
     localCanvas.drawPath((Path) localObject, localPaint);
     localCanvas.restore();
     c.f(paramVarArgs);
   }
 }
コード例 #20
0
ファイル: MyDashLine.java プロジェクト: Nodeer/NewVersion
 @Override
 protected void onDraw(Canvas canvas) {
   // TODO Auto-generated method stub
   super.onDraw(canvas);
   Paint paint = new Paint();
   paint.setStyle(Paint.Style.STROKE);
   paint.setColor(getTextColors().getDefaultColor());
   Path path = new Path();
   path.moveTo(0, getHeight() / 2);
   path.lineTo(getWidth(), getHeight() / 2);
   PathEffect effects = new DashPathEffect(new float[] {5, 5, 5, 5}, 1);
   paint.setPathEffect(effects);
   canvas.drawPath(path, paint);
 }
コード例 #21
0
 @Override
 protected void onDraw(Canvas canvas) {
   canvas.drawColor(Color.WHITE);
   for (int i = 0; i < 9; i++) {
     mPath.moveTo(0, 0 + (i * 50));
     mPath.lineTo(50, 30 + (i * 50));
     mPath.lineTo(100, 0 + (i * 50));
     mPath.lineTo(150, 30 + (i * 50));
     mPath.lineTo(200, 0 + (i * 50));
     PathEffect pe = null;
     switch (i) {
       case 0:
         pe = new CornerPathEffect(10);
         break;
       case 1:
         pe = new DashPathEffect(new float[] {10f, 3f}, phase);
         break;
       case 2:
         pe = new DiscretePathEffect(5f, 10f);
         break;
       case 3:
         pe = new PathDashPathEffect(star, 20, phase, Style.ROTATE);
         break;
       case 4:
         pe = new PathDashPathEffect(star, 20, phase, Style.MORPH);
         break;
       case 5:
         pe = new PathDashPathEffect(star, 20, phase, Style.TRANSLATE);
         break;
       case 6:
         PathEffect cpeOuter = new PathDashPathEffect(star, 20, phase, Style.MORPH);
         PathEffect cpeInner = new DiscretePathEffect(5f, 10f);
         pe = new ComposePathEffect(cpeOuter, cpeInner);
         break;
       case 7:
         PathEffect cpe1 = new PathDashPathEffect(star, 20, phase, Style.MORPH);
         PathEffect cpe2 = new DiscretePathEffect(5f, 10f);
         pe = new SumPathEffect(cpe1, cpe2);
         break;
       default:
         break;
     }
     mPaint.setPathEffect(pe);
     canvas.drawPath(mPath, mPaint);
     mPath.reset();
   }
   phase += 2;
   invalidate();
 }
コード例 #22
0
 protected final int i(int paramInt, Object... paramVarArgs) {
   switch (paramInt) {
   }
   for (; ; ) {
     return 0;
     return 28;
     return 21;
     Canvas localCanvas = (Canvas) paramVarArgs[0];
     paramVarArgs = (Looper) paramVarArgs[1];
     c.d(paramVarArgs);
     c.c(paramVarArgs);
     Paint localPaint = c.g(paramVarArgs);
     localPaint.setFlags(385);
     localPaint.setStyle(Paint.Style.FILL);
     Object localObject = c.g(paramVarArgs);
     ((Paint) localObject).setFlags(385);
     ((Paint) localObject).setStyle(Paint.Style.STROKE);
     localPaint.setColor(-16777216);
     ((Paint) localObject).setStrokeWidth(1.0F);
     ((Paint) localObject).setStrokeCap(Paint.Cap.BUTT);
     ((Paint) localObject).setStrokeJoin(Paint.Join.MITER);
     ((Paint) localObject).setStrokeMiter(4.0F);
     ((Paint) localObject).setPathEffect(null);
     c.a((Paint) localObject, paramVarArgs).setStrokeWidth(1.0F);
     localPaint = c.a(localPaint, paramVarArgs);
     localPaint.setColor(-2763307);
     localCanvas.save();
     localPaint = c.a(localPaint, paramVarArgs);
     localObject = c.h(paramVarArgs);
     ((Path) localObject).moveTo(9.740437F, 16.82034F);
     ((Path) localObject).cubicTo(15.206292F, 11.2271185F, 20.54201F, 5.501695F, 26.097961F, 0.0F);
     ((Path) localObject)
         .cubicTo(26.568466F, 0.4881356F, 27.519485F, 1.4745762F, 28.0F, 1.9728813F);
     ((Path) localObject)
         .cubicTo(22.303898F, 8.583051F, 15.887022F, 14.532204F, 10.040758F, 21.0F);
     ((Path) localObject).cubicTo(6.677154F, 18.21356F, 3.283518F, 15.488135F, 0.0F, 12.620339F);
     ((Path) localObject).lineTo(0.0F, 10.932203F);
     ((Path) localObject)
         .cubicTo(0.41043976F, 10.718644F, 1.2313193F, 10.291526F, 1.641759F, 10.088136F);
     ((Path) localObject)
         .cubicTo(4.3346443F, 12.335593F, 7.0275297F, 14.593221F, 9.740437F, 16.82034F);
     ((Path) localObject).lineTo(9.740437F, 16.82034F);
     ((Path) localObject).close();
     WeChatSVGRenderC2Java.setFillType((Path) localObject, 2);
     localCanvas.drawPath((Path) localObject, localPaint);
     localCanvas.restore();
     c.f(paramVarArgs);
   }
 }
コード例 #23
0
    @Override
    public void draw(Canvas canvas) {
      Point mapCenter = getAddPlaceCircleCenter();
      int radius = Math.min(mapCenter.x, mapCenter.y);

      Paint circlePaint = new Paint();
      circlePaint.setColor(getResources().getColor(R.color.add_place_circle));
      circlePaint.setAntiAlias(true);
      circlePaint.setStrokeWidth(STROKE_WIDTH);
      DashPathEffect dashPath = new DashPathEffect(DASH_INTERVALS, 1.0f);
      circlePaint.setPathEffect(dashPath);
      circlePaint.setStyle(Paint.Style.STROKE);
      canvas.drawCircle(
          mapCenter.x, mapCenter.y, (int) (radius * radiusMultiplier - STROKE_WIDTH), circlePaint);
    }
コード例 #24
0
ファイル: Layer.java プロジェクト: aquabluefish/GDSview
 // Stroke & Text Setting
 public boolean tSetting(Paint paint, int alpha) {
   if (scolor != code("None")) {
     paint.reset();
     paint.setColor(this.scolor);
     paint.setAlpha(alpha);
     paint.setStrokeWidth(this.width);
     if (this.effect != null) paint.setPathEffect(this.effect);
     paint.setStyle(Style.STROKE);
     // Text setting
     paint.setTextSize(gds.textsize);
     paint.setStyle(Style.FILL);
     paint.setShadowLayer(1.5f, 2f, 2f, Color.BLACK);
     return true;
   }
   return false;
 }
コード例 #25
0
ファイル: DottedLine.java プロジェクト: ZhanJohn/AG_Modules
  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    Paint paint = new Paint();
    paint.setStyle(Paint.Style.STROKE);
    paint.setColor(Color.RED);
    Path path = new Path();
    path.moveTo(0, 10);
    path.lineTo(480, 10);
    PathEffect effects = new DashPathEffect(new float[] {5, 5, 5, 5}, 1);
    paint.setPathEffect(effects);
    canvas.drawPath(path, paint);

    //        paint.setStrokeWidth((float) 1.0);              //设置线宽
    //        canvas.drawLine(50, 50, 450, 50, paint);
  }
コード例 #26
0
ファイル: VolumeView.java プロジェクト: lylyhs/Wifly_Light
  public VolumeView(Context context, AttributeSet attrib) {
    super(context, attrib);

    mVertical =
        attrib.getAttributeBooleanValue(
            "http://schemas.android.com/apk/res/android", "orientation", false);
    mColor = attrib.getAttributeIntValue(null, "color", Color.WHITE);
    mVolumeMax = attrib.getAttributeIntValue(null, "maximum_value", 100);

    mBar = new ShapeDrawable(new RectShape());
    mCover = new ShapeDrawable(new RectShape());
    mFramePath = new Path();
    mFramePaint = new Paint();
    mFramePaint.setStyle(Paint.Style.FILL_AND_STROKE);
    mFramePaint.setAntiAlias(true);
    mFramePaint.setPathEffect(new CornerPathEffect(10));
  }
コード例 #27
0
ファイル: ChartView.java プロジェクト: CrazyTT/ChartView
 /**
  * 背景画网格的横线
  *
  * @param canvas
  */
 private void drawGridLine(Canvas canvas) {
   Paint paint = new Paint();
   paint.setColor(gridLineColor);
   paint.setAntiAlias(true);
   paint.setStyle(Style.STROKE);
   paint.setStrokeWidth(gridLineSize);
   paint.setPathEffect(new DashPathEffect(new float[] {10, 20}, 0));
   for (int i = 1; i <= yNum; i++) {
     // 画网格的横线
     canvas.drawLine(
         leftPadding + yTextWidth,
         height - bottomPadding - xTextHeight - (spaceYLength * i),
         width - rightPadding,
         height - bottomPadding - xTextHeight - (spaceYLength * i),
         paint);
   }
 }
コード例 #28
0
    /** set graph line color */
    private void setPaint() {
      p = new Paint();
      p.setFlags(Paint.ANTI_ALIAS_FLAG);
      p.setAntiAlias(true); // text anti alias
      p.setFilterBitmap(true); // bitmap anti alias
      p.setColor(Color.BLUE);
      p.setStrokeWidth(3);
      p.setStyle(Style.STROKE);

      pCircle = new Paint();
      pCircle.setFlags(Paint.ANTI_ALIAS_FLAG);
      pCircle.setAntiAlias(true); // text anti alias
      pCircle.setFilterBitmap(true); // bitmap anti alias
      pCircle.setColor(Color.BLUE);
      pCircle.setStrokeWidth(3);
      pCircle.setStyle(Style.FILL_AND_STROKE);

      pLine = new Paint();
      pLine.setFlags(Paint.ANTI_ALIAS_FLAG);
      pLine.setAntiAlias(true); // text anti alias
      pLine.setFilterBitmap(true); // bitmap anti alias
      pLine.setShader(
          new LinearGradient(0, 300f, 0, 0f, Color.BLACK, Color.WHITE, Shader.TileMode.MIRROR));

      pBaseLine = new Paint();
      pBaseLine.setFlags(Paint.ANTI_ALIAS_FLAG);
      pBaseLine.setAntiAlias(true); // text anti alias
      pBaseLine.setFilterBitmap(true); // bitmap anti alias
      pBaseLine.setColor(Color.GRAY);
      pBaseLine.setStrokeWidth(3);

      pBaseLineX = new Paint();
      pBaseLineX.setFlags(Paint.ANTI_ALIAS_FLAG);
      pBaseLineX.setAntiAlias(true); // text anti alias
      pBaseLineX.setFilterBitmap(true); // bitmap anti alias
      pBaseLineX.setColor(0xffcccccc);
      pBaseLineX.setStrokeWidth(3);
      pBaseLineX.setStyle(Style.STROKE);
      pBaseLineX.setPathEffect(new DashPathEffect(new float[] {10, 5}, 0));

      pMarkText = new Paint();
      pMarkText.setFlags(Paint.ANTI_ALIAS_FLAG);
      pMarkText.setAntiAlias(true); // text anti alias
      pMarkText.setColor(Color.BLACK);
    }
コード例 #29
0
ファイル: WaveformView.java プロジェクト: jq/zhong
  public WaveformView(Context context, AttributeSet attrs) {
    super(context, attrs);

    // We don't want keys, the markers get these
    setFocusable(false);

    mGridPaint = new Paint();
    mGridPaint.setAntiAlias(false);
    mGridPaint.setColor(getResources().getColor(R.drawable.grid_line));
    mSelectedLinePaint = new Paint();
    mSelectedLinePaint.setAntiAlias(false);
    mSelectedLinePaint.setColor(getResources().getColor(R.drawable.waveform_selected));
    mUnselectedLinePaint = new Paint();
    mUnselectedLinePaint.setAntiAlias(false);
    mUnselectedLinePaint.setColor(getResources().getColor(R.drawable.waveform_unselected));
    mUnselectedBkgndLinePaint = new Paint();
    mUnselectedBkgndLinePaint.setAntiAlias(false);
    mUnselectedBkgndLinePaint.setColor(
        getResources().getColor(R.drawable.waveform_unselected_bkgnd_overlay));
    mBorderLinePaint = new Paint();
    mBorderLinePaint.setAntiAlias(true);
    mBorderLinePaint.setStrokeWidth(1.5f);
    mBorderLinePaint.setPathEffect(new DashPathEffect(new float[] {3.0f, 2.0f}, 0.0f));
    mBorderLinePaint.setColor(getResources().getColor(R.drawable.selection_border));
    mPlaybackLinePaint = new Paint();
    mPlaybackLinePaint.setAntiAlias(false);
    mPlaybackLinePaint.setColor(getResources().getColor(R.drawable.playback_indicator));
    mTimecodePaint = new Paint();
    mTimecodePaint.setAntiAlias(true);
    mTimecodePaint.setColor(getResources().getColor(R.drawable.timecode));
    mTimecodePaint.setShadowLayer(2, 1, 1, getResources().getColor(R.drawable.timecode_shadow));

    mSoundFile = null;
    mLenByZoomLevel = null;
    mValuesByZoomLevel = null;
    mHeightsAtThisZoomLevel = null;
    mOffset = 0;
    mPlaybackPos = -1;
    mSelectionStart = 0;
    mSelectionEnd = 0;
    mDensity = 1.0f;
    mInitialized = false;
  }
コード例 #30
0
  @Override
  protected void onDraw(Canvas canvas) {
    // 画标签
    canvas.drawBitmap(mLabelBitmap, mViewMatrix, null);
    if (mShowDashBorder) {
      // 画虚线框
      mDashPaint.setPathEffect(getPathEffect());
      canvas.save();
      canvas.concat(mViewMatrix);
      canvas.drawPath(mDashPath, mDashPaint);
      canvas.restore();

      // 画删除按钮:左上角
      canvas.drawBitmap(mDelBitmap, null, mDelDrawRectF, null);

      // 画拖放按钮:右下角
      canvas.drawBitmap(mDragBitmap, null, mDragDrawRectF, null);
    }
  }