Java Code Examples for android.text.TextPaint#setAntiAlias()

The following examples show how to use android.text.TextPaint#setAntiAlias() . 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: OutlineTextView.java    From BambooPlayer with Apache License 2.0 8 votes vote down vote up
private void initPaint() {
	mTextPaint = new TextPaint();
	mTextPaint.setAntiAlias(true);
	mTextPaint.setTextSize(getTextSize());
	mTextPaint.setColor(mColor);
	mTextPaint.setStyle(Paint.Style.FILL);
	mTextPaint.setTypeface(getTypeface());

	mTextPaintOutline = new TextPaint();
	mTextPaintOutline.setAntiAlias(true);
	mTextPaintOutline.setTextSize(getTextSize());
	mTextPaintOutline.setColor(mBorderColor);
	mTextPaintOutline.setStyle(Paint.Style.STROKE);
	mTextPaintOutline.setTypeface(getTypeface());
	mTextPaintOutline.setStrokeWidth(mBorderSize);
}
 
Example 2
Source File: SubtitlePainter.java    From no-player with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("ResourceType")        // We're hacking `spacingMult = styledAttributes.getFloat`
SubtitlePainter(Context context) {
    int[] viewAttr = {android.R.attr.lineSpacingExtra, android.R.attr.lineSpacingMultiplier};
    TypedArray styledAttributes = context.obtainStyledAttributes(null, viewAttr, 0, 0);
    spacingAdd = styledAttributes.getDimensionPixelSize(0, 0);
    spacingMult = styledAttributes.getFloat(1, 1);
    styledAttributes.recycle();

    Resources resources = context.getResources();
    DisplayMetrics displayMetrics = resources.getDisplayMetrics();
    int twoDpInPx = Math.round((TWO_DP * displayMetrics.densityDpi) / DisplayMetrics.DENSITY_DEFAULT);
    cornerRadius = twoDpInPx;
    outlineWidth = twoDpInPx;
    shadowRadius = twoDpInPx;
    shadowOffset = twoDpInPx;

    textPaint = new TextPaint();
    textPaint.setAntiAlias(true);
    textPaint.setSubpixelText(true);

    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Style.FILL);
}
 
Example 3
Source File: OutlineTextView.java    From NetEasyNews with GNU General Public License v3.0 6 votes vote down vote up
private void initPaint() {
  mTextPaint = new TextPaint();
  mTextPaint.setAntiAlias(true);
  mTextPaint.setTextSize(getTextSize());
  mTextPaint.setColor(mColor);
  mTextPaint.setStyle(Paint.Style.FILL);
  mTextPaint.setTypeface(getTypeface());

  mTextPaintOutline = new TextPaint();
  mTextPaintOutline.setAntiAlias(true);
  mTextPaintOutline.setTextSize(getTextSize());
  mTextPaintOutline.setColor(mBorderColor);
  mTextPaintOutline.setStyle(Paint.Style.STROKE);
  mTextPaintOutline.setTypeface(getTypeface());
  mTextPaintOutline.setStrokeWidth(mBorderSize);
}
 
Example 4
Source File: BookAssetsPieChartView.java    From kAndroid with Apache License 2.0 5 votes vote down vote up
private void initPaint() {
    mPieChartPaint = new Paint();
    //是否开启抗锯齿
    mPieChartPaint.setAntiAlias(true);
    //防抖动
    mPieChartPaint.setDither(true);
    //画笔样式 STROKE 只绘制图形轮廓(描边) FILL 只绘制图形内容 FILL_AND_STROKE 既绘制轮廓也绘制内容
    mPieChartPaint.setStyle(Paint.Style.FILL);
    //画笔宽度
    mPieChartPaint.setStrokeWidth(mPieChartWidth);
    ///笔刷样式
    // 当画笔样式为STROKE或FILL_OR_STROKE时,
    mPieChartPaint.setStrokeCap(Paint.Cap.SQUARE);
    // 设置笔刷的图形样式,如圆形样式Cap.ROUND,或方形样式Cap.SQUARE
    mPieChartPaint.setColor(Color.RED);

    //数字
    mDataPaint = new TextPaint();
    mDataPaint.setDither(true);
    mDataPaint.setAntiAlias(true);
    mDataPaint.setTextSize(sp2px(mContext, mDataSize));
    mDataPaint.setColor(mDataColor);

    mPointingPaint = new Paint();
    mPointingPaint.setDither(true);
    mPointingPaint.setAntiAlias(true);
    mPointingPaint.setStyle(Paint.Style.STROKE);
    //从中间向两边绘制,不需要再次计算文字
    mPointingPaint.setStrokeWidth(mPointingWidth);
}
 
Example 5
Source File: MovieTextLayer.java    From PhotoMovie with Apache License 2.0 5 votes vote down vote up
public MovieTextLayer() {
    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);
    int textSizeSp = 20;
    float textSize = AppResources.getInstance().getAppRes().getDisplayMetrics().density * textSizeSp + 0.5f;
    mTextPaint.setTextSize(textSize);
    mTextPaint.setColor(Color.RED);
    mMovieFilter = new MovieFilter();
}
 
Example 6
Source File: LrcView.java    From APlayer with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 初始化画笔等
 */
@Override
public void init() {
  mScroller = new Scroller(getContext(), DEFAULT_INTERPOLATOR);
  mPaintForHighLightLrc = new TextPaint();
  mPaintForHighLightLrc.setAntiAlias(true);
  mPaintForHighLightLrc.setColor(mColorForHighLightLrc);
  float size = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 15,
      getContext().getResources().getDisplayMetrics());

  mSizeForHighLightLrc = size;
  mPaintForHighLightLrc.setTextSize(mSizeForHighLightLrc);
  mPaintForHighLightLrc.setFakeBoldText(true);

  mPaintForOtherLrc = new TextPaint();
  mPaintForOtherLrc.setAntiAlias(true);
  mPaintForOtherLrc.setColor(mColorForOtherLrc);

  mSizeForOtherLrc = size;
  mPaintForOtherLrc.setTextSize(mSizeForOtherLrc);

  mPaintForTimeLine = new TextPaint();
  mPaintForTimeLine.setAntiAlias(true);
  mSizeForTimeLine = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 11,
      getContext().getResources().getDisplayMetrics());
  mPaintForTimeLine.setTextSize(mSizeForTimeLine);
  mPaintForTimeLine.setColor(mTimeLineColor);

  mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
}
 
Example 7
Source File: ColorPickerView.java    From DoraemonKit with Apache License 2.0 5 votes vote down vote up
private void init() {
    mRingPaint = new Paint();
    mRingPaint.setAntiAlias(true);
    mRingPaint.setColor(Color.WHITE);
    mRingPaint.setStyle(Paint.Style.STROKE);

    mFocusPaint = new Paint();
    mFocusPaint.setAntiAlias(true);
    mFocusPaint.setStyle(Paint.Style.STROKE);
    mFocusPaint.setStrokeWidth(3f);
    mFocusPaint.setColor(Color.BLACK);

    mBitmapPaint = new Paint();
    mBitmapPaint.setFilterBitmap(false);

    mGridPaint = new Paint();
    //设置线宽。单位为1像素
    mGridPaint.setStrokeWidth(1f);
    mGridPaint.setStyle(Paint.Style.STROKE);
    //画笔颜色
    mGridPaint.setColor(-3355444);
    mGridShadowPaint = new Paint(mGridPaint);
    mGridShadowPaint.setColor(-12303292);

    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);
    mTextPaint.setTextAlign(Paint.Align.CENTER);
    mTextPaint.setTypeface(Typeface.MONOSPACE);
    mTextPaint.setTextSize(getResources().getDimensionPixelSize(R.dimen.dk_font_size_12));
}
 
Example 8
Source File: ArcProgress.java    From GeometricWeather with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void initPaint() {
    progressPaint = new Paint();
    progressPaint.setAntiAlias(true);
    progressPaint.setStrokeWidth(progressWidth);
    progressPaint.setStyle(Paint.Style.STROKE);
    progressPaint.setStrokeCap(Paint.Cap.ROUND);

    shadowPaint = new Paint();
    shadowPaint.setAntiAlias(true);
    shadowPaint.setStyle(Paint.Style.FILL);

    textPaint = new TextPaint();
    textPaint.setTextSize(textSize);
    textPaint.setAntiAlias(true);
}
 
Example 9
Source File: SubtitleView.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
public SubtitleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mTextBounds = new Rect();

    mBottomSubtitles = new SubtitleText[0];
    mTopSubtitles = new SubtitleText[0];
    mSpecialSubtitles = new SubtitleText[0];

    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);
    mTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    mTextPaint.setTextAlign(Paint.Align.CENTER);

    mStokePaint = new TextPaint();
    mStokePaint.setAntiAlias(true);
    mStokePaint.setStyle(Paint.Style.STROKE);
    mStokePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
    mStokePaint.setTextAlign(Paint.Align.CENTER);

    setBackgroundColor(Color.TRANSPARENT);
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);

    resetTextPaint();

    resetStokePaint();
}
 
Example 10
Source File: IconBorderTextSpan.java    From tysq-android with GNU General Public License v3.0 5 votes vote down vote up
/**
     * draw
     *
     * @param text   完整文本
     * @param start  setSpan里设置的start
     * @param end    setSpan里设置的start
     * @param x
     * @param top    当前span所在行的上方y
     * @param y      y其实就是metric里baseline的位置
     * @param bottom 当前span所在行的下方y(包含了行间距),会和下一行的top重合
     * @param paint  使用此span的画笔
     */
    @Override
    public void draw(@NonNull Canvas canvas,
                     CharSequence text,
                     int start,
                     int end,
                     float x,
                     int top,
                     int y,
                     int bottom,
                     @NonNull Paint paint) {
        //画背景
        Paint bgPaint = new Paint();
        bgPaint.setColor(mContext.getResources().getColor(mBgColorResId));
//        bgPaint.setStyle(Paint.Style.FILL);
        bgPaint.setStyle(Paint.Style.STROKE);
        bgPaint.setAntiAlias(true);
        Paint.FontMetrics metrics = paint.getFontMetrics();

        float textHeight = metrics.descent - metrics.ascent;
        //算出背景开始画的y坐标
        float bgStartY = y + (textHeight - mBgHeight) / 2 + metrics.ascent;

        //画背景
        RectF bgRect = new RectF(x, bgStartY, x + mBgWidth, bgStartY + mBgHeight);
        canvas.drawRoundRect(bgRect, mRadius, mRadius, bgPaint);

        //把字画在背景中间
        TextPaint textPaint = new TextPaint();
//        textPaint.setColor(mContext.getResources().getColor(mTextColorResId));
        textPaint.setColor(mContext.getResources().getColor(mBgColorResId));
        textPaint.setTextSize(mTextSize);
        textPaint.setAntiAlias(true);
        textPaint.setTextAlign(Paint.Align.CENTER);  //这个只针对x有效
        Paint.FontMetrics fontMetrics = textPaint.getFontMetrics();
        float textRectHeight = fontMetrics.bottom - fontMetrics.top;
        canvas.drawText(mText, x + mBgWidth / 2, bgStartY + (mBgHeight - textRectHeight) / 2 - fontMetrics.top, textPaint);
    }
 
Example 11
Source File: GroupHeaderItemDecoration.java    From GroupIndexLib with Apache License 2.0 5 votes vote down vote up
public GroupHeaderItemDecoration(Context context) {
    mContext = context;
    groupHeaderHeight = Utils.dip2px(context, 20);

    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(Color.parseColor("#FFEEEEEE"));

    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);
    mTextPaint.setColor(Color.parseColor("#FF999999"));
    mTextPaint.setTextSize(Utils.sp2px(context, 14));
}
 
Example 12
Source File: TextDrawer.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
public TextDrawer(Resources resources, ShowcaseAreaCalculator calculator, Context context) {
    padding = resources.getDimension(R.dimen.text_padding);
    actionBarOffset = resources.getDimension(R.dimen.action_bar_offset);

    this.calculator = calculator;
    this.context = context;

    titlePaint = new TextPaint();
    titlePaint.setAntiAlias(true);

    textPaint = new TextPaint();
    textPaint.setAntiAlias(true);
}
 
Example 13
Source File: StringTexture.java    From PhotoMovie with Apache License 2.0 5 votes vote down vote up
public static TextPaint getPaintNoShadow(float textSize, int color) {
    TextPaint paint = new TextPaint();
    paint.setTextSize(textSize);
    paint.setAntiAlias(true);
    paint.setColor(color);
    return paint;
}
 
Example 14
Source File: PageLoader.java    From NovelReader with MIT License 5 votes vote down vote up
private void initPaint() {
    // 绘制提示的画笔
    mTipPaint = new Paint();
    mTipPaint.setColor(mTextColor);
    mTipPaint.setTextAlign(Paint.Align.LEFT); // 绘制的起始点
    mTipPaint.setTextSize(ScreenUtils.spToPx(DEFAULT_TIP_SIZE)); // Tip默认的字体大小
    mTipPaint.setAntiAlias(true);
    mTipPaint.setSubpixelText(true);

    // 绘制页面内容的画笔
    mTextPaint = new TextPaint();
    mTextPaint.setColor(mTextColor);
    mTextPaint.setTextSize(mTextSize);
    mTextPaint.setAntiAlias(true);

    // 绘制标题的画笔
    mTitlePaint = new TextPaint();
    mTitlePaint.setColor(mTextColor);
    mTitlePaint.setTextSize(mTitleSize);
    mTitlePaint.setStyle(Paint.Style.FILL_AND_STROKE);
    mTitlePaint.setTypeface(Typeface.DEFAULT_BOLD);
    mTitlePaint.setAntiAlias(true);

    // 绘制背景的画笔
    mBgPaint = new Paint();
    mBgPaint.setColor(mBgColor);

    // 绘制电池的画笔
    mBatteryPaint = new Paint();
    mBatteryPaint.setAntiAlias(true);
    mBatteryPaint.setDither(true);

    // 初始化页面样式
    setNightMode(mSettingManager.isNightMode());
}
 
Example 15
Source File: PigstyMode.java    From CatchPiggy with GNU General Public License v3.0 5 votes vote down vote up
private void initPaint() {
    mPaint = new TextPaint();
    mPaint.setAntiAlias(true);
    mPaint.setTextAlign(Paint.Align.CENTER);
    mPaint.setTextSize(getResources().getDimension(R.dimen.xhpx_38));
    mPaint.setColor(getResources().getColor(R.color.colorHint));

    mCarIsComingText = getResources().getString(R.string.car_is_coming);
    mPiggiesHasRunText = getResources().getString(R.string.piggies_has_run);
    mStartCatchText = getResources().getString(R.string.start_catch);
    mDragPigText = getResources().getString(R.string.drag_pig);
}
 
Example 16
Source File: StickyDecoration.java    From calendar with Apache License 2.0 5 votes vote down vote up
private StickyDecoration(GroupListener listener) {
    super();
    mGroupListener = listener;
    //设置悬浮栏的画笔---mGroutPaint
    mGroutPaint = new Paint();
    mGroutPaint.setColor(mGroupBackground);
    //设置悬浮栏中文本的画笔
    mTextPaint = new TextPaint();
    mTextPaint.setAntiAlias(true);
    mTextPaint.setTextSize(mTextSize);
    mTextPaint.setColor(mGroupTextColor);
    mTextPaint.setTextAlign(Paint.Align.LEFT);
}
 
Example 17
Source File: RadarView.java    From RadarChart with Apache License 2.0 5 votes vote down vote up
private void init() {
    mRadarPath = new Path();
    mAnimeUtil = new AnimeUtil(this);
    mScroller = new Scroller(mContext);
    mDetector = new GestureDetector(mContext, new GestureListener());
    mDetector.setIsLongpressEnabled(false);

    mRadarData = new ArrayList<>();
    mLayerColor = new ArrayList<>();
    initLayerColor();

    mRadarLinePaint = new Paint();
    mLayerPaint = new Paint();
    mValuePaint = new Paint();
    mVertexTextPaint = new TextPaint();
    mValueTextPaint = new TextPaint();
    mCenterTextPaint = new TextPaint();

    mRadarLinePaint.setAntiAlias(true);
    mLayerPaint.setAntiAlias(true);
    mVertexTextPaint.setAntiAlias(true);
    mCenterTextPaint.setAntiAlias(true);
    mValueTextPaint.setAntiAlias(true);
    mValuePaint.setAntiAlias(true);
    mValueTextPaint.setFakeBoldText(true);

    mVertexIconRect = new RectF();
}
 
Example 18
Source File: QBadgeView.java    From BadgeView with Apache License 2.0 5 votes vote down vote up
private void init() {
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    mBadgeTextRect = new RectF();
    mBadgeBackgroundRect = new RectF();
    mDragPath = new Path();
    mBadgeCenter = new PointF();
    mDragCenter = new PointF();
    mRowBadgeCenter = new PointF();
    mControlPoint = new PointF();
    mInnertangentPoints = new ArrayList<>();
    mBadgeTextPaint = new TextPaint();
    mBadgeTextPaint.setAntiAlias(true);
    mBadgeTextPaint.setSubpixelText(true);
    mBadgeTextPaint.setFakeBoldText(true);
    mBadgeTextPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    mBadgeBackgroundPaint = new Paint();
    mBadgeBackgroundPaint.setAntiAlias(true);
    mBadgeBackgroundPaint.setStyle(Paint.Style.FILL);
    mBadgeBackgroundBorderPaint = new Paint();
    mBadgeBackgroundBorderPaint.setAntiAlias(true);
    mBadgeBackgroundBorderPaint.setStyle(Paint.Style.STROKE);
    mColorBackground = 0xFFE84E40;
    mColorBadgeText = 0xFFFFFFFF;
    mBadgeTextSize = DisplayUtil.dp2px(getContext(), 11);
    mBadgePadding = DisplayUtil.dp2px(getContext(), 5);
    mBadgeNumber = 0;
    mBadgeGravity = Gravity.END | Gravity.TOP;
    mGravityOffsetX = DisplayUtil.dp2px(getContext(), 1);
    mGravityOffsetY = DisplayUtil.dp2px(getContext(), 1);
    mFinalDragDistance = DisplayUtil.dp2px(getContext(), 90);
    mShowShadow = true;
    mDrawableBackgroundClip = false;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setTranslationZ(1000);
    }
}
 
Example 19
Source File: DraggableDot.java    From codeexamples-android with Eclipse Public License 1.0 4 votes vote down vote up
public DraggableDot(Context context, AttributeSet attrs) {
    super(context, attrs);

    setFocusable(true);
    setClickable(true);

    mLegend = "";

    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setStrokeWidth(6);
    mPaint.setColor(0xFFD00000);

    mLegendPaint = new TextPaint();
    mLegendPaint.setAntiAlias(true);
    mLegendPaint.setTextAlign(Paint.Align.CENTER);
    mLegendPaint.setColor(0xFFF0F0FF);

    mGlow = new Paint();
    mGlow.setAntiAlias(true);
    mGlow.setStrokeWidth(1);
    mGlow.setStyle(Paint.Style.STROKE);

    // look up any layout-defined attributes
    TypedArray a = context.obtainStyledAttributes(attrs,
            R.styleable.DraggableDot);

    final int N = a.getIndexCount();
    for (int i = 0; i < N; i++) {
        int attr = a.getIndex(i);
        switch (attr) {
        case R.styleable.DraggableDot_radius: {
            mRadius = a.getDimensionPixelSize(attr, 0);
        } break;

        case R.styleable.DraggableDot_legend: {
            mLegend = a.getText(attr);
        } break;

        case R.styleable.DraggableDot_anr: {
            mAnrType = a.getInt(attr, 0);
        } break;
        }
    }

    Log.i(TAG, "DraggableDot @ " + this + " : radius=" + mRadius + " legend='" + mLegend
            + "' anr=" + mAnrType);

    setOnLongClickListener(new View.OnLongClickListener() {
        public boolean onLongClick(View v) {
            ClipData data = ClipData.newPlainText("dot", "Dot : " + v.toString());
            v.startDrag(data, new ANRShadowBuilder(v, mAnrType == ANR_SHADOW),
                    (Object)v, 0);
            return true;
        }
    });
}
 
Example 20
Source File: WaterMarkTextUtil.java    From imsdk-android with MIT License 4 votes vote down vote up
/**
 * 生成水印文字图片
 */
public BitmapDrawable drawTextToBitmap(Context mContext, String gText) {

    try {
        TextPaint mTextPaint1 = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        mTextPaint1.density = mContext.getResources().getDisplayMetrics().density;
        oneTextPx = Utils.sp2px(mContext, textSize);
        mTextPaint1.setTextSize(oneTextPx);
        //计算字长
        textLength = (int) mTextPaint1.measureText(gText);
        int stextLength = (int) mTextPaint1.measureText(sText);
        /**拿到字长之后,计算一下斜着显示文字的时候文字所占的长和高*/
        int witchPx = 0;
        int highPx = 0;
        /**默认一段文字的长和高计算*/
        if (sWitchPx == 0) {
            sWitchPx = measurementWitch(stextLength);
            sHigthPx = measurementHigth(stextLength);
        }
        /**传入的文字的长和高计算*/
        witchPx = measurementWitch(textLength);
        highPx = measurementHigth(textLength);
        /**计算显示完整所需占的画图长宽*/
        int bitmapWitch = witchPx + sWitchPx + 2 * oneTextPx + offset;
        int bitmaphigth = (highPx + oneTextPx) * 2;
        //设置画板的时候 增加一个字的长宽
        bitmap = Bitmap.createBitmap(bitmapWitch + right,
                bitmaphigth+(2*top), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        canvas.drawColor(ContextCompat.getColor(mContext, R.color.atom_ui_chat_gray_bg));
        /**初始化画笔*/
        TextPaint mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        mTextPaint.density = mContext.getResources().getDisplayMetrics().density;
        mTextPaint.setColor(Color.parseColor("#C4C4C4"));
        mTextPaint.setAlpha(90);
        mTextPaint.setStyle(Paint.Style.FILL);
        mTextPaint.setAntiAlias(true);
        mTextPaint.setTextAlign(Paint.Align.LEFT);
        mTextPaint.setFakeBoldText(false);
        mTextPaint.setTextSkewX(0);
        mTextPaint.setTextSize(oneTextPx);
        /**
         * ——————————————————————————————————>
         * |    1号绘制区域    |  间  |  2号   |
         * |   gText         |      | appName |
         * |  ①号起点位置     |  隔  |  ②起   |
         * ———————————————————————————————————
         * | 3号      | 间   |   4号绘制区域    |
         * | appName   |      |   gText        |
         * |  ③起     | 隔   |   ④号起        |
         * |———————————————————————————————————
         * V
         */
        /**方式二利用画布平移和旋转绘制*/
        /**先移动到①起点位置*/
        canvas.translate(oneTextPx,highPx+oneTextPx+top);
        /**旋转一定度数 绘制文字*/
        canvas.rotate(-rotate);
        canvas.drawText(gText,0,0,mTextPaint);
        /**恢复原来的度数 再移动画布原点到②号位置*/
        canvas.rotate(rotate);
        canvas.translate(witchPx+offset+oneTextPx,0);
        /**旋转一定度数 绘制文字*/
        canvas.rotate(-rotate);
        canvas.drawText(sText,0,0,mTextPaint);
        /**恢复原来的度数 再移动画布原点到③号位置*/
        canvas.rotate(rotate);
        canvas.translate(-(witchPx+offset+oneTextPx),oneTextPx+highPx+top);
        /**旋转一定度数 绘制文字*/
        canvas.rotate(-rotate);
        canvas.drawText(sText,0,0,mTextPaint);
        /**恢复原来的度数 再移动画布原点到④号位置*/
        canvas.rotate(rotate);
        canvas.translate(sWitchPx+offset+oneTextPx,0);
        /**旋转一定度数 绘制文字*/
        canvas.rotate(-rotate);
        canvas.drawText(gText,0,0,mTextPaint);
        /**保存画布*/
        canvas.save(Canvas.ALL_SAVE_FLAG);
        canvas.restore();
        //生成平铺的bitmapDrawable
        BitmapDrawable drawable = new BitmapDrawable(mContext.getResources(), bitmap);
        drawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
        drawable.setDither(true);
        return drawable;
    } catch (Exception e) {

    }
    return null;

}