public WidgetTextFrame(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
setClipChildren(false);
setClipToPadding(false);
mContext = context.getApplicationContext();
mPaddingSpace = context.getResources().getDimensionPixelSize(R.dimen.edit_text_space);
mRoundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
PathEffect effect = new DashPathEffect(new float[]{20, 20}, 1);
mRoundPaint.setAntiAlias(true);
mRoundPaint.setColor(getResources().getColor(R.color.edit_text_background_color));
mRoundPaint.setPathEffect(effect);
mRoundPaint.setStyle(Paint.Style.STROKE);
mRoundPaint.setStrokeWidth(3);
mDeletePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mDeletePaint.setAntiAlias(true);
mDeletePaint.setFilterBitmap(true);
mDeletePaint.setDither(true);
setWillNotDraw(false);
}
java类android.graphics.PathEffect的实例源码
WidgetTextFrame.java 文件源码
项目:Rotatable-Scalable-Font
阅读 28
收藏 0
点赞 0
评论 0
ReactViewBackgroundDrawable.java 文件源码
项目:RNLearn_Project1
阅读 26
收藏 0
点赞 0
评论 0
public @Nullable PathEffect getPathEffect(float borderWidth) {
switch (this) {
case SOLID:
return null;
case DASHED:
return new DashPathEffect(
new float[] {borderWidth*3, borderWidth*3, borderWidth*3, borderWidth*3}, 0);
case DOTTED:
return new DashPathEffect(
new float[] {borderWidth, borderWidth, borderWidth, borderWidth}, 0);
default:
return null;
}
}
ReactViewBackgroundDrawable.java 文件源码
项目:RNLearn_Project1
阅读 35
收藏 0
点赞 0
评论 0
public @Nullable PathEffect getPathEffect(float borderWidth) {
switch (this) {
case SOLID:
return null;
case DASHED:
return new DashPathEffect(
new float[] {borderWidth*3, borderWidth*3, borderWidth*3, borderWidth*3}, 0);
case DOTTED:
return new DashPathEffect(
new float[] {borderWidth, borderWidth, borderWidth, borderWidth}, 0);
default:
return null;
}
}
SimpleDividerItemDecorationSpec.java 文件源码
项目:gmlrva
阅读 26
收藏 0
点赞 0
评论 0
/**
* Procedure meant to set the value for {@link #mDrawnDivider} optional parameter.
* @param color the divider's target {@link Color} value.
* See {@link Paint#setColor(int)} for more information.
* @param thickness the divider's target line thickness value. This value must be greater or equal than 0.
* See {@link Paint#setStrokeWidth(float)} for more information.
* @param style the divider's target {@link Paint.Style}.
* See {@link Paint#setStyle(Paint.Style)} for more information.
* @param pathEffect the divider's target {@link PathEffect}.
* See {@link Paint#setPathEffect(PathEffect)} for more information.
* @return the same object builder object after setting the optional attribute.
*/
@NonNull
public DecorationSpecBuilder withDrawnDivider(@ColorInt int color,
@FloatRange(from = 0, fromInclusive = false) float thickness,
@Nullable final Paint.Style style,
@Nullable final PathEffect pathEffect) {
mDrawnDivider = new Paint();
mDrawnDivider.setColor(color);
mDrawnDivider.setStrokeWidth(thickness);
if (style != null) {
mDrawnDivider.setStyle(style);
}
if (pathEffect != null) {
mDrawnDivider.setPathEffect(pathEffect);
}
return this;
}
ReactViewBackgroundDrawable.java 文件源码
项目:ReactNativeSignatureExample
阅读 28
收藏 0
点赞 0
评论 0
public @Nullable PathEffect getPathEffect(float borderWidth) {
switch (this) {
case SOLID:
return null;
case DASHED:
return new DashPathEffect(
new float[] {borderWidth*3, borderWidth*3, borderWidth*3, borderWidth*3}, 0);
case DOTTED:
return new DashPathEffect(
new float[] {borderWidth, borderWidth, borderWidth, borderWidth}, 0);
default:
return null;
}
}
ReactViewBackgroundDrawable.java 文件源码
项目:react-native-ibeacon-android
阅读 22
收藏 0
点赞 0
评论 0
public @Nullable PathEffect getPathEffect(float borderWidth) {
switch (this) {
case SOLID:
return null;
case DASHED:
return new DashPathEffect(
new float[] {borderWidth*3, borderWidth*3, borderWidth*3, borderWidth*3}, 0);
case DOTTED:
return new DashPathEffect(
new float[] {borderWidth, borderWidth, borderWidth, borderWidth}, 0);
default:
return null;
}
}
ReactViewBackgroundDrawable.java 文件源码
项目:react-native-box-loaders
阅读 31
收藏 0
点赞 0
评论 0
public @Nullable PathEffect getPathEffect(float borderWidth) {
switch (this) {
case SOLID:
return null;
case DASHED:
return new DashPathEffect(
new float[] {borderWidth*3, borderWidth*3, borderWidth*3, borderWidth*3}, 0);
case DOTTED:
return new DashPathEffect(
new float[] {borderWidth, borderWidth, borderWidth, borderWidth}, 0);
default:
return null;
}
}
ReactViewBackgroundDrawable.java 文件源码
项目:Ironman
阅读 33
收藏 0
点赞 0
评论 0
public @Nullable PathEffect getPathEffect(float borderWidth) {
switch (this) {
case SOLID:
return null;
case DASHED:
return new DashPathEffect(
new float[] {borderWidth*3, borderWidth*3, borderWidth*3, borderWidth*3}, 0);
case DOTTED:
return new DashPathEffect(
new float[] {borderWidth, borderWidth, borderWidth, borderWidth}, 0);
default:
return null;
}
}
WXBackgroundDrawable.java 文件源码
项目:weex
阅读 31
收藏 0
点赞 0
评论 0
public
@Nullable
PathEffect getPathEffect(float borderWidth) {
switch (this) {
case SOLID:
return null;
case DASHED:
return new DashPathEffect(
new float[]{borderWidth * 3, borderWidth * 3, borderWidth * 3, borderWidth * 3}, 0);
case DOTTED:
return new DashPathEffect(
new float[]{borderWidth, borderWidth, borderWidth, borderWidth}, 0);
default:
return null;
}
}
LoadingButton.java 文件源码
项目:DxLoadingButton
阅读 21
收藏 0
点赞 0
评论 0
private void createFailedPath(){
if(mFailedPath != null){
mFailedPath.reset();
mFailedPath2.reset();
}else{
mFailedPath = new Path();
mFailedPath2 = new Path();
}
float left = width/2 - mRadius + mRadius/2;
float top = mRadius/2 + mPadding;
mFailedPath.moveTo(left,top);
mFailedPath.lineTo(left+mRadius,top+mRadius);
mFailedPath2.moveTo(width/2 + mRadius/2,top);
mFailedPath2.lineTo(width/2 - mRadius + mRadius/2,top+mRadius);
PathMeasure measure = new PathMeasure(mFailedPath, false);
mFailedPathLength = measure.getLength();
mFailedPathIntervals = new float[]{mFailedPathLength, mFailedPathLength};
PathEffect PathEffect = new DashPathEffect(mFailedPathIntervals, mFailedPathLength);
mPathEffectPaint2.setPathEffect(PathEffect);
}
RichPolygon.java 文件源码
项目:richmaps
阅读 28
收藏 0
点赞 0
评论 0
RichPolygon(final int zIndex,
final List<RichPoint> points,
final List<List<RichPoint>> holes,
final int strokeWidth,
final Paint.Cap strokeCap,
final Paint.Join strokeJoin,
final PathEffect pathEffect,
final MaskFilter maskFilter,
final boolean linearGradient,
final Integer strokeColor,
final boolean antialias,
final boolean closed,
final Shader strokeShader,
final Shader fillShader,
final Paint.Style style,
final Integer fillColor) {
super(zIndex, points, strokeWidth, strokeCap, strokeJoin, pathEffect, maskFilter,
strokeShader, linearGradient, strokeColor, antialias, closed);
this.fillShader = fillShader;
this.style = style;
this.fillColor = fillColor;
if (holes != null) {
addHoles(holes);
}
}
PhasePlane.java 文件源码
项目:DirectionFieldAndroid
阅读 27
收藏 0
点赞 0
评论 0
public void setPoints(ArrayList<float[]> pointsToPath){
synchronized (pointsToPath) {
this.points = pointsToPath;
float[] startPoint = convertXYToLinePoint(points.get(0));
path.moveTo(startPoint[0], startPoint[1]);
for (int i = 0; i<this.points.size(); i++) {
float[] linePoint = convertXYToLinePoint(points.get(i));
path.lineTo(linePoint[0],linePoint[1]);
}
}
pathMeasure = new PathMeasure(path, false);
pathLength = pathMeasure.getLength(); // the interpolated length of the entire path as it would be drawn on the screen in dp
PathEffect pathEffect = new PathDashPathEffect(makeConvexArrow(15.0f, 15.0f), 5.0f, 0.0f, PathDashPathEffect.Style.ROTATE);
paintSettings.setPathEffect(pathEffect);
invalidate();
}
BugView.java 文件源码
项目:Bugstick
阅读 33
收藏 0
点赞 0
评论 0
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawColor(Color.BLACK);
pathMeasure.setPath(path, false);
float length = pathMeasure.getLength();
if (length > BUG_TRAIL_DP * density) {
// Note - this is likely a poor way to accomplish the result. Just for demo purposes.
@SuppressLint("DrawAllocation")
PathEffect effect = new DashPathEffect(new float[]{length, length}, -length + BUG_TRAIL_DP * density);
paint.setPathEffect(effect);
}
paint.setStyle(Paint.Style.STROKE);
canvas.drawPath(path, paint);
paint.setStyle(Paint.Style.FILL);
canvas.drawCircle(position.x, position.y, BUG_RADIUS_DP * density, paint);
}
PathEffectsCutin.java 文件源码
项目:CUT-IN-material
阅读 26
收藏 0
点赞 0
评论 0
public SampleView(Context context) {
super(context);
setFocusable(true);
setFocusableInTouchMode(true);
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(6);
mPath = makeFollowPath();
mEffects = new PathEffect[6];
mBonds = new RectF();
mColors = new int[] { Color.BLACK, Color.RED, Color.BLUE,
Color.GREEN, Color.MAGENTA, Color.BLACK
};
}
DistanceRangeBar.java 文件源码
项目:DistanceRangeBar
阅读 26
收藏 0
点赞 0
评论 0
void draw(Canvas canvas) {
RectF rectF = new RectF(mLeftX, mY, mRightX, mY);
canvas.drawRoundRect(rectF, mBarWeight / 2, mBarWeight / 2, mBarPaint);
Path path = new Path();
path.moveTo(mLeftX + mMargin, mY);
path.lineTo(mRightX - mMargin, mY);
PathEffect effects = new DashPathEffect(new float[]{5, 5, 5, 5}, 1);
mEffectPaint.setPathEffect(effects);
canvas.drawPath(path, mEffectPaint);
}
XYChart.java 文件源码
项目:buildAPKsApps
阅读 32
收藏 0
点赞 0
评论 0
private void setStroke(Cap cap, Join join, float miter, Style style, PathEffect pathEffect,
Paint paint) {
paint.setStrokeCap(cap);
paint.setStrokeJoin(join);
paint.setStrokeMiter(miter);
paint.setPathEffect(pathEffect);
paint.setStyle(style);
}
TicketView.java 文件源码
项目:TicketView
阅读 29
收藏 0
点赞 0
评论 0
private void setDividerPaint() {
mDividerPaint.setAlpha(0);
mDividerPaint.setAntiAlias(true);
mDividerPaint.setColor(mDividerColor);
mDividerPaint.setStrokeWidth(mDividerWidth);
if(mDividerType == DividerType.DASH)
mDividerPaint.setPathEffect(new DashPathEffect(new float[]{(float) mDividerDashLength, (float) mDividerDashGap}, 0.0f));
else
mDividerPaint.setPathEffect(new PathEffect());
}
PathEffectView.java 文件源码
项目:android-study
阅读 28
收藏 0
点赞 0
评论 0
public PathEffectView(Context context, AttributeSet attrs) {
super(context, attrs);
mPaint = new Paint();
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(5);
mPaint.setColor(Color.DKGRAY);
mPath = new Path();
mPath.moveTo(0, 0);
for (int i = 0; i <= 30; i++) {
mPath.lineTo(i * 35, (float) (Math.random() * 100));
}
mEffects = new PathEffect[6];
}
DiscrollvablePathLayout.java 文件源码
项目:radiocom-android
阅读 28
收藏 0
点赞 0
评论 0
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
makeAndMeasurePath();
if (!isInEditMode()) {
// Apply the dash effect
float length = mPathMeasure.getLength();
PathEffect effect = new DashPathEffect(new float[]{length, length}, length * (1 - mRatio));
mPaint.setPathEffect(effect);
}
canvas.drawPath(mPath, mPaint);
}
HexagonDrawable.java 文件源码
项目:Tools
阅读 25
收藏 0
点赞 0
评论 0
public HexagonDrawable(@ColorInt int color, float width, float height, float padding)
{
mWidth = width;
mHeight = height;
mPadding = padding;
mLenght = width/2 - mPadding*2;
mOrigin_x = mWidth/2;
mOrigin_y = mHeight/2;
//六边形路径
mPath = new Path();
mPath.moveTo(mOrigin_x, mOrigin_y - mLenght);
mPath.lineTo((float) (mOrigin_x + Math.sqrt(3f)*mLenght/2), mOrigin_y - mLenght/2);
mPath.lineTo((float) (mOrigin_x + Math.sqrt(3f)*mLenght/2), mOrigin_y + mLenght/2);
mPath.lineTo(mOrigin_x, mOrigin_y + mLenght);
mPath.lineTo((float) (mOrigin_x - Math.sqrt(3f)*mLenght/2), mOrigin_y + mLenght/2);
mPath.lineTo((float) (mOrigin_x - Math.sqrt(3f)*mLenght/2), mOrigin_y - mLenght/2);
mPath.close();
//初始化画笔
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(color);
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mPaint.setStrokeWidth(1f);
//连线节点平滑处理
PathEffect pathEffect = new CornerPathEffect(10);
mPaint.setPathEffect(pathEffect);
}
CustomView.java 文件源码
项目:CircleProgressView
阅读 23
收藏 0
点赞 0
评论 0
@Override
protected void onDraw(final Canvas canvas) {
super.onDraw(canvas);
canvas.drawCircle(100, 100, 100, mPaint);
PathEffect pathEffect = new DashPathEffect(new float[]{10, 20}, 0);
mPaint.setStrokeWidth(100);
mPaint.setPathEffect(pathEffect);
canvas.drawLine(200, 0, 200, 200, mPaint);
}
JustContext.java 文件源码
项目:JustDraw
阅读 23
收藏 0
点赞 0
评论 0
public void setLineDash(V8Array intervals) {
float[] floatIntervals = new float[intervals.length()];
for (int i = 0; i < intervals.length(); i++) {
floatIntervals[i] = (float)((double)intervals.getDouble(i));
}
PathEffect effects = new DashPathEffect(floatIntervals, 1);
mPaintStroke.setPathEffect(effects);
intervals.release();
}
AbstractPaintSubject.java 文件源码
项目:truth-android
阅读 24
收藏 0
点赞 0
评论 0
public S hasPathEffect(PathEffect effect) {
assertThat(actual().getPathEffect())
.named("path effect")
.isSameAs(effect);
//noinspection unchecked
return (S) this;
}
BindNormalActivity.java 文件源码
项目:LazyRecyclerAdapter
阅读 25
收藏 0
点赞 0
评论 0
public void init() {
normalAdapterManager = new BindSuperAdapterManager();
normalAdapterManager
.bind(BindImageModel.class, BindImageHolder.ID, BindImageHolder.class)
.bind(BindTextModel.class, BindTextHolder.ID, BindTextHolder.class)
.bind(BindMutliModel.class, BindMutliHolder.ID, BindMutliHolder.class)
.bind(BindClickModel.class, BindClickHolder.ID, BindClickHolder.class)
.bindEmpty(BindNoDataHolder.NoDataModel.class, BindNoDataHolder.ID, BindNoDataHolder.class)
.setNeedAnimation(true)
.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(Context context, int position) {
Toast.makeText(context, "点击了!! " + position, Toast.LENGTH_SHORT).show();
}
});
adapter = new BindRecyclerAdapter(this, normalAdapterManager, datas);
recycler.setLayoutManager(new LinearLayoutManager(this));
//间隔线
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setColor(getResources().getColor(R.color.material_deep_teal_200));
PathEffect effects = new DashPathEffect(new float[]{5, 5, 5, 5}, 1);
paint.setPathEffect(effects);
paint.setStrokeWidth(dip2px(this, 5));
recycler.addItemDecoration(new BindDecorationBuilder(adapter).setPaint(paint).setSpace(dip2px(this, 5)).builder());
recycler.setAdapter(adapter);
}
SheetView.java 文件源码
项目:iOffice
阅读 27
收藏 0
点赞 0
评论 0
/**
* draw moving header line when changing header height or width
* @param canvas
*/
private void drawMovingHeaderLine(Canvas canvas)
{
if(isDrawMovingHeaderLine && selectedHeaderInfor != null)
{
Paint paint = PaintKit.instance().getPaint();
//save paint property
int oldColor = paint.getColor();
PathEffect oldPathEffect = paint.getPathEffect();
Rect clipRect = canvas.getClipBounds();
paint.setColor(Color.BLACK);
paint.setStyle(Paint.Style.STROKE);
Path path = new Path();
if(selectedHeaderInfor.getType() == FocusCell.ROWHEADER)
{
//Rect rect = ModelUtil.instance().getCellAnchor(this, selectedHeaderInfor.getRow(), 0);
path.moveTo(0, selectedHeaderInfor.getRect().bottom);
path.lineTo(clipRect.right,selectedHeaderInfor.getRect().bottom);
}
else if(selectedHeaderInfor.getType() == FocusCell.COLUMNHEADER)
{
path.moveTo(selectedHeaderInfor.getRect().right, 0);
path.lineTo(selectedHeaderInfor.getRect().right, clipRect.bottom);
}
paint.setPathEffect(effects);
canvas.drawPath(path, paint);
//restore
paint.setPathEffect(oldPathEffect);
paint.setStyle(Paint.Style.FILL);
paint.setColor(oldColor);
}
}
XYChart.java 文件源码
项目:iOffice
阅读 26
收藏 0
点赞 0
评论 0
private void setStroke(Cap cap, Join join, float miter, Style style, PathEffect pathEffect, Paint paint)
{
paint.setStrokeCap(cap);
paint.setStrokeJoin(join);
paint.setStrokeMiter(miter);
paint.setPathEffect(pathEffect);
paint.setStyle(style);
}
CustomClickAtUserSpan.java 文件源码
项目:RickText
阅读 25
收藏 0
点赞 0
评论 0
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(true);
//间隔线
ds.setStyle(Paint.Style.STROKE);
PathEffect effects = new DashPathEffect(new float[]{1, 1}, 1);
ds.setPathEffect(effects);
ds.setStrokeWidth(5);
}
CustomClickTopicSpan.java 文件源码
项目:RickText
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(true);
ds.setStyle(Paint.Style.FILL_AND_STROKE);
PathEffect effects = new DashPathEffect(new float[]{1, 1}, 1);
ds.setPathEffect(effects);
ds.setStrokeWidth(2);
}
RichShape.java 文件源码
项目:richmaps
阅读 23
收藏 0
点赞 0
评论 0
RichShape(final int zIndex,
final List<RichPoint> points,
final int strokeWidth,
final Paint.Cap strokeCap,
final Paint.Join strokeJoin,
final PathEffect pathEffect,
final MaskFilter maskFilter,
final Shader strokeShader,
final boolean linearGradient,
final Integer strokeColor,
final boolean antialias,
final boolean closed) {
this.zIndex = zIndex;
this.strokeWidth = strokeWidth;
this.strokeCap = strokeCap;
this.strokeJoin = strokeJoin;
this.pathEffect = pathEffect;
this.maskFilter = maskFilter;
this.strokeShader = strokeShader;
this.linearGradient = linearGradient;
this.strokeColor = strokeColor;
this.antialias = antialias;
this.closed = closed;
if (points != null) {
for (RichPoint point : points) {
add(point);
}
}
}
RichPolyline.java 文件源码
项目:richmaps
阅读 27
收藏 0
点赞 0
评论 0
RichPolyline(final int zIndex,
final List<RichPoint> points,
final int strokeWidth,
final Paint.Cap strokeCap,
final Paint.Join strokeJoin,
final PathEffect pathEffect,
final MaskFilter maskFilter,
final Shader strokeShader,
final boolean linearGradient,
final Integer strokeColor,
final boolean antialias,
final boolean closed) {
super(zIndex, points, strokeWidth, strokeCap, strokeJoin, pathEffect, maskFilter,
strokeShader, linearGradient, strokeColor, antialias, closed);
}