android.graphics.EmbossMaskFilter Java Examples

The following examples show how to use android.graphics.EmbossMaskFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FreeHandView.java    From Machine-Learning-Projects-for-Mobile-Applications with MIT License 6 votes vote down vote up
public FreeHandView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setColor(DEFAULT_COLOR);
    //mPaint.setAlpha(DEFAULT_COLOR);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeJoin(Paint.Join.ROUND);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setXfermode(null);
    mPaint.setAlpha(0xff);

    mEmboss = new EmbossMaskFilter(new float[] {1, 1, 1}, 0.4f, 6, 3.5f);
    mBlur = new BlurMaskFilter(5, BlurMaskFilter.Blur.NORMAL);
}
 
Example #2
Source File: Spans.java    From spanner with Apache License 2.0 5 votes vote down vote up
/**
 * @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));
        }
    });
}
 
Example #3
Source File: TextDecorator.java    From text-decorator with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #4
Source File: TextDecorator.java    From text-decorator with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: EmbossMaskFilterActivity.java    From android-graphics-demo with Apache License 2.0 5 votes vote down vote up
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);
}