public void setPaintMaskFilter(int mode) { switch (mode) { case UsoppBubble.MODE_NONE: break; case UsoppBubble.MODE_GLOW: mDataBean.mFilter = new BlurMaskFilter(10, BlurMaskFilter.Blur.OUTER); break; case UsoppBubble.MODE_EMBOSS: float[] direction = new float[]{10, 10, 10}; float ambient = 0.5f; float specular = 1; float blurRadius = 1; mDataBean.mFilter = new EmbossMaskFilter(direction, ambient, specular, blurRadius); break; } mDataBean.mPaint.setMaskFilter(mDataBean.mFilter); }
/** * Instantiates a new ab horizontal progress bar. * * @param context the context * @param attrs the attrs */ public AbHorizontalProgressBar(Context context, AttributeSet attrs) { super(context, attrs); pathPaint = new Paint(); // 设置是否抗锯齿 pathPaint.setAntiAlias(true); // 帮助消除锯齿 pathPaint.setFlags(Paint.ANTI_ALIAS_FLAG); // 设置中空的样式 pathPaint.setStyle(Paint.Style.FILL); pathPaint.setDither(true); //pathPaint.setStrokeJoin(Paint.Join.ROUND); fillPaint = new Paint(); // 设置是否抗锯齿 fillPaint.setAntiAlias(true); // 帮助消除锯齿 fillPaint.setFlags(Paint.ANTI_ALIAS_FLAG); // 设置中空的样式 fillPaint.setStyle(Paint.Style.FILL); fillPaint.setDither(true); //fillPaint.setStrokeJoin(Paint.Join.ROUND); emboss = new EmbossMaskFilter(direction,light,specular,blur); mBlur = new BlurMaskFilter(20, BlurMaskFilter.Blur.NORMAL); }
ZLAndroidPaintContext(Canvas canvas, int width, 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)); }
/** * @see EmbossMaskFilter#EmbossMaskFilter(float[], float, float, float) */ public static Span emboss(@NonNull final float[] direction, final float ambient, final float specular, final float blurRadius) { return new Span(new SpanBuilder() { @Override public Object build() { return new MaskFilterSpan(new EmbossMaskFilter(direction, ambient, specular, blurRadius)); } }); }
public TextDecorator emboss(final float[] direction, final float ambient, final float specular, final float blurRadius, final int start, final int end) { checkIndexOutOfBoundsException(start, end); decoratedContent.setSpan(new MaskFilterSpan(new EmbossMaskFilter(direction, ambient, specular, blurRadius)), start, end, flags); return this; }
public TextDecorator emboss(final float[] direction, final float ambient, final float specular, final float blurRadius, final String... texts) { int index; for (String text : texts) { if (content.contains(text)) { index = content.indexOf(text); decoratedContent.setSpan(new MaskFilterSpan(new EmbossMaskFilter(direction, ambient, specular, blurRadius)), index, index + text.length(), flags); } } return this; }
private void updateEmboss() { if (isInEditMode()) return; if (!withEffects3D) { tubePaint.setMaskFilter(null); tubeBacPaint.setMaskFilter(null); return; } EmbossMaskFilter embossMaskFilter = new EmbossMaskFilter( new float[] { .5f, 1f, 1f }, .6f, 3f, pxTOdp(getSpeedometerWidth())*.35f); tubePaint.setMaskFilter(embossMaskFilter); EmbossMaskFilter embossMaskFilterBac = new EmbossMaskFilter( new float[] { -.5f, -1f, 0f }, .6f, 1f, pxTOdp(getSpeedometerWidth())*.35f); tubeBacPaint.setMaskFilter(embossMaskFilterBac); }
/** * Instantiates a new ab circle progress bar. * * @param context the context * @param attrs the attrs */ public AbCircleProgressBar(Context context, AttributeSet attrs) { super(context, attrs); pathPaint = new Paint(); // 设置是否抗锯齿 pathPaint.setAntiAlias(true); // 帮助消除锯齿 pathPaint.setFlags(Paint.ANTI_ALIAS_FLAG); // 设置中空的样式 pathPaint.setStyle(Paint.Style.STROKE); pathPaint.setDither(true); pathPaint.setStrokeJoin(Paint.Join.ROUND); fillArcPaint = new Paint(); // 设置是否抗锯齿 fillArcPaint.setAntiAlias(true); // 帮助消除锯齿 fillArcPaint.setFlags(Paint.ANTI_ALIAS_FLAG); // 设置中空的样式 fillArcPaint.setStyle(Paint.Style.STROKE); fillArcPaint.setDither(true); fillArcPaint.setStrokeJoin(Paint.Join.ROUND); oval = new RectF(); emboss = new EmbossMaskFilter(direction,light,specular,blur); mBlur = new BlurMaskFilter(20, BlurMaskFilter.Blur.NORMAL); }
private void preparePainters() { borderPencil = new Paint(Paint.ANTI_ALIAS_FLAG); borderPencil.setStrokeWidth(0.5f); borderPencil.setColor(0xFF6d6968); borderPencil.setStyle(Paint.Style.STROKE); itemDefaultColor = new Paint(Paint.ANTI_ALIAS_FLAG); itemDefaultColor.setStyle(Paint.Style.FILL); itemDefaultColor.setColor(0xfff3f3f3); itemTouchedBack = new Paint(Paint.ANTI_ALIAS_FLAG); itemTouchedBack.setColor(0xffFFFFFF); itemTouchedBack.setStyle(Paint.Style.FILL); rainbowBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG); rainbowBorderPaint.setStyle(Paint.Style.STROKE); rainbowBorderPaint.setStrokeWidth(CircleMenuSettings.rainbowCircleBorderWidth); smallBorderPencil = new Paint(Paint.ANTI_ALIAS_FLAG); smallBorderPencil.setColor(0xFFE6E6E6); smallBorderPencil.setStyle(Paint.Style.FILL); forBig = new EmbossMaskFilter(new float[] { 1, 1, 1 }, 1f, 4, 2.5f); itemDefaultColor.setMaskFilter(forBig); }
/** * 그래프 초기화 */ public void init(){ super.setWillNotDraw(false); isSizeToScale = true; strokSize = -1; isBackArc = false; Arc backArc; arcMargin=0; startAngle=0; maxAngle=360; isCapRound = false; emboss = new EmbossMaskFilter(new float[]{-1,-1,1},0.7f,3,4); isInitpieSkin = false; density = getContext().getResources().getDisplayMetrics().density; strokScale = 1.0f; if(arcs.size()>0 || pieSkin.size()>0){ pieSkin.clear(); arcs.clear(); this.invalidate(); } }
private void embossPen() { MaskFilter mEmboss = new EmbossMaskFilter(new float[]{ 1, 1, 1 }, 0.4f, 6, 3.5f); mPenPaint.setDither(true); mPenPaint.setAntiAlias(true); mPenPaint.setStyle(Paint.Style.STROKE); mPenPaint.setStrokeJoin(Paint.Join.ROUND); mPenPaint.setStrokeCap(Paint.Cap.ROUND); mPenPaint.setMaskFilter(mEmboss); }
private void applyFilter( TextView textView, float[] direction, float ambient, float specular, float blurRadius) { if (Build.VERSION.SDK_INT >= 11) { ViewUtil.setSoftwareLayerType(textView); } EmbossMaskFilter filter = new EmbossMaskFilter(direction, ambient, specular, blurRadius); textView.getPaint().setMaskFilter(filter); }
public Arc setMaskFilter(EmbossMaskFilter emboss){ this.emboss = emboss; init(); return this; }
public EmbossMaskFilter getMaskFilter(){ return emboss; }
public void setMaskFilter(EmbossMaskFilter emboss){ for(int i=0;i<arcs.size();i++){ Arc arc = arcs.get(i); arc.setMaskFilter(emboss); } }
public Arc setMaskFilter(EmbossMaskFilter emboss, int index){ Arc arc = arcs.get(index); return arc.setMaskFilter(emboss); }
public void setEmboss(EmbossMaskFilter emboss){ this.emboss = emboss; }