android.text.style.MaskFilterSpan Java Examples
The following examples show how to use
android.text.style.MaskFilterSpan.
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: Spans.java From spanner with Apache License 2.0 | 5 votes |
/** * @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
Source File: Spans.java From spanner with Apache License 2.0 | 5 votes |
/** * @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 |
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
Source File: TextDecorator.java From text-decorator with Apache License 2.0 | 5 votes |
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
Source File: TextDecorator.java From text-decorator with Apache License 2.0 | 5 votes |
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
Source File: SpannableStringUtils.java From DevUtils with Apache License 2.0 | 4 votes |
/** * 更新 CharSequence 字符 */ private void updateCharCharSequence() { if (mText.length() == 0) return; int start = mBuilder.length(); if (start == 0 && lineHeight != -1) { // bug of LineHeightSpan when first line mBuilder.append(Character.toString((char) 2)).append("\n") .setSpan(new AbsoluteSizeSpan(0), 0, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); start = 2; } mBuilder.append(mText); int end = mBuilder.length(); if (verticalAlign != -1) { mBuilder.setSpan(new VerticalAlignSpan(verticalAlign), start, end, flag); } if (foregroundColor != COLOR_DEFAULT) { mBuilder.setSpan(new ForegroundColorSpan(foregroundColor), start, end, flag); } if (backgroundColor != COLOR_DEFAULT) { mBuilder.setSpan(new BackgroundColorSpan(backgroundColor), start, end, flag); } if (first != -1) { mBuilder.setSpan(new LeadingMarginSpan.Standard(first, rest), start, end, flag); } if (quoteColor != COLOR_DEFAULT) { mBuilder.setSpan(new CustomQuoteSpan(quoteColor, stripeWidth, quoteGapWidth), start, end, flag); } if (bulletColor != COLOR_DEFAULT) { mBuilder.setSpan(new CustomBulletSpan(bulletColor, bulletRadius, bulletGapWidth), start, end, flag); } if (fontSize != -1) { mBuilder.setSpan(new AbsoluteSizeSpan(fontSize, fontSizeIsDp), start, end, flag); } if (proportion != -1) { mBuilder.setSpan(new RelativeSizeSpan(proportion), start, end, flag); } if (xProportion != -1) { mBuilder.setSpan(new ScaleXSpan(xProportion), start, end, flag); } if (lineHeight != -1) { mBuilder.setSpan(new CustomLineHeightSpan(lineHeight, alignLine), start, end, flag); } if (isStrikethrough) { mBuilder.setSpan(new StrikethroughSpan(), start, end, flag); } if (isUnderline) { mBuilder.setSpan(new UnderlineSpan(), start, end, flag); } if (isSuperscript) { mBuilder.setSpan(new SuperscriptSpan(), start, end, flag); } if (isSubscript) { mBuilder.setSpan(new SubscriptSpan(), start, end, flag); } if (isBold) { mBuilder.setSpan(new StyleSpan(Typeface.BOLD), start, end, flag); } if (isItalic) { mBuilder.setSpan(new StyleSpan(Typeface.ITALIC), start, end, flag); } if (isBoldItalic) { mBuilder.setSpan(new StyleSpan(Typeface.BOLD_ITALIC), start, end, flag); } if (fontFamily != null) { mBuilder.setSpan(new TypefaceSpan(fontFamily), start, end, flag); } if (typeface != null) { mBuilder.setSpan(new CustomTypefaceSpan(typeface), start, end, flag); } if (alignment != null) { mBuilder.setSpan(new AlignmentSpan.Standard(alignment), start, end, flag); } if (clickSpan != null) { mBuilder.setSpan(clickSpan, start, end, flag); } if (url != null) { mBuilder.setSpan(new URLSpan(url), start, end, flag); } if (blurRadius != -1) { mBuilder.setSpan(new MaskFilterSpan(new BlurMaskFilter(blurRadius, style)), start, end, flag); } if (shader != null) { mBuilder.setSpan(new ShaderSpan(shader), start, end, flag); } if (shadowRadius != -1) { mBuilder.setSpan(new ShadowSpan(shadowRadius, shadowDx, shadowDy, shadowColor), start, end, flag); } if (spans != null) { for (Object span : spans) { mBuilder.setSpan(span, start, end, flag); } } }
Example #7
Source File: Span.java From Android-Spans with Apache License 2.0 | 4 votes |
public static Node mask(MaskFilter filter, Object... nodes) { return new SpanNode(new MaskFilterSpan(filter), nodes); }
Example #8
Source File: TextDecorator.java From text-decorator with Apache License 2.0 | 4 votes |
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 #9
Source File: SpanOptions.java From AndroidSpan with Apache License 2.0 | 4 votes |
/** * @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 #10
Source File: AndroidSpan.java From AndroidSpan with Apache License 2.0 | 2 votes |
/** * 模糊效果 * * @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; }