Java Code Examples for android.text.style.MaskFilterSpan

The following are top voted examples for showing how to use android.text.style.MaskFilterSpan. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: spanner   File: Spans.java   Source Code and License 5 votes vote down vote up
/**
 * @see BlurMaskFilter#BlurMaskFilter(float, BlurMaskFilter.Blur)
 */
public static Span blur(final float radius, @NonNull final BlurMaskFilter.Blur style) {
    return new Span(new SpanBuilder() {
        @Override
        public Object build() {
            return new MaskFilterSpan(new BlurMaskFilter(radius, style));
        }
    });
}
 
Example 2
Project: spanner   File: Spans.java   Source Code and License 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
Project: text-decorator   File: TextDecorator.java   Source Code and License 5 votes vote down vote up
public TextDecorator blur(final float radius, final BlurMaskFilter.Blur style, final String... texts) {
  int index;

  for (String text : texts) {
    if (content.contains(text)) {
      index = content.indexOf(text);
      decoratedContent.setSpan(new MaskFilterSpan(new BlurMaskFilter(radius, style)), index, index + text.length(), flags);
    }
  }

  return this;
}
 
Example 4
Project: text-decorator   File: TextDecorator.java   Source Code and License 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 5
Project: text-decorator   File: TextDecorator.java   Source Code and License 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 6
Project: Android-Spans   File: Span.java   Source Code and License 4 votes vote down vote up
public static Node mask(MaskFilter filter, Object... nodes) {
    return new SpanNode(new MaskFilterSpan(filter), nodes);
}
 
Example 7
Project: text-decorator   File: TextDecorator.java   Source Code and License 4 votes vote down vote up
public TextDecorator blur(final float radius, final BlurMaskFilter.Blur style, final int start, final int end) {
  checkIndexOutOfBoundsException(start, end);
  decoratedContent.setSpan(new MaskFilterSpan(new BlurMaskFilter(radius, style)), start, end, flags);

  return this;
}
 
Example 8
Project: AndroidSpan   File: SpanOptions.java   Source Code and License 4 votes vote down vote up
/**
 * @param density
 * @param style   BlurMaskFilter.Blur.NORMAL
 * @return
 */
public SpanOptions addMaskFilterSpan(float density, BlurMaskFilter.Blur style) {
    MaskFilterSpan span = new MaskFilterSpan(new BlurMaskFilter(density, style));
    listSpan.add(span);
    return this;
}
 
Example 9
Project: AndroidSpan   File: AndroidSpan.java   Source Code and License 2 votes vote down vote up
/**
 * 模糊效果
 *
 * @param text
 * @param density
 * @param style   BlurMaskFilter.Blur.NORMAL
 * @return
 */
public AndroidSpan drawMaskFilterSpan(String text, float density, BlurMaskFilter.Blur style) {
    MaskFilterSpan span = new MaskFilterSpan(new BlurMaskFilter(density, style));
    drawSpan(text, span);
    return this;
}