项目:LaunchEnr
文件:PopupContainerWithArrow.java
/**
* Adds an arrow view pointing at the original icon.
* @param horizontalOffset the horizontal offset of the arrow,so that it
* points at the center of the original icon
*/
private View addArrowView(int horizontalOffset,int verticalOffset,int width,int height) {
LayoutParams layoutParams = new LayoutParams(width,height);
if (mIsLeftAligned) {
layoutParams.gravity = Gravity.START;
layoutParams.leftMargin = horizontalOffset;
} else {
layoutParams.gravity = Gravity.END;
layoutParams.rightMargin = horizontalOffset;
}
if (mIsAboveIcon) {
layoutParams.topMargin = verticalOffset;
} else {
layoutParams.bottomMargin = verticalOffset;
}
View arrowView = new View(getContext());
if (Gravity.isvertical(((FrameLayout.LayoutParams) getLayoutParams()).gravity)) {
// This is only true if there wasn't room for the container next to the icon,// so we centered it instead. In that case we don't want to show the arrow.
arrowView.setVisibility(INVISIBLE);
} else {
ShapeDrawable arrowDrawable = new ShapeDrawable(TriangleShape.create(
width,height,!mIsAboveIcon));
Paint arrowPaint = arrowDrawable.getPaint();
// Note that we have to use getChildAt() instead of getItemViewAt(),// since the latter expects the arrow which hasn't been added yet.
PopupItemView itemAttachedToArrow = (PopupItemView)
(getChildAt(mIsAboveIcon ? getChildCount() - 1 : 0));
arrowPaint.setColor(itemAttachedToArrow.getArrowColor(mIsAboveIcon));
// The corner path effect won't be reflected in the shadow,but shouldn't be noticeable.
int radius = getResources().getDimensionPixelSize(R.dimen.popup_arrow_corner_radius);
arrowPaint.setPathEffect(new CornerPathEffect(radius));
arrowView.setBackground(arrowDrawable);
arrowView.setElevation(getElevation());
}
addView(arrowView,mIsAboveIcon ? getChildCount() : 0,layoutParams);
return arrowView;
}
项目:CurveView
文件:CurveView.java
private void init() {
mCornerPathEffect = new CornerPathEffect(mCorner);
mContentPaint = new Paint();
mContentPaint.setStyle(Paint.Style.stroke);
mContentPaint.setColor(mContentColor);
mContentPaint.setstrokeWidth(mstrokeWidth);
mContentPaint.setPathEffect(mCornerPathEffect);
mBackgroundPaint = new Paint();
// mBackgroundPaint.setColor(mFillColor);
mXAxisPaint = new TextPaint();
mXAxisPaint.setColor(mAxisTextColor);
mXAxisPaint.setTextSize(mAxisTextSize);
mDottextPaint = new TextPaint();
mDottextPaint.setColor(mDottextColor);
mDottextPaint.setTextSize(mDottextSize);
mContentPath = new Path();
// mMaxVeLocity = ViewConfiguration.get(getContext()).getScaledMaximumFlingVeLocity();
mMaxVeLocity = 3000;
}
项目:FlowLine
文件:FlowLineView.java
private void init() {
CornerPathEffect cpe = new CornerPathEffect(20);
mPaint.setColor(Color.RED);
mPaint.setstrokeWidth(5);
mPaint.setAntiAlias(false);
mPaint.setStyle(Paint.Style.stroke);
mPaint.setPathEffect(cpe);
// mPaint.setPathEffect(new DashPathEffect(new float[]{10,10},0));
// mPaint.setPathEffect(new discretePathEffect(3.0f,5.0f));
// Path path = new Path();
// path.addCircle(0,3,Path.Direction.ccw);
// PathEffect pathEffect = new PathDashPathEffect(path,12,PathDashPathEffect.Style.ROTATE);
// mPaint.setPathEffect(pathEffect);
mBitmapPaint.setstrokeWidth(3);
mBitmapPaint.setAntiAlias(true);
mBitmapPaint.setStyle(Paint.Style.stroke);
mBitmapPaint.setPathEffect(cpe);
makepolygon(new RectF(50,50,450,450),mPath,6);
makepolygon(new RectF(75,75,425,425),mInnerPath,6);
mBitmap = Bitmap.createBitmap(500,500,Bitmap.Config.ARGB_8888);
mBitmapCanvas = new Canvas(mBitmap);
}
项目:android-study
文件:PathEffectView.java
@Override protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//无效果
mEffects[0] = null;
//拐角处变得圆滑
mEffects[1] = new CornerPathEffect(30);
//线段上就会产生许多杂点
mEffects[2] = new discretePathEffect(3.0F,5.0F);
//绘制虚线
mEffects[3] = new DashPathEffect(new float[] { 20,10,5,10 },0);
Path path = new Path();
path.addRect(0,8,Path.Direction.ccw);
//设置点的图形,即方形点的虚线,圆形点的虚线
mEffects[4] = new PathDashPathEffect(path,PathDashPathEffect.Style.ROTATE);
//组合PathEffect
mEffects[5] = new ComposePathEffect(mEffects[3],mEffects[1]);
for (int i = 0; i < mEffects.length; i++) {
mPaint.setPathEffect(mEffects[i]);
canvas.drawPath(mPath,mPaint);
canvas.translate(0,200);
}
}
项目:coinblesk-client-gui
文件:AuthenticationView.java
public AuthenticationView(Context context,byte[] key) {
super(context);
byte[] digest = new byte[0];
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.update(key);
digest = messageDigest.digest();
} catch (NoSuchAlgorithmException e) {
Log.w(TAG,"MessageDigest algorithm not found.");
}
this.digest = digest;
this.dotPaint.setColor(getContext().getResources().getColor(R.color.colorPrimaryDark));
this.dotPaint.setAntiAlias(true);
this.dotPaint.setStyle(Paint.Style.FILL);
this.patternPaint.setColor(Color.GREEN);
this.patternPaint.setAntiAlias(true);
this.patternPaint.setStyle(Paint.Style.FILL);
this.patternPaint.setstrokeJoin(Paint.Join.ROUND); // set the join to round you want
this.patternPaint.setstrokeCap(Paint.Cap.ROUND); // set the paint cap to round too
this.patternPaint.setPathEffect(new CornerPathEffect(10));
this.patternPaint.setDither(true);
}
项目:LiteSDK
文件:ViewPagerIndicator.java
public ViewPagerIndicator(Context context,AttributeSet attrs) {
super(context,attrs);
// 初始化画笔
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
mPaint.setStyle(Style.FILL);
mPaint.setPathEffect(new CornerPathEffect(3));
mLinePaint = new Paint();
mLinePaint.setAntiAlias(true);
mLinePaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
mLinePaint.setStyle(Style.FILL);
mLinePaint.setstrokeWidth(10);
mDividerLinePaint = new Paint();
mDividerLinePaint.setAntiAlias(true);
mDividerLinePaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
mDividerLinePaint.setStyle(Style.FILL);
mDividerLinePaint.setstrokeWidth(5);
}
项目:OverWatchLoading
文件:OWLoadingView.java
@Override
protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec,heightMeasureSpec);
viewHeight = getMeasuredHeight();
viewWidth = getMeasuredWidth();
if (viewWidth != 0 && viewHeight != 0) {
center.x = viewWidth / 2f;
center.y = viewHeight / 2f;
float spaceRate = 1 / 100f;
space = viewWidth <= viewHeight ? viewWidth * spaceRate : viewHeight * spaceRate;
hexagonRadius = (float) ((viewWidth - 2 * space) / (3 * Math.sqrt(3)));
initHexagonCenters();
//圆角处理
paint.setPathEffect(new CornerPathEffect(hexagonRadius * 0.1f));
baseDataInited = true;
}
}
项目:ViewPageIndicator-underline
文件:ViewPagerIndicator.java
public ViewPagerIndicator(Context context,AttributeSet attrs)
{
super(context,attrs);
// 获得自定义属性,tab的数量
TypedArray a = context.obtainStyledAttributes(attrs,R.styleable.ViewPagerIndicator);
mTabVisibleCount = a.getInt(R.styleable.ViewPagerIndicator_item_count,COUNT_DEFAULT_TAB);
if (mTabVisibleCount < 0)
mTabVisibleCount = COUNT_DEFAULT_TAB;
a.recycle();
// 初始化画笔
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(Color.parseColor("#ffFD7580"));
mPaint.setStyle(Style.FILL);
mPaint.setPathEffect(new CornerPathEffect(3));
}
项目:BackgroundView
文件:LeafView.java
private void init() {
mPaint = new Paint();
// 绘制贝塞尔曲线
mPaint.setColor(mColor);
mPaint.setstrokeWidth(8);
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mPaint.setStyle(Paint.Style.FILL);
mPaint.setTextSize(60);
mPaint.setPathEffect(new CornerPathEffect(4));
for (int i = 0; i < mData.length; i++) {
mData[i] = new PointF();
}
for (int i = 0; i < mCtrl.length; i++) {
mCtrl[i] = new PointF();
}
}
项目:BackgroundView
文件:MountainView.java
private void init() {
mPaint = new Paint();
// 绘制贝塞尔曲线
mPaint.setColor(mColor);
mPaint.setstrokeWidth(8);
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mPaint.setStyle(Paint.Style.FILL);
mPaint.setTextSize(60);
mPaint.setPathEffect(new CornerPathEffect(4));
for (int i = 0; i < mData.length; i++) {
mData[i] = new PointF();
}
for (int i = 0; i < mCtrl.length; i++) {
mCtrl[i] = new PointF();
}
}
项目:smart-farmer-android
文件:ViewPagerIndicator.java
public ViewPagerIndicator(Context context,COUNT_DEFAULT_TAB);
if (mTabVisibleCount < 0)
mTabVisibleCount = COUNT_DEFAULT_TAB;
a.recycle();
// 初始化画笔
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(Color.parseColor("#ffffffff"));
mPaint.setStyle(Style.FILL);
mPaint.setPathEffect(new CornerPathEffect(3));
}
protected CiPaint assignPaint() {
CiPaint paint = new CiPaint(drawingContext.getPaint());
paint.setStyle(Paint.Style.stroke);
paint.setAntiAlias(true);
paint.setstrokeJoin(Paint.Join.ROUND);
paint.setstrokeCap(Paint.Cap.ROUND);
if (smoothRadius > 0) {
CornerPathEffect effect = new CornerPathEffect(smoothRadius);
if (paint.getPathEffect() == null) {
paint.setPathEffect(effect);
} else {
ComposePathEffect composeEffect = new ComposePathEffect(paint.getPathEffect(),effect);
paint.setPathEffect(composeEffect);
}
}
return paint;
}
项目:stickynavlayout
文件:ViewPagerIndicator.java
public ViewPagerIndicator(Context context,AttributeSet attrs,int defStyleAttr) {
super(context,attrs,defStyleAttr);
screenWidth = getScreenWidth(context);
DIMENSION_TRIANGEL_WIDTH = (int) (screenWidth / 3 * RAdio_TRIANGEL);
TypedArray a = context.obtainStyledAttributes(attrs,COUNT_DEFAULT_TAB);
if (mTabVisibleCount < 0)
mTabVisibleCount = COUNT_DEFAULT_TAB;
a.recycle();
// 初始化画笔
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(Color.parseColor("#ffffffff"));
mPaint.setStyle(Paint.Style.FILL);
mPaint.setPathEffect(new CornerPathEffect(3));
}
项目:GOpenSource_AppKit_Android_AS
文件:ViewPagerIndicator.java
public ViewPagerIndicator(Context context,attrs);
// 获得自定义属性,tab的数量
mTabVisibleCount = 2;
if (mTabVisibleCount < 0)
mTabVisibleCount = COUNT_DEFAULT_TAB;
// 初始化画笔
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(Color.parseColor("#ffff9a23"));
mPaint.setColor(getContext().getResources().getColor(R.color.yellow));
mPaint.setStyle(Style.FILL);
mPaint.setPathEffect(new CornerPathEffect(3));
}
项目:GizOpenSource_AppKit_Android
文件:ViewPagerIndicator.java
public ViewPagerIndicator(Context context,attrs);
// 获得自定义属性,tab的数量
mTabVisibleCount = 2;
if (mTabVisibleCount < 0)
mTabVisibleCount = COUNT_DEFAULT_TAB;
// 初始化画笔
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(Color.parseColor("#ffff9a23"));
mPaint.setColor(getContext().getResources().getColor(R.color.yellow));
mPaint.setStyle(Style.FILL);
mPaint.setPathEffect(new CornerPathEffect(3));
}
项目:toshi-android-client
文件:FramedViewfinderView.java
private void initPathIfNeeded() {
if (this.pathPaint != null) {
return;
}
final Rect frame = super.framingRect;
final float radius = 25.0f;
final int strokeWidth = 10;
final int offset = strokeWidth / 2;
this.pathPaint = new Paint();
this.pathPaint.setColor(Color.WHITE);
this.pathPaint.setstrokeWidth(strokeWidth);
this.pathPaint.setStyle(Paint.Style.stroke);
this.path = new Path();
this.path.moveto(frame.left + radius,frame.top - offset);
this.path.lineto(frame.left + frame.width() + offset,frame.top + frame.height() + offset);
this.path.lineto(frame.left - offset,frame.top - offset);
this.path.lineto(frame.left + frame.width() - radius,frame.top - offset);
final CornerPathEffect cornerPathEffect = new CornerPathEffect(radius);
this.pathPaint.setPathEffect(cornerPathEffect);
}
项目:LoadingView-OverWatch
文件:OverWatchViewItem.java
public OverWatchViewItem(OverWatchLoadingView loadingView,PointF centerPoint,int length) {
this.mloadingView = loadingView;
mCenterPoint = centerPoint;
mPaint = new Paint();
mPaint.setColor(mloadingView.color);
mPaint.setstrokeWidth(3);
mPaint.setAlpha(0);
CornerPathEffect corEffect = new CornerPathEffect(length / CORNER_PATH_EFFECT_SCALE);
mPaint.setPathEffect(corEffect);
PointF[] points = getHexagonPoints(centerPoint,length);
mPath = new Path();
mPath.moveto(points[1].x,points[1].y);
mPath.lineto(points[2].x,points[2].y);
mPath.lineto(points[3].x,points[3].y);
mPath.lineto(points[4].x,points[4].y);
mPath.lineto(points[5].x,points[5].y);
mPath.lineto(points[6].x,points[6].y);
mPath.close();
initinitAnimation();
}
项目:zone-sdk
文件:SimpleDraw.java
private void initView() {
mHolder = getHolder();
mHolder.addCallback(this);
setFocusable(true);
setFocusableInTouchMode(true);
this.setKeepScreenOn(true);
mPath = new Path();
mPaint = new Paint();
mPaint.setColor(Color.RED);
mPaint.setStyle(Paint.Style.stroke);
mPaint.setstrokeWidth(20);
mPaint.setDither(true);
mPaint.setAntiAlias(true);
mPaint.setstrokeCap(Paint.Cap.ROUND);
mPaint.setstrokeJoin(Paint.Join.ROUND);
mPaint.setPathEffect(new CornerPathEffect(10));
}
public ViewPagerIndicator(Context context,attrs);
// 初始化画笔
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
mPaint.setStyle(Style.FILL);
mPaint.setPathEffect(new CornerPathEffect(3));
mLinePaint = new Paint();
mLinePaint.setAntiAlias(true);
mLinePaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
mLinePaint.setStyle(Style.FILL);
mLinePaint.setstrokeWidth(10);
mDividerLinePaint = new Paint();
mDividerLinePaint.setAntiAlias(true);
mDividerLinePaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
mDividerLinePaint.setStyle(Style.FILL);
mDividerLinePaint.setstrokeWidth(5);
}
项目:FBreader
文件:ZLAndroidPaintContext.java
ZLAndroidPaintContext(Canvas canvas,int height,int scrollbarWidth) {
myCanvas = canvas;
myWidth = width - scrollbarWidth;
myHeight = height;
myScrollbarWidth = scrollbarWidth;
myTextPaint.setLinearText(false);
myTextPaint.setAntiAlias(AntiAliasOption.getValue());
if (DeviceKerningOption.getValue()) {
myTextPaint.setFlags(myTextPaint.getFlags() | Paint.DEV_KERN_TEXT_FLAG);
} else {
myTextPaint.setFlags(myTextPaint.getFlags() & ~Paint.DEV_KERN_TEXT_FLAG);
}
myTextPaint.setDither(DitheringOption.getValue());
myTextPaint.setSubpixelText(SubpixelOption.getValue());
myLinePaint.setStyle(Paint.Style.stroke);
myOutlinePaint.setColor(Color.rgb(255,127,0));
myOutlinePaint.setAntiAlias(true);
myOutlinePaint.setDither(true);
myOutlinePaint.setstrokeWidth(4);
myOutlinePaint.setStyle(Paint.Style.stroke);
myOutlinePaint.setPathEffect(new CornerPathEffect(5));
myOutlinePaint.setMaskFilter(new embossMaskFilter(new float[] {1,1,1},.4f,6f,3.5f));
}
项目:AndroidExerciseProgram
文件:ECGView.java
public ECGView(Context context,AttributeSet set) {
super(context,set);
setLayerType(LAYER_TYPE_SOFTWARE,null);
/*
* 实例化画笔并设置属性
*/
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
mPaint.setColor(Color.GREEN);
mPaint.setstrokeWidth(5);
mPaint.setstrokeCap(Paint.Cap.ROUND);
mPaint.setstrokeJoin(Paint.Join.ROUND);
mPaint.setStyle(Paint.Style.stroke);
// 绘制的图形添加一个阴影层效果
mPaint.setShadowLayer(7,Color.GREEN);
// CornerPathEffect、discretePathEffect、DashPathEffect、PathDashPathEffect、ComposePathEffect、SumPathEffect
mPaint.setPathEffect(new CornerPathEffect(5));
mPath = new Path();
transX = 0;
isCanvasMove = false;
}
项目:AndroidGeek
文件:ViewPagerIndicator.java
public ViewPagerIndicator(Context context,attrs);
// 初始化画笔
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
mPaint.setStyle(Style.FILL);
mPaint.setPathEffect(new CornerPathEffect(3));
mLinePaint = new Paint();
mLinePaint.setAntiAlias(true);
mLinePaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
mLinePaint.setStyle(Style.FILL);
mLinePaint.setstrokeWidth(10);
mDividerLinePaint = new Paint();
mDividerLinePaint.setAntiAlias(true);
mDividerLinePaint.setColor(COLOR_TEXT_HIGHLIGHTCOLOR);
mDividerLinePaint.setStyle(Style.FILL);
mDividerLinePaint.setstrokeWidth(5);
}
项目:ametro
文件:SegmentElement.java
private Paint createPaint(int color,float linewidth,boolean isWorking){
Paint paint = new Paint();
paint.setStyle(Style.stroke);
paint.setAntiAlias(true);
paint.setColor(color);
if (isWorking) {
paint.setstrokeWidth(linewidth);
paint.setPathEffect(
new CornerPathEffect(linewidth * 0.2f));
} else {
paint.setstrokeWidth(linewidth * 0.75f);
paint.setPathEffect(new ComposePathEffect(
new DashPathEffect(new float[]{linewidth * 0.8f,linewidth * 0.2f},0),new CornerPathEffect(linewidth * 0.2f)
));
}
return paint;
}
项目:Android-ViewPagerIndicator
文件:ViewPagerIndicator.java
public ViewPagerIndicator(Context context,attrs);
// 获取可见Tab的数量
TypedArray a = context.obtainStyledAttributes(attrs,R.styleable.ViewPagerIndicator);
mTabVisibleCount = a.getInt(
R.styleable.ViewPagerIndicator_visible_tab_count,COUNT_DEFAULT_TAB);
if (mTabVisibleCount < 0)
{
mTabVisibleCount = COUNT_DEFAULT_TAB;
}
a.recycle();
// 初始化画笔
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(Color.parseColor("#ffffffff"));
mPaint.setStyle(Style.FILL);
mPaint.setPathEffect(new CornerPathEffect(3));
}
项目:androidsamples
文件:ViewPagerIndicator.java
public ViewPagerIndicator(Context context,COUNT_DEFAULT_TAB);
if (mTabVisibleCount < 0)
mTabVisibleCount = COUNT_DEFAULT_TAB;
a.recycle();
// 初始化画笔
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(Color.parseColor("#ffffffff"));
mPaint.setStyle(Style.FILL);
mPaint.setPathEffect(new CornerPathEffect(3));
}
项目:Analog-Tachometer
文件:Tachometer.java
private void drawMainIndicators(Canvas c) {
mBasePaint.setstrokeWidth(15);
mBasePaint.setStyle(Paint.Style.FILL);
mBasePaint.setPathEffect(new CornerPathEffect(4));
if(mMainIndicatorPath == null) {
createMainIndicatorPath(c);
}
for(int rotation=-128,count=8; rotation <=128; rotation+=32,count--) {
c.save();
c.rotate(rotation,c.getWidth() / 2,c.getHeight() / 2);
if(count<=1) {
mBasePaint.setColor(COLOR_RED);
}
c.drawPath(mMainIndicatorPath,mBasePaint);
c.restore();
}
resetBasePaint();
}
项目:miappstore
文件:ViewPagerIndicator.java
public ViewPagerIndicator(Context context,COUNT_DEFAULT_TAB);
if (mTabVisibleCount < 0)
mTabVisibleCount = COUNT_DEFAULT_TAB;
a.recycle();
// 初始化画笔
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(Color.parseColor("#ffffffff"));
mPaint.setStyle(Style.FILL);
mPaint.setPathEffect(new CornerPathEffect(3));
}
项目:AndroidCommunicationBenchmark
文件:AuthenticationView.java
public AuthenticationView(Context context,byte[] key) {
super(context);
byte[] digest = new byte[0];
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.update(key);
digest = messageDigest.digest();
} catch (NoSuchAlgorithmException e) {
}
this.digest = digest;
this.dotPaint.setColor(Color.BLACK);
this.dotPaint.setAntiAlias(true);
this.dotPaint.setStyle(Paint.Style.FILL);
this.patternPaint.setColor(Color.GREEN);
this.patternPaint.setAntiAlias(true);
this.patternPaint.setStyle(Paint.Style.FILL);
this.patternPaint.setstrokeJoin(Paint.Join.ROUND); // set the join to round you want
this.patternPaint.setstrokeCap(Paint.Cap.ROUND); // set the paint cap to round too
this.patternPaint.setPathEffect(new CornerPathEffect(10));
this.patternPaint.setDither(true);
Log.d("sha",toHex(digest));
}
项目:itmarry
文件:ZLAndroidPaintContext.java
ZLAndroidPaintContext(Canvas canvas,3.5f));
}
项目:-abase-reader
文件:ZLAndroidPaintContext.java
ZLAndroidPaintContext(Canvas canvas,3.5f));
}
项目:codeexamples-android
文件:CustomButton.java
public CustomButton(Context context) {
super(context);
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Style.FILL);
paint.setColor(Color.BLACK);
paint.setTextSize(40);
fillPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
fillPaint.setStyle(Style.FILL);
fillPaint.setColor(Color.RED);
CornerPathEffect effect = new CornerPathEffect(30);
fillPaint.setPathEffect(effect);
fillPaint.setStyle(Style.FILL_AND_stroke);
fillPaint.setShader(new LinearGradient(0F,120,getWidth(),getHeight(),Color.CYAN,Color.RED,Shader.TileMode.CLAMP));
}
项目:Mapyst
文件:RouteMapOverlay.java
private void setupPaints() {
paint = new Paint();
paint.setAntiAlias(true);
paint.setstrokeWidth(8.0f);
paint.setStyle(Style.stroke);
paint.setPathEffect(new CornerPathEffect(5.0f));
paint.setColor(OUTSIDE_COLOR);
bitmapPaint = new Paint();
shadePaint = new Paint();
shadePaint.setColor(Color.argb(255 / 3,89,89));
insidePaint = new Paint();
insidePaint.setAntiAlias(true);
insidePaint.setstrokeWidth(8.0f);
insidePaint.setStyle(Style.stroke);
insidePaint.setPathEffect(new CornerPathEffect(5.0f));
insidePaint.setColor(OUTSIDE_COLOR);
}
项目:GitHub
文件:SquareProgressView.java
public void setRoundedCorners(boolean roundedCorners,float radius) {
this.roundedCorners = roundedCorners;
this.roundedCornersRadius = radius;
if (roundedCorners) {
progressBarPaint.setPathEffect(new CornerPathEffect(roundedCornersRadius));
} else {
progressBarPaint.setPathEffect(null);
}
this.invalidate();
}
项目:android_ui
文件:ProgressDrawable.java
/**
* Updates the given <var>paint</var> in the way,that changes its options in order to enable
* or disable rounded feature for the paint.
*
* @param paint The paint to update.
* @param rounded {@code True} if the paint should support rounded feature so a graphics drawn
* using the paint will have rounded corners,{@code false} to clear the current
* rounded feature.
* @return The specified paint with updated <b>stroke join,stroke cap</b> and <b>path effect</b>.
*/
Paint updatePaintToRounded(Paint paint,boolean rounded) {
if (rounded) {
paint.setstrokeJoin(Paint.Join.ROUND);
paint.setstrokeCap(Paint.Cap.ROUND);
paint.setPathEffect(new CornerPathEffect(mProgressstate.useThickness));
} else {
paint.setstrokeJoin(Paint.Join.MITER);
paint.setstrokeCap(Paint.Cap.BUTT);
paint.setPathEffect(null);
}
return paint;
}
项目:BubbleAlert
文件:AlertDrawable.java
public AlertDrawable(int outerCircleRadiusDP,int textSizeSP,int cornerArc,String drawText,Context context) {
mContext = context;
circleRadius = ScreenUtils.unitToPixels(context,TypedValue.COMPLEX_UNIT_DIP,outerCircleRadiusDP);
textSize = ScreenUtils.unitToPixels(context,TypedValue.COMPLEX_UNIT_SP,textSizeSP);
mDrawText = TextUtils.isEmpty(drawText) ? " " : drawText;
initBitmap(mDrawText);
mBackGroundPaint = new Paint();
mBackGroundPaint.setAntiAlias(true);
mBackGroundPaint.setDither(true);
mBackGroundPaint.setColor(Color.WHITE);
mBackGroundPaint.setStyle(Paint.Style.FILL);
mCircleFillPaint = new Paint();
mCircleFillPaint.setAntiAlias(true);
mCircleFillPaint.setDither(true);
mCircleFillPaint.setColor(ContextCompat.getColor(context,R.color.colorMultiArc));
mCircleFillPaint.setStyle(Paint.Style.FILL);
mOuterCircleFillPaint = new Paint();
mOuterCircleFillPaint.setAntiAlias(true);
mOuterCircleFillPaint.setDither(true);
mOuterCircleFillPaint.setColor(Color.WHITE);
mOuterCircleFillPaint.setStyle(Paint.Style.FILL);
mOuterCircleFillPaint.setTextSize(textSize);
borderPath = new Path();
borderRect = new Rect();
CornerPathEffect cornerPathEffect = new CornerPathEffect(cornerArc);
mBackGroundPaint.setPathEffect(cornerPathEffect);
outerCircleOffset = context.getResources().getInteger(R.integer.outerCircleOffset);
}
/**
* Inits paint objects and default values.
*/
private void initView() {
starPath = new Path();
cornerPathEffect = new CornerPathEffect(starCornerRadius);
paintSTaroutline = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
paintSTaroutline.setStyle(Paint.Style.FILL_AND_stroke);
paintSTaroutline.setAntiAlias(true);
paintSTaroutline.setDither(true);
paintSTaroutline.setstrokeJoin(Paint.Join.ROUND);
paintSTaroutline.setstrokeCap(Paint.Cap.ROUND);
paintSTaroutline.setColor(Color.BLACK);
paintSTaroutline.setPathEffect(cornerPathEffect);
paintStarBorder = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
paintStarBorder.setStyle(Paint.Style.stroke);
paintStarBorder.setstrokeJoin(Paint.Join.ROUND);
paintStarBorder.setstrokeCap(Paint.Cap.ROUND);
paintStarBorder.setstrokeWidth(starBorderWidth);
paintStarBorder.setPathEffect(cornerPathEffect);
paintStarBackground = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
paintStarBackground.setStyle(Paint.Style.FILL_AND_stroke);
paintStarBackground.setAntiAlias(true);
paintStarBackground.setDither(true);
paintStarBackground.setstrokeJoin(Paint.Join.ROUND);
paintStarBackground.setstrokeCap(Paint.Cap.ROUND);
paintStarFill = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
paintStarFill.setStyle(Paint.Style.FILL_AND_stroke);
paintStarFill.setAntiAlias(true);
paintStarFill.setDither(true);
paintStarFill.setstrokeJoin(Paint.Join.ROUND);
paintStarFill.setstrokeCap(Paint.Cap.ROUND);
defaultStarSize = applyDimension(COMPLEX_UNIT_DIP,30,getResources().getdisplayMetrics());
}
/**
* Sets radius of star corner in pixels.
* @param starCornerRadius
*/
public void setStarCornerRadius(float starCornerRadius) {
this.starCornerRadius = starCornerRadius;
if (starCornerRadius < 0) {
throw new IllegalArgumentException(String.format("SimpleratingBar initialized with invalid value for starCornerRadius. Found %f,but should be greater or equal than 0",starCornerRadius));
}
cornerPathEffect = new CornerPathEffect(starCornerRadius);
paintStarBorder.setPathEffect(cornerPathEffect);
paintSTaroutline.setPathEffect(cornerPathEffect);
// request redraw of the view
invalidate();
}
项目:Oblique
文件:ObliqueView.java
@Override
protected void onDraw(Canvas canvas) {
// super.onDraw(canvas);
paint.setStyle(Paint.Style.FILL);
switch (config.getType()) {
case 0:
paint.setColor(config.getBaseColor());
break;
case 1:
paint.setShader(config.getLinearGradient(config.getAngle(),width,height));
break;
case 2:
paint.setShader(config.geTradialGradient(width,height));
break;
case 3:
setupBitmap(this,height);
break;
}
paint.setstrokeJoin(Paint.Join.ROUND); // set the join to round you want
paint.setstrokeCap(Paint.Cap.ROUND); // set the paint cap to round too
paint.setPathEffect(new CornerPathEffect(config.geTradius()));
ViewCompat.setElevation(this,config.getShadow());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && ViewCompat.getElevation(this) > 0f) {
try {
setoutlineProvider(getoutlineProvider());
} catch (Exception e) {
Log.e("Exception",e.getMessage());
e.printstacktrace();
}
}
paint.setXfermode(pdMode);
canvas.drawPath(path,paint);
}
项目:similarLoadingView
文件:SimilarLoadingView.java
private void initPaint() {
paint.setAlpha(0);
paint.setPathEffect(new CornerPathEffect(cornerRadius));
paint.setColor(color);
paint.setStyle(Paint.Style.FILL);
paint.setAntiAlias(true);
}
项目:egma-handwriting-numbers
文件:DrawView.java
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。