当前位置: 首页>>代码示例>>Java>>正文


Java Paint.getColor方法代码示例

本文整理汇总了Java中android.graphics.Paint.getColor方法的典型用法代码示例。如果您正苦于以下问题:Java Paint.getColor方法的具体用法?Java Paint.getColor怎么用?Java Paint.getColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Paint的用法示例。


在下文中一共展示了Paint.getColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: draw

import android.graphics.Paint; //导入方法依赖的package包/类
@Override
public void draw(@NonNull final Canvas canvas, final CharSequence text,
                 @IntRange(from = 0) final int start,
                 @IntRange(from = 0) final int end,
                 final float x, final int top, final int y, final int bottom,
                 @NonNull final Paint paint) {
    Paint.Style style = paint.getStyle();
    int color = paint.getColor();

    paint.setStyle(Paint.Style.FILL);
    paint.setColor(this.color);

    canvas.drawRect(x, top, x + width, bottom, paint);

    paint.setStyle(style);
    paint.setColor(color);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:SpanUtils.java

示例2: drawPressPoint

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * 绘制按下状态的点
 *
 * @param point      单位点
 * @param canvas     画布
 * @param pressPaint 按下状态画笔
 */
@Override
public void drawPressPoint(Point point, Canvas canvas, Paint pressPaint) {
    int originColor = pressPaint.getColor();
    // 1.绘制白色底圆
    pressPaint.setStyle(Paint.Style.FILL);
    pressPaint.setColor(Color.WHITE);
    canvas.drawCircle(point.x, point.y, point.radius, pressPaint);
    // 2.绘制实心点
    pressPaint.setColor(originColor);
    canvas.drawCircle(point.x, point.y, point.radius / 3.0F, pressPaint);
    // 3.绘制外部边界圆
    pressPaint.setStyle(Paint.Style.STROKE);
    pressPaint.setStrokeWidth(point.radius / 20.0F);
    canvas.drawCircle(point.x, point.y, point.radius, pressPaint);
}
 
开发者ID:sinawangnan7,项目名称:GestureLockView,代码行数:23,代码来源:LUcomPainter.java

示例3: draw1LineTextAnchorMid

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * Draw a single line text, x, y is in the middle of the line.
 */
public void draw1LineTextAnchorMid(Canvas canvas, String text, double x, double y,
		Paint paint, com.cyzapps.VisualMFP.Color color, double dTextSize, double dRotateDegree) {
	
	float fRotateDegree = (float)dRotateDegree, fX = (float)x, fY = (float)y;
	if (dRotateDegree != 0)	{
		canvas.rotate(fRotateDegree, fX, fY);
	}
	int nPaintOriginalColor = paint.getColor();
	float fPaintOriginalTxtSize = paint.getTextSize();
	if (color != null)	{
		paint.setColor(color.getARGB());
	}	// otherwise, use paint's color.
	paint.setTextSize((float)dTextSize);
	float fWidth = paint.measureText(text);
	canvas.drawText(text, fX - fWidth/2, fY + (float)dTextSize/2 - paint.descent(), paint);
	paint.setTextSize(fPaintOriginalTxtSize);
	paint.setColor(nPaintOriginalColor);
	if (dRotateDegree != 0) {
		canvas.rotate(-fRotateDegree, fX, fY);
	}
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:25,代码来源:FlatChart.java

示例4: drawLeadingMargin

import android.graphics.Paint; //导入方法依赖的package包/类
public void drawLeadingMargin(Canvas c,
                              Paint p,
                              int x,
                              int dir,
                              int top,
                              int baseline,
                              int bottom,
                              CharSequence text,
                              int start,
                              int end,
                              boolean first,
                              Layout layout) {
    Paint.Style prevStyle = p.getStyle();
    int prevColor = p.getColor();
    p.setStyle(Paint.Style.FILL);
    p.setColor(lineColor);
    c.drawRect(x, top, x + dir * lineWidth, bottom, p);
    p.setStyle(prevStyle);
    p.setColor(prevColor);
}
 
开发者ID:PaulKlinger,项目名称:Sprog-App,代码行数:21,代码来源:FancyQuoteSpan.java

示例5: draw

import android.graphics.Paint; //导入方法依赖的package包/类
public void draw(Canvas g2, float x, float y) {
	g2.save();
	Paint st = AjLatexMath.getPaint();
	int c = st.getColor();
	Style s = st.getStyle();
	float w = st.getStrokeWidth();

	g2.translate(x + 0.25f * height / 2.15f, y - 1.75f / 2.15f * height);
	st.setColor(gray);
	st.setStrokeWidth(3.79999995f);
	g2.scale(0.05f * height / 2.15f, 0.05f * height / 2.15f);
	g2.rotate((float) Math.toDegrees((-26 * Math.PI / 180)), 20.5f, 17.5f);
	g2.drawArc(new RectF(0f, 0f, 43f, 32f), 0f, 360f, false, st);
	g2.rotate((float) Math.toDegrees((26 * Math.PI / 180)), 20.5f, 17.5f);
	st.setStyle(Style.STROKE);
	drawCircle(st, g2, 16f, -5f);
	drawCircle(st, g2, -1f, 7f);
	drawCircle(st, g2, 5f, 28f);
	drawCircle(st, g2, 27f, 24f);
	drawCircle(st, g2, 36f, 3f);

	st.setColor(c);
	st.setStyle(s);
	st.setStrokeWidth(w);
	g2.restore();
}
 
开发者ID:daquexian,项目名称:FlexibleRichTextView,代码行数:27,代码来源:GeoGebraLogoBox.java

示例6: drawBackground

import android.graphics.Paint; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:20,代码来源:FlatChart.java

示例7: drawLeadingMargin

import android.graphics.Paint; //导入方法依赖的package包/类
public void drawLeadingMargin(final Canvas c, final Paint p, final int x, final int dir,
                              final int top, final int baseline, final int bottom,
                              final CharSequence text, final int start, final int end,
                              final boolean first, final Layout layout) {
    Paint.Style style = p.getStyle();
    int color = p.getColor();

    p.setStyle(Paint.Style.FILL);
    p.setColor(this.color);

    c.drawRect(x, top, x + dir * stripeWidth, bottom, p);

    p.setStyle(style);
    p.setColor(color);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:SpanUtils.java

示例8: drawBackground

import android.graphics.Paint; //导入方法依赖的package包/类
@Override
public void drawBackground(Canvas c, Paint p, int left, int right, int top, int baseline, int bottom, CharSequence text, int start, int end, int lnum) {
    final int paintColorBak = p.getColor();
    boolean isFirstLineOfParagraph = _previousParagraphBeginIndex != start;
    drawBackground(c, p, left, right, top, baseline, bottom, text, start, end, lnum, isFirstLineOfParagraph);
    _previousParagraphBeginIndex = end;
    p.setColor(paintColorBak);
}
 
开发者ID:gsantner,项目名称:markor,代码行数:9,代码来源:BackgroundParagraphSpan.java

示例9: drawBackground

import android.graphics.Paint; //导入方法依赖的package包/类
@Override
public void drawBackground(
        Canvas canvas, Paint paint,
        int left, int right, int top, int baseline, int bottom,
        CharSequence charSequence,
        int start, int end, int lineNum
) {
    int oldColor = paint.getColor();
    if (color != 0) {
        paint.setColor(color);
    }
    canvas.drawCircle((left + right) / 2, bottom + radius, radius, paint);
    paint.setColor(oldColor);
}
 
开发者ID:ptrstovka,项目名称:calendarview2,代码行数:15,代码来源:DotSpan.java

示例10: applyListItemStyle

import android.graphics.Paint; //导入方法依赖的package包/类
public void applyListItemStyle(@NonNull Paint paint) {

        final int color;
        if (listItemColor != 0) {
            color = listItemColor;
        } else {
            color = paint.getColor();
        }
        paint.setColor(color);

        if (bulletListItemStrokeWidth != 0) {
            paint.setStrokeWidth(bulletListItemStrokeWidth);
        }
    }
 
开发者ID:noties,项目名称:Markwon,代码行数:15,代码来源:SpannableTheme.java

示例11: draw

import android.graphics.Paint; //导入方法依赖的package包/类
@Override public void draw(@NonNull Canvas canvas, CharSequence text, int start, int end, float x, int top,
                           int y, int bottom, @NonNull Paint paint) {
    final int currentColor = paint.getColor();
    paint.setColor(color);
    paint.setStyle(Paint.Style.FILL);
    int height = 10;
    canvas.drawRect(new Rect(0, bottom - height, (int) x + width, bottom), paint);
    paint.setColor(currentColor);
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:10,代码来源:HrSpan.java

示例12: drawBackground

import android.graphics.Paint; //导入方法依赖的package包/类
@Override public void drawBackground(Canvas c, Paint p, int left, int right, int top, int baseline, int bottom,
                                     CharSequence text, int start, int end, int lnum) {
    Paint.Style style = p.getStyle();
    int color = p.getColor();
    p.setStyle(Paint.Style.FILL);
    p.setColor(this.color);
    rect.set(left, top, right, bottom);
    c.drawRect(rect, p);
    p.setColor(color);
    p.setStyle(style);
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:12,代码来源:CodeBackgroundRoundedSpan.java

示例13: draw

import android.graphics.Paint; //导入方法依赖的package包/类
@Override
public void draw(Canvas canvas, double x, double y, double width, double height, Paint paint) {
	Log.e(LOG_TAG, "in XYChart.draw");
	
	//calcCoordArea(x, y, width, height);
	//update();

	int nPaintOriginalColor = paint.getColor();
	// draw background
	paint.setColor(mcolorBkGrnd.getARGB());
	drawBackground(canvas, x, y, width, height, paint, null);
	
	paint.setColor(mcolorForeGrnd.getARGB());
	// draw title
	draw1LineTextAnchorMid(canvas, mstrChartTitle, width / 2, y + mdSmallSize/2, paint, null, mdSmallSize, 0);
	
	
	// draw x-axis
	drawAxis(canvas, mcaXAxis, mp3CoordLeftBottomInTO.getX(), mp3CoordLeftBottomInTO.getY(),
			mp3CoordLeftBottomInTO.getX() + mdCoordWidth, mp3CoordLeftBottomInTO.getY(),
			paint, mcolorForeGrnd, false);
	// draw y-axis
	drawAxis(canvas, mcaYAxis, mp3CoordLeftBottomInTO.getX(), mp3CoordLeftBottomInTO.getY(),
			mp3CoordLeftBottomInTO.getX(), mp3CoordLeftBottomInTO.getY() - mdCoordHeight,
			paint, mcolorForeGrnd, true);
	
	paint.setColor(mcolorHint.getARGB());
	// draw a rectangle for drawing area
	float fCoordLeft = (float)mp3CoordLeftBottomInTO.getX(),
			fCoordTop = (float)(mp3CoordLeftBottomInTO.getY() - mdCoordHeight),
			fCoordRight = (float)(mp3CoordLeftBottomInTO.getX() + mdCoordWidth),
			fCoordBottom = (float)mp3CoordLeftBottomInTO.getY();
	canvas.drawLine(fCoordLeft, fCoordTop, fCoordRight, fCoordTop, paint);
	canvas.drawLine(fCoordRight, fCoordTop, fCoordRight, fCoordBottom, paint);
	
	if (mbShowGrid)	{
		drawGrid(canvas, paint);
	}
	
	Rect rectClip = canvas.getClipBounds();
	canvas.clipRect(fCoordLeft, fCoordTop, fCoordRight, fCoordBottom, Op.REPLACE);
	drawDataCurves(canvas, mmapperP2P, mDataSet, mp3CoordLeftBottomInTO.getX(), mp3CoordLeftBottomInTO.getY() - mdCoordHeight,
			mdCoordWidth, mdCoordHeight, paint);
	canvas.clipRect(rectClip, Op.REPLACE);
	
	drawLegends(canvas, mdCoordWidth <= mdCoordHeight, paint);
	
       drawButtons(canvas, x, y, width, height, paint);

	paint.setColor(nPaintOriginalColor);
	
	Log.e(LOG_TAG, "out of XYChart.draw");
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:54,代码来源:XYChart.java

示例14: draw

import android.graphics.Paint; //导入方法依赖的package包/类
@Override
public void draw(Canvas canvas, double x, double y, double width, double height, Paint paint) {
	Log.e(LOG_TAG, "in PolarChart.draw");
	
	//calcCoordArea(x, y, width, height);
	//update();

	int nPaintOriginalColor = paint.getColor();
	// draw background
	paint.setColor(mcolorBkGrnd.getARGB());
	drawBackground(canvas, x, y, width, height, paint, null);
	
	paint.setColor(mcolorForeGrnd.getARGB());
	// draw title
	draw1LineTextAnchorMid(canvas, mstrChartTitle, width / 2, y + mdSmallSize/2, paint, null, mdSmallSize, 0);
	
	// draw r-axis only if it is visible.
	if (mp3CoordOriginInTO.getX() <= mp3CoordLeftBottomInTO.getX() + mdCoordWidth)	{
		drawAxis(canvas, mcaXAxis, mp3CoordOriginInTO.getX(), mp3CoordOriginInTO.getY(),
				mp3CoordLeftBottomInTO.getX() + mdCoordWidth, mp3CoordOriginInTO.getY(),
				paint, mcolorForeGrnd, false);
	}
	
	// draw a rectangle for drawing area
	float fCoordLeft = (float)mp3CoordLeftBottomInTO.getX(),
			fCoordTop = (float)(mp3CoordLeftBottomInTO.getY() - mdCoordHeight),
			fCoordRight = (float)(mp3CoordLeftBottomInTO.getX() + mdCoordWidth),
			fCoordBottom = (float)mp3CoordLeftBottomInTO.getY();
	
	Rect rectClip = canvas.getClipBounds();
	canvas.clipRect(fCoordLeft, fCoordTop, fCoordRight, fCoordBottom, Op.REPLACE);
	if (mbShowGrid)	{
		drawGrid(canvas, paint);
	}
	
	drawDataCurves(canvas, mmapperPolarXY, mDataSet, fCoordLeft, fCoordTop, mdCoordWidth, mdCoordHeight, paint);
	canvas.clipRect(rectClip, Op.REPLACE);
	
	drawLegends(canvas, mdCoordWidth <= mdCoordHeight, paint);
	
       drawButtons(canvas, x, y, width, height, paint);

	paint.setColor(nPaintOriginalColor);
	
	Log.e(LOG_TAG, "out of PolarChart.draw");
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:47,代码来源:PolarChart.java

示例15: blendAlpha

import android.graphics.Paint; //导入方法依赖的package包/类
private static void blendAlpha(@NonNull final Paint paint, final int alpha) {
    final int color = paint.getColor();
    paint.setARGB((paint.getAlpha() * alpha) / Constants.Color.ALPHA_OPAQUE,
            Color.red(color), Color.green(color), Color.blue(color));
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:6,代码来源:KeyboardView.java


注:本文中的android.graphics.Paint.getColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。