Java 类android.graphics.EmbossMaskFilter 实例源码

项目:UsoppBubble    文件:UsoppFrameLayout.java   
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);
}
项目:eshow-android    文件:AbHorizontalProgressBar.java   
/**
 * 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);
}
项目:FBreader    文件:ZLAndroidPaintContext.java   
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));
}
项目:androidsummary    文件:AbHorizontalProgressBar.java   
/**
 * 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);
}
项目:itmarry    文件:ZLAndroidPaintContext.java   
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));
}
项目:-abase-reader    文件:ZLAndroidPaintContext.java   
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));
}
项目:spanner    文件:Spans.java   
/**
 * @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));
        }
    });
}
项目:text-decorator    文件:TextDecorator.java   
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;
}
项目:text-decorator    文件:TextDecorator.java   
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;
}
项目:SpeedView    文件:TubeSpeedometer.java   
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);
}
项目:eshow-android    文件:AbCircleProgressBar.java   
/**
 * 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);
}
项目:Android-circular-menu-example    文件:CircleMenu.java   
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);
    }
项目:JwTools    文件:PieLayout.java   
/**
 * 그래프 초기화
 */
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();
    }
}
项目:androidsummary    文件:AbCircleProgressBar.java   
/**
 * 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);
}
项目:yitu    文件:PaintStyle.java   
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);
}
项目:android-graphics-demo    文件:EmbossMaskFilterActivity.java   
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);
}
项目:JwTools    文件:Arc.java   
public Arc setMaskFilter(EmbossMaskFilter emboss){
    this.emboss = emboss;
    init();
    return this;
}
项目:JwTools    文件:Arc.java   
public EmbossMaskFilter getMaskFilter(){
    return emboss;
}
项目:JwTools    文件:PieLayout.java   
public void setMaskFilter(EmbossMaskFilter emboss){
    for(int i=0;i<arcs.size();i++){
        Arc arc = arcs.get(i);
        arc.setMaskFilter(emboss);
    }
}
项目:JwTools    文件:PieLayout.java   
public Arc  setMaskFilter(EmbossMaskFilter emboss, int index){
    Arc arc = arcs.get(index);
    return arc.setMaskFilter(emboss);
}
项目:JwTools    文件:PieLayout.java   
public void setEmboss(EmbossMaskFilter emboss){
    this.emboss = emboss;

}