当前位置: 首页>>代码示例>>Java>>正文


Java Direction类代码示例

本文整理汇总了Java中android.graphics.Path.Direction的典型用法代码示例。如果您正苦于以下问题:Java Direction类的具体用法?Java Direction怎么用?Java Direction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Direction类属于android.graphics.Path包,在下文中一共展示了Direction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBoundsChange

import android.graphics.Path.Direction; //导入依赖的package包/类
@Override
protected void onBoundsChange(Rect bounds) {
    super.onBoundsChange(bounds);

    rimRadius = Math.min(bounds.width(), bounds.height()) / 2f - rimPaint.getStrokeWidth();
    faceRadius = rimRadius - rimPaint.getStrokeWidth();
    screwRadius = rimPaint.getStrokeWidth() * 2;
    float hourHandLength = (float) (0.5 * faceRadius);
    float minuteHandLength = (float) (0.7 * faceRadius);
    float top = bounds.centerY() - screwRadius;

    hourHandPath.reset();
    hourHandPath.moveTo(bounds.centerX(), bounds.centerY());
    hourHandPath.addRect(bounds.centerX(), top, bounds.centerX(), top - hourHandLength, Direction.CCW);
    hourHandPath.close();

    minuteHandPath.reset();
    minuteHandPath.moveTo(bounds.centerX(), bounds.centerY());
    minuteHandPath.addRect(bounds.centerX(), top, bounds.centerX(), top - minuteHandLength, Direction.CCW);
    minuteHandPath.close();
}
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:22,代码来源:ClockDrawable.java

示例2: setupCropBounds

import android.graphics.Path.Direction; //导入依赖的package包/类
public void setupCropBounds() {
    int height = (int) (((float) this.mThisWidth) / this.mTargetAspectRatio);
    int halfDiff;
    if (height > this.mThisHeight) {
        int width = (int) (((float) this.mThisHeight) * this.mTargetAspectRatio);
        halfDiff = (this.mThisWidth - width) / 2;
        this.mCropViewRect.set((float) (getPaddingLeft() + halfDiff), (float) getPaddingTop()
                , (float) ((getPaddingLeft() + width) + halfDiff), (float) (getPaddingTop() +
                        this.mThisHeight));
    } else {
        halfDiff = (this.mThisHeight - height) / 2;
        this.mCropViewRect.set((float) getPaddingLeft(), (float) (getPaddingTop() + halfDiff)
                , (float) (getPaddingLeft() + this.mThisWidth), (float) ((getPaddingTop() +
                        height) + halfDiff));
    }
    this.mGridPoints = null;
    this.mCircularPath.reset();
    this.mCircularPath.addOval(this.mCropViewRect, Direction.CW);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:OverlayView.java

示例3: draw

import android.graphics.Path.Direction; //导入依赖的package包/类
public void draw(Canvas canvas) {
    boolean positionChanged = adapterPositionChanged();
    if (this.rippleOverlay) {
        if (!positionChanged) {
            this.rippleBackground.draw(canvas);
        }
        super.draw(canvas);
        if (!positionChanged) {
            if (this.rippleRoundedCorners != 0.0f) {
                Path clipPath = new Path();
                clipPath.addRoundRect(new RectF(0.0f, 0.0f, (float) canvas.getWidth(), (float) canvas.getHeight()), this.rippleRoundedCorners, this.rippleRoundedCorners, Direction.CW);
                canvas.clipPath(clipPath);
            }
            canvas.drawCircle((float) this.currentCoords.x, (float) this.currentCoords.y, this.radius, this.paint);
            return;
        }
        return;
    }
    if (!positionChanged) {
        this.rippleBackground.draw(canvas);
        canvas.drawCircle((float) this.currentCoords.x, (float) this.currentCoords.y, this.radius, this.paint);
    }
    super.draw(canvas);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:MaterialRippleLayout.java

示例4: drawOutSideText

import android.graphics.Path.Direction; //导入依赖的package包/类
private void drawOutSideText(Canvas canvas) {
    Paint textPaint = new Paint();
    textPaint.setColor(this.mNormalGray);
    textPaint.setAntiAlias(true);
    textPaint.setTextSize(getResources().getDimension(R.dimen.out_indicator_size));
    int radius = getViewRadius() - this.mDividerWidth;
    Path path = new Path();
    path.addCircle((float) getCenterX(), (float) getCenterY(), (float) radius, Direction.CW);
    if (this.mDividerIndicator.size() != 0) {
        String content = BaseCircle.formatNumber(this.mStartIndicator);
        canvas.drawTextOnPath(content, path, ViewUtils.getCirclePathLength((float) radius,
                135.0f) - ((float) (ViewUtils.getTextWidth(textPaint, content) / 2)), 0.0f,
                textPaint);
        float perAngle = 270.0f / (this.mEndIndicator - this.mStartIndicator);
        for (IndicatorItem item : this.mDividerIndicator) {
            content = BaseCircle.formatNumber(item.end);
            canvas.drawTextOnPath(content, path, ViewUtils.getCirclePathLength((float)
                    radius, ((item.end - this.mStartIndicator) * perAngle) + 135.0f) - (
                    (float) (ViewUtils.getTextWidth(textPaint, content) / 2)), 0.0f, textPaint);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:CircleIndicator.java

示例5: updatePath

import android.graphics.Path.Direction; //导入依赖的package包/类
private void updatePath(final int w, final int h) {
    final float maxAbsSize = Math.min(w, h) / 2f;
    final float absSize = size < maxSize ? maxAbsSize * size / maxSize : maxAbsSize - 1;

    path.reset();

    if (progress == 0) {
        path.close();
    } else if (progress < maxProgress) {
        final float angle = progress * 360 / maxProgress;
        final float x = w / 2f;
        final float y = h / 2f;

        path.moveTo(x, y);
        path.arcTo(new RectF(x - absSize, y - absSize, x + absSize, y + absSize), 270, angle);
        path.close();
    } else {
        path.addCircle(w / 2f, h / 2f, absSize, Direction.CW);
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:21,代码来源:CircularProgressView.java

示例6: onBoundsChange

import android.graphics.Path.Direction; //导入依赖的package包/类
@Override
protected void onBoundsChange(Rect bounds) {		
	if(mBackgroundDrawable != null)
		mBackgroundDrawable.setBounds(bounds);
	
	mBackgroundBounds.set(bounds.left + mMask.left, bounds.top + mMask.top, bounds.right - mMask.right, bounds.bottom - mMask.bottom);
	mBackground.reset();
	
	switch (mMask.type) {
		case Mask.TYPE_OVAL:
			mBackground.addOval(mBackgroundBounds, Direction.CW);
			break;
		case Mask.TYPE_RECTANGLE:
			mBackground.addRoundRect(mBackgroundBounds, mMask.cornerRadius, Direction.CW);
			break;
	}
}
 
开发者ID:XhinLiang,项目名称:MDPreference,代码行数:18,代码来源:RippleDrawable.java

示例7: getFunnelPath

import android.graphics.Path.Direction; //导入依赖的package包/类
private static Path getFunnelPath(AutoShape shape, Rect rect)
{
    float width = 716f;
    float height = 536f;
    path.addOval(new RectF(28, 22, 688, 238), Direction.CCW);
    
    path.moveTo(0, 130);            
    path.arcTo(new RectF(0, 0, 716, 260), 180, 180);
    path.arcTo(new RectF(258, 444, 458, 536), 30, 150);
    path.close();
    
    sm.reset();
    sm.postScale(rect.width() / width, rect.height() / height);
    path.transform(sm);
    
    path.offset(rect.left, rect.top);
    
    return path;
}
 
开发者ID:iOffice1,项目名称:iOffice,代码行数:20,代码来源:SmartArtPathBuilder.java

示例8: getFramePath

import android.graphics.Path.Direction; //导入依赖的package包/类
private static Path getFramePath(AutoShape shape, Rect rect)
{
    float x = Math.min(rect.height(), rect.width()) * 0.1f;
    Float[] values = shape.getAdjustData();
    if (values != null && values.length >= 1)
    {
        if (values[0] != null)
        {
            x = Math.min(rect.height(), rect.width()) * values[0];
        }
    }
    
    rectF.set(rect.left, rect.top, rect.right, rect.bottom);
    path.addRect(rectF, Path.Direction.CW);
    rectF.set(rect.left + x, rect.top + x, rect.right - x, rect.bottom - x);
    path.addRect(rectF, Path.Direction.CCW);
    
    return path;
}
 
开发者ID:iOffice1,项目名称:iOffice,代码行数:20,代码来源:BaseShapePathBuilder.java

示例9: updatePath

import android.graphics.Path.Direction; //导入依赖的package包/类
private void updatePath(final int w, final int h)
{
    final float maxAbsSize = Math.min(w, h) / 2f;
    final float absSize = size < maxSize ? maxAbsSize * size / maxSize : maxAbsSize - 1;

    path.reset();

    if (progress == 0)
    {
        path.close();
    }
    else if (progress < maxProgress)
    {
        final float angle = progress * 360 / maxProgress;
        final float x = w / 2f;
        final float y = h / 2f;

        path.moveTo(x, y);
        path.arcTo(new RectF(x - absSize, y - absSize, x + absSize, y + absSize), 270, angle);
        path.close();
    }
    else
    {
        path.addCircle(w / 2f, h / 2f, absSize, Direction.CW);
    }
}
 
开发者ID:soapboxsys,项目名称:ombuds-android,代码行数:27,代码来源:CircularProgressView.java

示例10: setBitmap

import android.graphics.Path.Direction; //导入依赖的package包/类
/**
 * Sets the bitmap to be used for the zoomed view.
 */
public void setBitmap(Bitmap bitmap) {
    if (mZoomedBitmap != null) {
        mZoomedBitmap.recycle();
        mZoomedBitmap = null;
    }
    mZoomedBitmap = bitmap;

    // Round the corners of the bitmap so it doesn't stick out around the overlay.
    Canvas canvas = new Canvas(mZoomedBitmap);
    Path path = new Path();
    RectF canvasRect = new RectF(0, 0, canvas.getWidth(), canvas.getHeight());
    float overlayCornerRadius = getOverlayCornerRadius(getContext());
    path.addRoundRect(canvasRect, overlayCornerRadius, overlayCornerRadius, Direction.CCW);
    canvas.clipPath(path, Op.XOR);
    Paint clearPaint = new Paint();
    clearPaint.setXfermode(new PorterDuffXfermode(Mode.SRC));
    clearPaint.setColor(Color.TRANSPARENT);
    canvas.drawPaint(clearPaint);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:23,代码来源:PopupZoomer.java

示例11: onBoundsChange

import android.graphics.Path.Direction; //导入依赖的package包/类
@Override
protected void onBoundsChange(Rect bounds) {
  if(mBackgroundDrawable != null)
    mBackgroundDrawable.setBounds(bounds);

  mBackgroundBounds.set(bounds.left + mMask.left, bounds.top + mMask.top, bounds.right - mMask.right, bounds.bottom - mMask.bottom);
  mBackground.reset();

  switch (mMask.type) {
    case Mask.TYPE_OVAL:
      mBackground.addOval(mBackgroundBounds, Direction.CW);
      break;
    case Mask.TYPE_RECTANGLE:
      mBackground.addRoundRect(mBackgroundBounds, mMask.cornerRadius, Direction.CW);
      break;
  }
}
 
开发者ID:ppamorim,项目名称:Bound,代码行数:18,代码来源:RippleDrawable.java

示例12: updatePath

import android.graphics.Path.Direction; //导入依赖的package包/类
private void updatePath(final int w, final int h) {
	final float maxAbsSize = Math.min(w, h) / 2f;
	final float absSize = size < maxSize ? maxAbsSize * size / maxSize
			: maxAbsSize - 1;

	path.reset();

	if (progress == 0) {
		path.close();
	} else if (progress < maxProgress) {
		final float angle = progress * 360 / maxProgress;
		final float x = w / 2f;
		final float y = h / 2f;

		path.moveTo(x, y);
		path.arcTo(new RectF(x - absSize, y - absSize, x + absSize, y
				+ absSize), 270, angle);
		path.close();
	} else {
		path.addCircle(w / 2f, h / 2f, absSize, Direction.CW);
	}
}
 
开发者ID:bither,项目名称:bither-android,代码行数:23,代码来源:CircularProgressView.java

示例13: onDraw

import android.graphics.Path.Direction; //导入依赖的package包/类
@Override
    protected void onDraw(Canvas canvas) {
        float borderWidth = this.borderWidth;
        float roundWidth = this.roundWidth;
        if (borderWidth < 0) {
            borderWidth = ( getWidth() + getHeight() ) * .02f;
        }
        paint.setStrokeWidth( borderWidth );
        if (roundWidth < 0) {
            roundWidth = borderWidth * 2;
        }

        drawPath.reset();
//        drawRect.set( 0 + roundWidth / 2, 0 + roundWidth / 2, getWidth() - roundWidth / 2, getHeight() - roundWidth / 2 );
        drawRect.set( 0 + borderWidth / 2, 0 + borderWidth / 2, getWidth() - borderWidth / 2, getHeight() - borderWidth / 2 );
        drawPath.addRoundRect( drawRect, roundWidth, roundWidth, Direction.CCW );

        canvas.save();
        canvas.clipPath( drawPath );
        super.onDraw( canvas );
        canvas.restore();

        canvas.drawRoundRect( drawRect, roundWidth, roundWidth, paint );
    }
 
开发者ID:asxhl2007,项目名称:RoundedImageView,代码行数:25,代码来源:RoundedImageView.java

示例14: onDraw

import android.graphics.Path.Direction; //导入依赖的package包/类
@Override
        public void onDraw(Canvas canvas) {
            if (mCenter == null) {
                mCenter = new Point(getWidth()/2, getHeight()/2);
            }
            canvas.drawColor(Color.CYAN);
            float left = mCenter.x;
            float top = mCenter.y;
            float radius = 200;
            Path p = new Path();
            p.addRect(left, top, left+radius, top+radius, Direction.CW);
            p.addCircle(mCenter.x, mCenter.y, radius, Direction.CW);
            p.lineTo(mCenter.x + 2*radius, mCenter.y+2*radius);
            p.close();
            Paint paint = new Paint();
            paint.setColor(Color.RED);
            paint.setAntiAlias(true);
//            paint.setStyle(Style.FILL_AND_STROKE);
            canvas.drawPath(p, paint);
        }
 
开发者ID:alexhilton,项目名称:EffectiveAndroid,代码行数:21,代码来源:DrawPathDemoActivity.java

示例15: updatePath

import android.graphics.Path.Direction; //导入依赖的package包/类
private void updatePath(final int w, final int h)
{
	final float maxAbsSize = Math.min(w, h) / 2f;
	final float absSize = size < maxSize ? maxAbsSize * size / maxSize : maxAbsSize - 1;

	path.reset();

	if (progress == 0)
	{
		path.close();
	}
	else if (progress < maxProgress)
	{
		final float angle = progress * 360 / maxProgress;
		final float x = w / 2f;
		final float y = h / 2f;

		path.moveTo(x, y);
		path.arcTo(new RectF(x - absSize, y - absSize, x + absSize, y + absSize), 270, angle);
		path.close();
	}
	else
	{
		path.addCircle(w / 2f, h / 2f, absSize, Direction.CW);
	}
}
 
开发者ID:9cat,项目名称:templecoin-android-wallet,代码行数:27,代码来源:CircularProgressView.java


注:本文中的android.graphics.Path.Direction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。