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);
}
java类android.graphics.Paint.Style的实例源码
RoundProgressBarWidthNumber.java 文件源码
项目:MyRepository
阅读 48
收藏 0
点赞 0
评论 0
DataRenderer.java 文件源码
项目:GitHub
阅读 39
收藏 0
点赞 0
评论 0
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));
}
FlowIndicator.java 文件源码
项目:GitHub
阅读 57
收藏 0
点赞 0
评论 0
/**
* 重写绘制指示器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);
}
}
}
HorizontalProgressView.java 文件源码
项目:boohee_v5.6
阅读 31
收藏 0
点赞 0
评论 0
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);
}
LineChartRenderer.java 文件源码
项目:boohee_v5.6
阅读 38
收藏 0
点赞 0
评论 0
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);
}
ShadowBox.java 文件源码
项目:FlexibleRichTextView
阅读 48
收藏 0
点赞 0
评论 0
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();
}
ScaleIndexView.java 文件源码
项目:boohee_v5.6
阅读 48
收藏 0
点赞 0
评论 0
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);
}
TeXFormula.java 文件源码
项目:FlexibleRichTextView
阅读 46
收藏 0
点赞 0
评论 0
/**
* @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;
}
LockPatternView.java 文件源码
项目:PasswordNotebook
阅读 34
收藏 0
点赞 0
评论 0
/**
* 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);
}
AxesRenderer.java 文件源码
项目:boohee_v5.6
阅读 34
收藏 0
点赞 0
评论 0
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);
}
}
FlatChart.java 文件源码
项目:SmartMath
阅读 40
收藏 0
点赞 0
评论 0
/**
* 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);
}
ScrollSlidingTabStrip.java 文件源码
项目:PlusGram
阅读 50
收藏 0
点赞 0
评论 0
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);
}
PieItem.java 文件源码
项目:GravityBox
阅读 38
收藏 0
点赞 0
评论 0
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);
}
ColumnChartRenderer.java 文件源码
项目:boohee_v5.6
阅读 41
收藏 0
点赞 0
评论 0
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);
}
PagerSlidingTabStrip.java 文件源码
项目:airgram
阅读 45
收藏 0
点赞 0
评论 0
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);
}
LineChartRenderer.java 文件源码
项目:boohee_v5.6
阅读 42
收藏 0
点赞 0
评论 0
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);
}
RangeSeekBar.java 文件源码
项目:Rey-MusicPlayer
阅读 48
收藏 0
点赞 0
评论 0
/**
* 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);
}
RoundProgressBarWidthNumber.java 文件源码
项目:ForeverLibrary
阅读 53
收藏 0
点赞 0
评论 0
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);
}
LinePoint.java 文件源码
项目:Selector
阅读 40
收藏 0
点赞 0
评论 0
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()));
}
RangeBarChart.java 文件源码
项目:buildAPKsApps
阅读 37
收藏 0
点赞 0
评论 0
/**
* 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());
}
DragScaleImageView.java 文件源码
项目:boohee_v5.6
阅读 40
收藏 0
点赞 0
评论 0
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);
}
BorderedText.java 文件源码
项目:SortingHatAndroid
阅读 33
收藏 0
点赞 0
评论 0
/**
* 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;
}
HorizontalRule.java 文件源码
项目:FlexibleRichTextView
阅读 31
收藏 0
点赞 0
评论 0
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);
}
GameView.java 文件源码
项目:buildAPKsSamples
阅读 43
收藏 0
点赞 0
评论 0
/**
* 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;
}
CircleProgressView.java 文件源码
项目:HeroVideo-master
阅读 34
收藏 0
点赞 0
评论 0
/**
* 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);
}
VideoShotEditActivity.java 文件源码
项目:letv
阅读 36
收藏 0
点赞 0
评论 0
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);
}
TableHandler.java 文件源码
项目:SDHtmlTextView
阅读 36
收藏 0
点赞 0
评论 0
@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);
}
}
MaterialProgressDrawable.java 文件源码
项目:QSRefreshLayout
阅读 44
收藏 0
点赞 0
评论 0
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);
}
PieChartRenderer.java 文件源码
项目:GitHub
阅读 46
收藏 0
点赞 0
评论 0
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);
}
CirclePageIndicator.java 文件源码
项目:GridPagerSnapHelper
阅读 31
收藏 0
点赞 0
评论 0
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();
}