Java 类android.graphics.Paint.Style 实例源码

项目:MyRepository    文件:RoundProgressBarWidthNumber.java   
public RoundProgressBarWidthNumber(Context context, AttributeSet attrs) {
    super(context, attrs);

    mReachedProgressBarHeight = (int) (mUnReachedProgressBarHeight * 2.5f);
    TypedArray ta = context.obtainStyledAttributes(attrs,
            R.styleable.RoundProgressBarWidthNumber);
    mRadius = (int) ta.getDimension(
            R.styleable.RoundProgressBarWidthNumber_radius, mRadius);
    ta.recycle();

    mPaint.setStyle(Style.STROKE);
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setStrokeCap(Cap.ROUND);

}
项目:GitHub    文件:DataRenderer.java   
public DataRenderer(ChartAnimator animator, ViewPortHandler viewPortHandler) {
    super(viewPortHandler);
    this.mAnimator = animator;

    mRenderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mRenderPaint.setStyle(Style.FILL);

    mDrawPaint = new Paint(Paint.DITHER_FLAG);

    mValuePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mValuePaint.setColor(Color.rgb(63, 63, 63));
    mValuePaint.setTextAlign(Align.CENTER);
    mValuePaint.setTextSize(Utils.convertDpToPixel(9f));

    mHighlightPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mHighlightPaint.setStyle(Paint.Style.STROKE);
    mHighlightPaint.setStrokeWidth(2f);
    mHighlightPaint.setColor(Color.rgb(255, 187, 115));
}
项目:GitHub    文件:FlowIndicator.java   
/**
 * 重写绘制指示器view
 * @param canvas
 */
@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    float width = (getWidth() - ((radius * 2 * count) + (space * (count - 1)))) / 2.f;
    Log.d(TAG_FLOWINDICATOR,"当前选中的为:"+this.seleted);
    for (int i = 0; i < count; i++) {
        if (i == seleted) {
            paint.setStyle(Style.FILL);
            canvas.drawBitmap(bmp_selected, 130+width + getPaddingLeft()
                    + radius + i * (space + radius + radius), 0, null);
        } else {
            paint.setStyle(Style.FILL);
            canvas.drawBitmap(bmp_normal, 130+width + getPaddingLeft() + radius
                    + i * (space + radius + radius), 0, null);
        }
    }
}
项目:boohee_v5.6    文件:HorizontalProgressView.java   
private void init(AttributeSet attrs) {
    if (attrs != null) {
        TypedArray array = getContext().obtainStyledAttributes(attrs, R.styleable
                .HorizontalProgressView);
        this.totalNumber = array.getInt(0, 4);
        this.currentNumber = array.getInt(1, 0);
        this.completedColor = array.getColor(2, this.completedColor);
        this.uncompletedColor = array.getColor(3, this.uncompletedColor);
        this.gapWidth = (int) array.getDimension(4, (float) dip(this.gapWidth));
        this.itemWidth = (int) array.getDimension(5, 0.0f);
        array.recycle();
    } else {
        this.gapWidth = dip(this.gapWidth);
    }
    this.paint.setAntiAlias(true);
    this.paint.setStyle(Style.FILL);
}
项目:boohee_v5.6    文件:LineChartRenderer.java   
public LineChartRenderer(Context context, Chart chart, LineChartDataProvider dataProvider) {
    super(context, chart);
    this.dataProvider = dataProvider;
    this.touchToleranceMargin = ChartUtils.dp2px(this.density, 4);
    this.linePaint.setAntiAlias(true);
    this.linePaint.setStyle(Style.STROKE);
    this.linePaint.setStrokeCap(Cap.ROUND);
    this.linePaint.setStrokeWidth((float) ChartUtils.dp2px(this.density, 3));
    this.pointPaint.setAntiAlias(true);
    this.pointPaint.setStyle(Style.FILL);
    this.weightStrPaint.setAntiAlias(true);
    this.weightStrPaint.setColor(-1);
    this.weightStrPaint.setTextSize((float) ChartUtils.dp2px(this.density, 12));
    this.weightLinePaint.setAntiAlias(true);
    this.weightLinePaint.setStyle(Style.STROKE);
    this.weightLinePaint.setStrokeWidth((float) ChartUtils.dp2px(this.density, 1));
    this.weightLinePaint.setColor(ChartUtils.DEFAULT_TARGET_COLOR);
    this.checkPrecision = ChartUtils.dp2px(this.density, 2);
}
项目:FlexibleRichTextView    文件:ShadowBox.java   
public void draw(Canvas g2, float x, float y) {
    float th = thickness / 2;
    box.draw(g2, x + space + thickness, y);
    Paint st = AjLatexMath.getPaint();
    float w = st.getStrokeWidth();
    int c = st.getColor();
    Style s = st.getStyle();
    st.setStrokeWidth(thickness);
    st.setStyle(Style.STROKE);
    float penth = 0;// (float) Math.abs(1 / g2.getTransform().getScaleX());
    g2.drawRect(x + th, y - height + th, x + th + width - shadowRule
            - thickness, y + th + depth - shadowRule - thickness, st);
    st.setStyle(Style.FILL);
    g2.drawRect(x + shadowRule - penth, y + depth - shadowRule - penth, x
            - penth + width, y + depth - penth, st);
    g2.drawRect(x + width - shadowRule - penth, y - height + th
            + shadowRule, x + width - penth, y + shadowRule + depth - 2
            * shadowRule, st);

    st.setColor(c);
    st.setStrokeWidth(w);
    st.setStyle(s);
    st.clearShadowLayer();

}
项目:boohee_v5.6    文件:ScaleIndexView.java   
private void init(Context context) {
    setLayerType(1, null);
    this.mContext = context;
    this.lineHeight = DensityUtil.dip2px(context, (float) this.lineHeight);
    this.textSize = DensityUtil.dip2px(context, (float) this.textSize);
    this.textPaint = new Paint();
    this.textPaint.setAntiAlias(true);
    this.textPaint.setTextSize((float) this.textSize);
    this.textPaint.setTextAlign(Align.LEFT);
    this.textPaint.setColor(AbstractWheelTextAdapter.DEFAULT_TEXT_COLOR);
    this.dividerPaint = new Paint();
    this.dividerPaint.setAntiAlias(true);
    this.dividerPaint.setTextSize((float) this.textSize);
    this.dividerPaint.setTextAlign(Align.LEFT);
    this.dividerPaint.setColor(-1);
    this.dividerPaint.setStrokeWidth(2.0f);
    this.backgroundPaint = new Paint();
    this.backgroundPaint.setAntiAlias(true);
    this.backgroundPaint.setStyle(Style.FILL_AND_STROKE);
    this.backgroundPaint.setStrokeCap(Cap.ROUND);
}
项目:FlexibleRichTextView    文件:TeXFormula.java   
/**
 * @param formula
 *            the formula
 * @param style
 *            the style
 * @param size
 *            the size
 * @param transparency
 *            , if true the background is transparent
 * @return the generated image
 */
public Bitmap createBufferedImage(int style, float size, Integer fg,
        Integer bg) throws ParseException {
    TeXIcon icon = createTeXIcon(style, size);
    icon.setInsets(new Insets(2, 2, 2, 2));
    int w = icon.getIconWidth(), h = icon.getIconHeight();

    Bitmap image = Bitmap.createBitmap(w, h, Config.ARGB_8888);
    Canvas g2 = new Canvas(image);
    if (bg != null) {
        Paint st = new Paint();
        st.setStyle(Style.FILL_AND_STROKE);
        st.setColor(bg);
        g2.drawRect(0, 0, w, h, st);
    }

    icon.setForeground(fg == null ? Color.BLACK : fg);
    icon.paintIcon(g2, 0, 0);

    return image;
}
项目:PasswordNotebook    文件:LockPatternView.java   
/**
 * initialize paints
 */
private void initPaints(){
    defaultPaint = new Paint();
    defaultPaint.setColor(getResources().getColor(R.color.blue_78d2f6));
    defaultPaint.setStrokeWidth(2.0f);
    defaultPaint.setStyle(Style.STROKE);
    defaultPaint.setAntiAlias(true);

    selectPaint = new Paint();
    selectPaint.setColor(getResources().getColor(R.color.blue_00aaee));
    selectPaint.setStrokeWidth(3.0f);
    //selectPaint.setStyle(Style.STROKE);
    selectPaint.setAntiAlias(true);

    errorPaint = new Paint();
    errorPaint.setColor(getResources().getColor(R.color.red_f3323b));
    errorPaint.setStrokeWidth(3.0f);
    //errorPaint.setStyle(Style.STROKE);
    errorPaint.setAntiAlias(true);
}
项目:boohee_v5.6    文件:AxesRenderer.java   
public AxesRenderer(Context context, Chart chart) {
    this.chart = chart;
    this.resources = context.getResources();
    this.mContext = context;
    this.computator = chart.getChartComputator();
    this.density = context.getResources().getDisplayMetrics().density;
    this.scaledDensity = context.getResources().getDisplayMetrics().scaledDensity;
    this.axisMargin = ChartUtils.dp2px(this.density, 2);
    for (int position = 0; position < 4; position++) {
        this.labelPaintTab[position].setStyle(Style.FILL);
        this.labelPaintTab[position].setAntiAlias(true);
        this.namePaintTab[position].setStyle(Style.FILL);
        this.namePaintTab[position].setAntiAlias(true);
        this.linePaintTab[position].setStyle(Style.STROKE);
        this.linePaintTab[position].setAntiAlias(true);
    }
}
项目:SmartMath    文件:FlatChart.java   
/**
 * Draws the chart background.
 */
public void drawBackground(Canvas canvas, double x, double y, double width, double height,
                            Paint paint, com.cyzapps.VisualMFP.Color newColor) {
    int nPaintOriginalColor = paint.getColor();
    Style stylePaintOriginalStyle = paint.getStyle();
    if (newColor != null) { // a valid color
        paint.setColor(newColor.getARGB());
    } else if (mcolorBkGrnd != null)    {
        paint.setColor(mcolorBkGrnd.getARGB());
    }
    paint.setStyle(Style.FILL);
    float fLeft = (float)x, fTop = (float)y, fRight = (float)(x + width), fBottom = (float)(y + height);
    canvas.drawRect(fLeft, fTop, fRight, fBottom, paint);
    // restore paint attribute.
    paint.setStyle(stylePaintOriginalStyle);
    paint.setColor(nPaintOriginalColor);
}
项目:PlusGram    文件:ScrollSlidingTabStrip.java   
public ScrollSlidingTabStrip(Context context) {
    super(context);

    setFillViewport(true);
    setWillNotDraw(false);

    setHorizontalScrollBarEnabled(false);
    tabsContainer = new LinearLayout(context);
    tabsContainer.setOrientation(LinearLayout.HORIZONTAL);
    tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    addView(tabsContainer);

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

    defaultTabLayoutParams = new LinearLayout.LayoutParams(AndroidUtilities.dp(52), LayoutHelper.MATCH_PARENT);
}
项目:GravityBox    文件:PieItem.java   
public PieItem(Context context, Context gbContext, PieLayout parent, int flags, int width, 
        Object tag, View view, PieController.ColorInfo colorInfo) {
    mContext = context;
    mGbResources = gbContext.getResources();
    mView = view;
    mPieLayout = parent;
    this.tag = tag;
    this.width = width;
    this.flags = flags | PieDrawable.VISIBLE | PieDrawable.DISPLAY_ALL;

    mBackgroundPaint.setAntiAlias(true);
    mSelectedPaint.setAntiAlias(true);
    mOutlinePaint.setAntiAlias(true);
    mOutlinePaint.setStyle(Style.STROKE);
    mOutlinePaint.setStrokeWidth(mGbResources.getDimensionPixelSize(R.dimen.pie_outline));

    setColor(colorInfo);
}
项目:boohee_v5.6    文件:ColumnChartRenderer.java   
public ColumnChartRenderer(Context context, Chart chart, ColumnChartDataProvider dataProvider) {
    super(context, chart);
    this.dataProvider = dataProvider;
    this.subcolumnSpacing = ChartUtils.dp2px(this.density, 1);
    this.touchAdditionalWidth = ChartUtils.dp2px(this.density, 4);
    this.columnPaint.setAntiAlias(true);
    this.columnPaint.setStyle(Style.FILL);
    this.columnPaint.setStrokeCap(Cap.SQUARE);
    this.caloryLinePaint.setAntiAlias(true);
    this.caloryLinePaint.setStyle(Style.STROKE);
    this.caloryLinePaint.setStrokeWidth((float) ChartUtils.dp2px(this.density, 1));
    this.caloryLinePaint.setColor(ChartUtils.DEFAULT_TARGET_COLOR);
    this.caloryTextPaint.setAntiAlias(true);
    this.caloryTextPaint.setStyle(Style.FILL);
    this.caloryTextPaint.setTextSize((float) ChartUtils.dp2px(this.density, 12));
    this.caloryTextPaint.setColor(ChartUtils.COLOR_BACKGROUND);
}
项目:airgram    文件:PagerSlidingTabStrip.java   
public PagerSlidingTabStrip(Context context) {
    super(context);

    setFillViewport(true);
    setWillNotDraw(false);

    tabsContainer = new LinearLayout(context);
    tabsContainer.setOrientation(LinearLayout.HORIZONTAL);
    tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    addView(tabsContainer);

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

    defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutHelper.MATCH_PARENT);
}
项目:boohee_v5.6    文件:LineChartRenderer.java   
public LineChartRenderer(Context context, Chart chart, LineChartDataProvider dataProvider, LineChartView lineChartView) {
    super(context, chart);
    this.dataProvider = dataProvider;
    this.lineChartView = lineChartView;
    this.touchToleranceMargin = ChartUtils.dp2px(this.density, 4);
    this.linePaint.setAntiAlias(true);
    this.linePaint.setStyle(Style.STROKE);
    this.linePaint.setStrokeCap(Cap.ROUND);
    this.linePaint.setStrokeWidth((float) ChartUtils.dp2px(this.density, 3));
    this.pointPaint.setAntiAlias(true);
    this.pointPaint.setStyle(Style.FILL);
    this.weightStrPaint.setAntiAlias(true);
    this.weightStrPaint.setColor(-1);
    this.weightStrPaint.setTextSize((float) ChartUtils.dp2px(this.density, 12));
    this.weightLinePaint.setAntiAlias(true);
    this.weightLinePaint.setStyle(Style.STROKE);
    this.weightLinePaint.setStrokeWidth((float) ChartUtils.dp2px(this.density, 1));
    this.weightLinePaint.setColor(ChartUtils.DEFAULT_TARGET_COLOR);
    this.checkPrecision = ChartUtils.dp2px(this.density, 2);
}
项目:Rey-MusicPlayer    文件:RangeSeekBar.java   
/**
 * Draws the widget on the given canvas.
 */
@Override
protected synchronized void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    // draw seek bar background line
    final RectF rect = new RectF(padding, 0.5f * (getHeight() - lineHeight), getWidth() - padding, 0.5f * (getHeight() + lineHeight));
    paint.setStyle(Style.FILL);
    paint.setColor(ContextCompat.getColor(getContext(), R.color.pink));
    paint.setAntiAlias(true);
    canvas.drawRect(rect, paint);

    // draw seek bar active range line
    rect.left = normalizedToScreen(normalizedMinValue);
    rect.right = normalizedToScreen(normalizedMaxValue);

    // orange color
    paint.setColor(Color.GRAY);
    canvas.drawRect(rect, paint);

    // draw minimum thumb
    drawThumb(normalizedToScreen(normalizedMinValue), Thumb.MIN.equals(pressedThumb), canvas);

    // draw maximum thumb
    drawThumb(normalizedToScreen(normalizedMaxValue), Thumb.MAX.equals(pressedThumb), canvas);
}
项目:ForeverLibrary    文件:RoundProgressBarWidthNumber.java   
public RoundProgressBarWidthNumber(Context context, AttributeSet attrs) {
    super(context, attrs);

    mReachedProgressBarHeight = (int) (mUnReachedProgressBarHeight * 2.5f);
    TypedArray ta = context.obtainStyledAttributes(attrs,
            R.styleable.RoundProgressBarWidthNumber);
    mRadius = (int) ta.getDimension(
            R.styleable.RoundProgressBarWidthNumber_radius, mRadius);
    ta.recycle();

    mPaint.setStyle(Style.STROKE);
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setStrokeCap(Cap.ROUND);

}
项目:Selector    文件:LinePoint.java   
private void init(Context context) {
    getStrokePaint().setColor(0xffffffff);
    getStrokePaint().setStyle(Style.STROKE);
    getStrokePaint().setAntiAlias(true);
    getStrokePaint().setStrokeWidth(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
                                                              2,
                                                              context.getResources().getDisplayMetrics()));
    getFillPaint().setColor(context.getResources().getColor(R.color.chart_point_line_color));

    waiPaint.setColor(context.getResources().getColor(R.color.chart_waiyuan_color));
    waiPaint.setAntiAlias(true);

    getTextPaint().setColor(0xcc444444);
    getTextPaint().setAntiAlias(true);
    getTextPaint().setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
                                                         10,
                                                         context.getResources().getDisplayMetrics()));
}
项目:buildAPKsApps    文件:RangeBarChart.java   
/**
 * The graphical representation of a series.
 * 
 * @param canvas the canvas to paint to
 * @param paint the paint to be used for drawing
 * @param points the array of points to be used for drawing the series
 * @param seriesRenderer the series renderer
 * @param yAxisValue the minimum value of the y axis
 * @param seriesIndex the index of the series currently being drawn
 * @param startIndex the start index of the rendering points
 */
@Override
public void drawSeries(Canvas canvas, Paint paint, List<Float> points,
    XYSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex) {
  int seriesNr = mDataset.getSeriesCount();
  int length = points.size();
  paint.setColor(seriesRenderer.getColor());
  paint.setStyle(Style.FILL);
  float halfDiffX = getHalfDiffX(points, length, seriesNr);
  int start = 0;
  if (startIndex > 0) {
    start = 2;
  }
  for (int i = start; i < length; i += 4) {
    if (points.size() > i + 3) {
      float xMin = points.get(i);
      float yMin = points.get(i + 1);
      // xMin = xMax
      float xMax = points.get(i + 2);
      float yMax = points.get(i + 3);
      drawBar(canvas, xMin, yMin, xMax, yMax, halfDiffX, seriesNr, seriesIndex, paint);
    }
  }
  paint.setColor(seriesRenderer.getColor());
}
项目:boohee_v5.6    文件:DragScaleImageView.java   
private void init() {
    int width;
    setClickable(true);
    setOnTouchListener(this);
    initScreenWidthHeight();
    this.resizeBmp = BitmapFactory.decodeResource(getResources(), R.drawable.vg);
    this.closeBmp = BitmapFactory.decodeResource(getResources(), R.drawable.vf);
    if (this.resizeBmp.getWidth() > this.resizeBmp.getHeight()) {
        width = this.resizeBmp.getWidth();
    } else {
        width = this.resizeBmp.getHeight();
    }
    this.touchRegion = width;
    setPadding(this.touchRegion / 2, this.touchRegion / 2, this.touchRegion / 2, this
            .touchRegion / 2);
    this.paint.setColor(-1);
    this.paint.setStrokeWidth(aj.hA);
    this.paint.setStyle(Style.STROKE);
}
项目:SortingHatAndroid    文件:BorderedText.java   
/**
 * Create a bordered text object with the specified interior and exterior colors, text size and
 * alignment.
 *
 * @param interiorColor the interior text color
 * @param exteriorColor the exterior text color
 * @param textSize text size in pixels
 */
public BorderedText(final int interiorColor, final int exteriorColor, final float textSize) {
  interiorPaint = new Paint();
  interiorPaint.setTextSize(textSize);
  interiorPaint.setColor(interiorColor);
  interiorPaint.setStyle(Style.FILL);
  interiorPaint.setAntiAlias(false);
  interiorPaint.setAlpha(255);

  exteriorPaint = new Paint();
  exteriorPaint.setTextSize(textSize);
  exteriorPaint.setColor(exteriorColor);
  exteriorPaint.setStyle(Style.FILL_AND_STROKE);
  exteriorPaint.setStrokeWidth(textSize / 8);
  exteriorPaint.setAntiAlias(false);
  exteriorPaint.setAlpha(255);

  this.textSize = textSize;
}
项目:FlexibleRichTextView    文件:HorizontalRule.java   
public void draw(Canvas g2, float x, float y) {
Paint st = AjLatexMath.getPaint();
Style s = st.getStyle();
float w = st.getStrokeWidth();
st.setStyle(Style.FILL);
st.setStrokeWidth(0);
int c = st.getColor();
if (color != null)
    st.setColor(color);
if (speShift == 0) {
    g2.drawRect(x, y - height, x + width, y, st);
} else {
    g2.drawRect(x, y - height + speShift, x + width, y + speShift, st);
}
    st.setColor(c);
    st.setStyle(s);
st.setStrokeWidth(w);
   }
项目:buildAPKsSamples    文件:GameView.java   
/**
 * The colorIndex is used to create the color based on the lower three
 * bits of the value in the current implementation.
 *
 * @param colorIndex
 */
public Ship(int colorIndex) {
    mPaint = new Paint();
    mPaint.setStyle(Style.FILL);

    setPosition(getWidth() * 0.5f, getHeight() * 0.5f);
    setVelocity(0, 0);
    setSize(mShipSize);

    mPath = new Path();
    mPath.moveTo(0, 0);
    mPath.lineTo((float) Math.cos(-CORNER_ANGLE) * mSize,
            (float) Math.sin(-CORNER_ANGLE) * mSize);
    mPath.lineTo(mSize, 0);
    mPath.lineTo((float) Math.cos(CORNER_ANGLE) * mSize,
            (float) Math.sin(CORNER_ANGLE) * mSize);
    mPath.lineTo(0, 0);

    mR = (colorIndex & 0x01) == 0 ? 63 : 255;
    mG = (colorIndex & 0x02) == 0 ? 63 : 255;
    mB = (colorIndex & 0x04) == 0 ? 63 : 255;

    mColor = colorIndex;
}
项目:HeroVideo-master    文件:CircleProgressView.java   
/**
 * Set the properties of the paints we're using to draw the progress wheel
 */
private void setupPaints()
{

    barPaint.setColor(barColor);
    barPaint.setAntiAlias(true);
    barPaint.setStyle(Style.STROKE);
    barPaint.setStrokeWidth(barWidth);

    rimPaint.setColor(rimColor);
    rimPaint.setAntiAlias(true);
    rimPaint.setStyle(Style.STROKE);
    rimPaint.setStrokeWidth(rimWidth);
}
项目:letv    文件:VideoShotEditActivity.java   
private boolean saveFileAddedVoice(String path, String voice, String savePath) {
    LogInfo.log("fornia", "voice:" + voice);
    if (!new File(path).exists()) {
        return false;
    }
    Options options = new Options();
    options.inJustDecodeBounds = false;
    Bitmap bitmap0 = BitmapFactory.decodeFile(path, options);
    int width = options.outWidth;
    int height = options.outHeight;
    Bitmap bitmapPic = Bitmap.createBitmap(width, height, Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmapPic);
    canvas.drawBitmap(bitmap0, null, new Rect(0, 0, width, height), null);
    Rect targetBgRect = new Rect(0, height - getTextBgHeight(), width, height);
    if (!isOrigPicMode) {
        Paint voiceBgPaint = new Paint();
        voiceBgPaint.setColor(getResources().getColor(2131493164));
        voiceBgPaint.setStyle(Style.FILL);
        voiceBgPaint.setFlags(2);
        canvas.drawRect(targetBgRect, voiceBgPaint);
        voiceBgPaint.setColor(-1);
        voiceBgPaint.setTextSize((float) getTextSize());
        voiceBgPaint.setTextAlign(Align.CENTER);
        FontMetricsInt fontMetrics = voiceBgPaint.getFontMetricsInt();
        String str = voice;
        canvas.drawText(str, (float) targetBgRect.centerX(), (float) ((targetBgRect.top + ((((targetBgRect.bottom - targetBgRect.top) - fontMetrics.bottom) + fontMetrics.top) / 2)) - fontMetrics.top), voiceBgPaint);
    }
    return FileUtils.saveBitmapByUser(this.mContext, bitmapPic);
}
项目:SDHtmlTextView    文件:TableHandler.java   
@Override
public void draw(Canvas canvas) {
    Paint paint = new Paint();
    paint.setColor(textColor);
    paint.setStyle(Style.STROKE);

    int numberOfColumns = tableRow.size();

    if (numberOfColumns == 0) {
        return;
    }

    int columnWidth = tableWidth / numberOfColumns;

    int offset = 0;

    for (int i = 0; i < numberOfColumns; i++) {

        offset = i * columnWidth;

              if ( paintBorder ) {
            // The rect is open at the bottom, so there's a single line
            // between rows.
            canvas.drawRect(offset, 0, offset + columnWidth, rowHeight,
                paint);
              }

        StaticLayout layout = new StaticLayout(tableRow.get(i),
                getTextPaint(), (columnWidth - 2 * PADDING),
                Alignment.ALIGN_NORMAL, 1f, 0f, true);

        canvas.translate(offset + PADDING, 0);
        layout.draw(canvas);
        canvas.translate(-1 * (offset + PADDING), 0);

    }
}
项目:QSRefreshLayout    文件:MaterialProgressDrawable.java   
public Ring(Callback callback) {
    mCallback = callback;

    mPaint.setStrokeCap(Paint.Cap.SQUARE);
    mPaint.setAntiAlias(true);
    mPaint.setStyle(Style.STROKE);

    mArrowPaint.setStyle(Style.FILL);
    mArrowPaint.setAntiAlias(true);
}
项目:GitHub    文件:PieChartRenderer.java   
public PieChartRenderer(PieChart chart, ChartAnimator animator,
                        ViewPortHandler viewPortHandler) {
    super(animator, viewPortHandler);
    mChart = chart;

    mHolePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mHolePaint.setColor(Color.WHITE);
    mHolePaint.setStyle(Style.FILL);

    mTransparentCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mTransparentCirclePaint.setColor(Color.WHITE);
    mTransparentCirclePaint.setStyle(Style.FILL);
    mTransparentCirclePaint.setAlpha(105);

    mCenterTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    mCenterTextPaint.setColor(Color.BLACK);
    mCenterTextPaint.setTextSize(Utils.convertDpToPixel(12f));

    mValuePaint.setTextSize(Utils.convertDpToPixel(13f));
    mValuePaint.setColor(Color.WHITE);
    mValuePaint.setTextAlign(Align.CENTER);

    mEntryLabelsPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mEntryLabelsPaint.setColor(Color.WHITE);
    mEntryLabelsPaint.setTextAlign(Align.CENTER);
    mEntryLabelsPaint.setTextSize(Utils.convertDpToPixel(13f));

    mValueLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mValueLinePaint.setStyle(Style.STROKE);
}
项目:GridPagerSnapHelper    文件:CirclePageIndicator.java   
public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode()) return;

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
    final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
    final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
    final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
    final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
    final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
    final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
    final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke.setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();
}
项目:boohee_v5.6    文件:RingView.java   
private void init(Context context) {
    this.RING_WIDTH = DensityUtil.dip2px(context, (float) this.RING_WIDTH);
    this.TEXT_SIZE = DensityUtil.dip2px(context, (float) this.TEXT_SIZE);
    this.mPaint = new Paint();
    this.mPaint.setAntiAlias(true);
    this.mPaint.setStyle(Style.STROKE);
    this.mPaint.setStrokeWidth((float) this.RING_WIDTH);
    this.mTextPaint = new Paint();
    this.mTextPaint.setAntiAlias(true);
    this.mTextPaint.setTextAlign(Align.LEFT);
    this.mTextPaint.setTextSize((float) this.TEXT_SIZE);
    this.mPath = new Path();
    this.mTextRect = new Rect();
}
项目:TreebolicLib    文件:Graphics.java   
@Override
public void drawOval(final float left, final float top, final float width, final float height)
{
    final RectF rect = Rectangle2D.makeRect(left, top, width, height);
    this.paint.setStyle(Style.STROKE);
    this.canvas.drawOval(rect, this.paint);
}
项目:SwipeToRefresh    文件:MaterialProgressDrawable.java   
public Ring(Callback callback) {
    mCallback = callback;

    mPaint.setStrokeCap(Paint.Cap.SQUARE);
    mPaint.setAntiAlias(true);
    mPaint.setStyle(Style.STROKE);

    mArrowPaint.setStyle(Style.FILL);
    mArrowPaint.setAntiAlias(true);
}
项目:financisto1-holo    文件:GraphStyle.java   
public GraphStyle build() {
          float density = context.getResources().getDisplayMetrics().density;
    Rect rect = new Rect();
    Paint namePaint = new Paint();
    Paint amountPaint = new Paint();
    Paint linePaint = new Paint();
    namePaint.setColor(Color.WHITE);
    namePaint.setAntiAlias(true);
    namePaint.setTextAlign(Align.LEFT);
    namePaint.setTextSize(spToPx(nameTextSize, density));
    namePaint.setTypeface(Typeface.DEFAULT_BOLD);
    namePaint.getTextBounds("A", 0, 1, rect);       
    int nameHeight = rect.height();
    amountPaint.setColor(Color.WHITE);
    amountPaint.setAntiAlias(true);
    amountPaint.setTextSize(spToPx(amountTextSize, density));
    amountPaint.setTextAlign(Align.CENTER);
    amountPaint.getTextBounds("8", 0, 1, rect);     
    int amountHeight = rect.height();
    linePaint.setStyle(Style.FILL);
    return new GraphStyle(
            spToPx(dy, density),
                  spToPx(textDy, density),
                  spToPx(indent, density),
            spToPx(lineHeight, density),
                  nameHeight,
                  amountHeight,
            namePaint,
                  amountPaint,
                  linePaint);
}
项目:GitHub    文件:MaterialProgressDrawable.java   
public Ring(Callback callback) {
    mCallback = callback;

    mPaint.setStrokeCap(Paint.Cap.SQUARE);
    mPaint.setAntiAlias(true);
    mPaint.setStyle(Style.STROKE);

    mArrowPaint.setStyle(Paint.Style.FILL);
    mArrowPaint.setAntiAlias(true);
}
项目:AndroidUiKit    文件:MaterialProgressDrawable.java   
Ring(Callback callback) {
    mCallback = callback;

    mPaint.setStrokeCap(Paint.Cap.SQUARE);
    mPaint.setAntiAlias(true);
    mPaint.setStyle(Style.STROKE);

    mArrowPaint.setStyle(Style.FILL);
    mArrowPaint.setAntiAlias(true);
}
项目:letv    文件:VideoShotEditActivity.java   
private String getFileAddedWatermark(String path, String text, String voice) {
    if (!new File(path).exists()) {
        return null;
    }
    Options options = new Options();
    options.inJustDecodeBounds = false;
    Bitmap bitmap0 = BitmapFactory.decodeFile(path, options);
    int width = options.outWidth;
    int height = options.outHeight;
    Bitmap bitmapPic = Bitmap.createBitmap(width, height, Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmapPic);
    canvas.drawBitmap(bitmap0, null, new Rect(0, 0, width, height), null);
    Paint textPaint = new Paint();
    textPaint.setColor(-1);
    textPaint.setTextSize((float) getTextSize());
    textPaint.setFlags(2);
    canvas.drawText(text, 0, text.length(), 30.0f, 50.0f, textPaint);
    Rect rect = new Rect(0, height - getTextBgHeight(), width, height);
    if (!isOrigPicMode) {
        Paint voiceBgPaint = new Paint();
        voiceBgPaint.setColor(getResources().getColor(2131493164));
        voiceBgPaint.setStyle(Style.FILL);
        voiceBgPaint.setFlags(2);
        canvas.drawRect(rect, voiceBgPaint);
        voiceBgPaint.setColor(-1);
        voiceBgPaint.setTextSize((float) getTextSize());
        voiceBgPaint.setTextAlign(Align.CENTER);
        FontMetricsInt fontMetrics = voiceBgPaint.getFontMetricsInt();
        int baseline = (rect.top + ((((rect.bottom - rect.top) - fontMetrics.bottom) + fontMetrics.top) / 2)) - fontMetrics.top;
        canvas.drawText(voice, (float) rect.centerX(), (float) baseline, voiceBgPaint);
    }
    return saveBitmap(bitmapPic);
}
项目:ForeverLibrary    文件:DatePickerView.java   
private void init() {
    timer = new Timer();
    mDataList = new ArrayList<>();
    //第一个paint
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStyle(Style.FILL);
    mPaint.setTextAlign(Align.CENTER);
    mPaint.setColor(ContextCompat.getColor(context, R.color.text1));
    //第二个paint
    nPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    nPaint.setStyle(Style.FILL);
    nPaint.setTextAlign(Align.CENTER);
    nPaint.setColor(ContextCompat.getColor(context, R.color.text2));
}
项目:GitHub    文件:FireView.java   
private void init() {
    holder = this.getHolder();//获取holder
    holder.addCallback(this);
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setStyle(Style.FILL);
    mPaint.setStrokeWidth(0);
    mPaint.setColor(bottomColor);
}
项目:GitHub    文件:MaterialProgressDrawable.java   
public Ring(Callback callback) {
    mCallback = callback;

    mPaint.setStrokeCap(Paint.Cap.SQUARE);
    mPaint.setAntiAlias(true);
    mPaint.setStyle(Style.STROKE);

    mArrowPaint.setStyle(Paint.Style.FILL);
    mArrowPaint.setAntiAlias(true);
}