android.graphics.Paint#setARGB ( )源码实例Demo

下面列出了android.graphics.Paint#setARGB ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: OpenMapKitAndroid   文件: OSMMap.java
private void drawDebugTapEnvelope(MapView pMapView, ILatLng pPosition, float zoom) {
    Envelope env = jtsModel.createTapEnvelope(pPosition, zoom);
    PathOverlay path;
    if (debugTapEnvelopePath == null) {
        path = new PathOverlay();
        debugTapEnvelopePath = path;
        pMapView.getOverlays().add(path);
    } else {
        path = debugTapEnvelopePath;
    }
    Paint paint = path.getPaint();
    paint.setStrokeWidth(0); // hairline mode
    paint.setARGB(200, 0, 255, 255);
    double maxX = env.getMaxX();
    double maxY = env.getMaxY();
    double minX = env.getMinX();
    double minY = env.getMinY();
    path.clearPath();
    path.addPoint(minY, minX);
    path.addPoint(maxY, minX);
    path.addPoint(maxY, maxX);
    path.addPoint(minY, maxX);
    path.addPoint(minY, minX);
}
 
源代码2 项目: maps.android   文件: NMapCalloutBasicOverlay.java
public NMapCalloutBasicOverlay(NMapOverlay itemOverlay, NMapOverlayItem item, Rect itemBounds) {
	super(itemOverlay, item, itemBounds);

	mInnerPaint = new Paint();
	mInnerPaint.setARGB(225, 75, 75, 75); //gray
	mInnerPaint.setAntiAlias(true);

	mBorderPaint = new Paint();
	mBorderPaint.setARGB(255, 255, 255, 255);
	mBorderPaint.setAntiAlias(true);
	mBorderPaint.setStyle(Style.STROKE);
	mBorderPaint.setStrokeWidth(2);

	mTextPaint = new Paint();
	mTextPaint.setARGB(255, 255, 255, 255);
	mTextPaint.setAntiAlias(true);

	mPath = new Path();
	mPath.setFillType(Path.FillType.WINDING);
}
 
源代码3 项目: AndroidDemo   文件: ReflectionActivity.java
private Bitmap createReflection(Bitmap original, float percentage, int gap) {

		final int reflectionHeight = (int) (original.getHeight() * percentage);
		Bitmap bitmapWithReflection = Bitmap.createBitmap(original.getWidth(), (original.getHeight() + reflectionHeight + gap), Bitmap.Config.ARGB_8888);
		Canvas canvas = new Canvas(bitmapWithReflection);

		// original image
		canvas.drawBitmap(original, 0, 0, null);
		// gap drawing
		final Paint transparentPaint = new Paint();
		transparentPaint.setARGB(0, 255, 255, 255);
		canvas.drawRect(0, original.getHeight(), original.getWidth(), original.getHeight() + gap, transparentPaint);
		// reflection
		final Matrix matrix = new Matrix();
		matrix.preScale(1, -1);
		canvas.drawBitmap(Bitmap.createBitmap(original, 0, original.getHeight() - reflectionHeight, original.getWidth(), reflectionHeight, matrix, false), 0, original.getHeight() + gap, null);
		// reflection shading
		final Paint fadePaint = new Paint();
		fadePaint.setShader(new LinearGradient(0, original.getHeight(), 0, original.getHeight() + reflectionHeight + gap, 0x70ffffff, 0x00ffffff, Shader.TileMode.CLAMP));
		fadePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
		canvas.drawRect(0, original.getHeight(), original.getWidth(), bitmapWithReflection.getHeight() + gap, fadePaint);

		original.recycle();
		return bitmapWithReflection;
	}
 
源代码4 项目: codeexamples-android   文件: LabelMaker.java
/**
 * Create a label maker
 * or maximum compatibility with various OpenGL ES implementations,
 * the strike width and height must be powers of two,
 * We want the strike width to be at least as wide as the widest window.
 *
 * @param fullColor true if we want a full color backing store (4444),
 * otherwise we generate a grey L8 backing store.
 * @param strikeWidth width of strike
 * @param strikeHeight height of strike
 */
public LabelMaker(boolean fullColor, int strikeWidth, int strikeHeight) {
    mFullColor = fullColor;
    mStrikeWidth = strikeWidth;
    mStrikeHeight = strikeHeight;
    mTexelWidth = (float) (1.0 / mStrikeWidth);
    mTexelHeight = (float) (1.0 / mStrikeHeight);
    mClearPaint = new Paint();
    mClearPaint.setARGB(0, 0, 0, 0);
    mClearPaint.setStyle(Style.FILL);
    mState = STATE_NEW;
}
 
源代码5 项目: AndroidDemoProjects   文件: WatchFace.java
private void initHourPaint() {
    mHourPaint = new Paint();
    mHourPaint.setARGB(255, 0, 0, 0);
    mHourPaint.setStrokeWidth(5.f);
    mHourPaint.setAntiAlias(true);
    mHourPaint.setStrokeCap(Paint.Cap.ROUND);
}
 
源代码6 项目: Slide   文件: CanvasView.java
/**
 * This method creates the instance of Paint.
 * In addition, this method sets styles for Paint.
 *
 * @return paint This is returned as the instance of Paint
 */
private Paint createPaint() {
    Paint paint = new Paint();

    paint.setAntiAlias(true);
    paint.setStyle(this.paintStyle);
    paint.setStrokeWidth(this.paintStrokeWidth);
    paint.setStrokeCap(this.lineCap);
    paint.setStrokeJoin(Paint.Join.MITER);  // fixed

    // for Text
    if (this.mode == Mode.TEXT) {
        paint.setTypeface(this.fontFamily);
        paint.setTextSize(this.fontSize);
        paint.setTextAlign(this.textAlign);
        paint.setStrokeWidth(0F);
    }

    if (this.mode == Mode.ERASER) {
        // Eraser
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
        paint.setARGB(0, 0, 0, 0);

        // paint.setColor(this.baseColor);
        // paint.setShadowLayer(this.blur, 0F, 0F, this.baseColor);
    } else {
        // Otherwise
        paint.setColor(this.paintStrokeColor);
        paint.setShadowLayer(this.blur, 0F, 0F, this.paintStrokeColor);
        paint.setAlpha(this.opacity);
    }

    return paint;
}
 
源代码7 项目: Android-Color-Picker   文件: MultiColorPicker.java
private void init() {

        colorPointerPaint = new Paint();
        colorPointerPaint.setStyle(Style.STROKE);
        colorPointerPaint.setStrokeWidth(2f);
        colorPointerPaint.setARGB(128, 0, 0, 0);

        valuePointerPaint = new Paint();
        valuePointerPaint.setStyle(Style.STROKE);
        valuePointerPaint.setStrokeWidth(2f);

        valuePointerArrowPaint = new Paint();

        colorWheelPaint = new Paint();
        colorWheelPaint.setAntiAlias(true);
        colorWheelPaint.setDither(true);

        valueSliderPaint = new Paint();
        valueSliderPaint.setAntiAlias(true);
        valueSliderPaint.setDither(true);

        colorViewPaint = new Paint();
        colorViewPaint.setAntiAlias(true);

        colorViewPath = new Path();
        valueSliderPath = new Path();
        arrowPointerPath = new Path();

        outerWheelRect = new RectF();
        innerWheelRect = new RectF();

        colorPointerCoords = new RectF();

    }
 
源代码8 项目: ImageCropper   文件: CropImageView.java
private void createPainter() {
    mCropPainter = new Paint();
    mCropPainter.setAntiAlias(true);
    mCropPainter.setStyle(Style.STROKE);
    mCropPainter.setStrokeWidth(CROP_WINDOW_PAINTER_WIDTH);
    mCropPainter.setColor(Color.YELLOW);

    mOutsidePainter = new Paint();
    mOutsidePainter.setAntiAlias(true);
    mOutsidePainter.setStyle(Style.FILL);
    mOutsidePainter.setARGB(125, 50, 50, 50);
    mOutsidePainter.setStrokeWidth(OUTSIDE_WINDOW_PAINTER_WIDTH);
}
 
源代码9 项目: libcommon   文件: GLHelper.java
public static int createTextureWithTextContent (final String text, final int texUnit) {
	if (DEBUG) Log.v(TAG, "createTextureWithTextContent:");
	// Create an empty, mutable bitmap
	final Bitmap bitmap = Bitmap.createBitmap(256, 256, Bitmap.Config.ARGB_8888);
	// get a canvas to paint over the bitmap
	final Canvas canvas = new Canvas(bitmap);
	canvas.drawARGB(0,0,255,0);

	// Draw the text
	final Paint textPaint = new Paint();
	textPaint.setTextSize(32);
	textPaint.setAntiAlias(true);
	textPaint.setARGB(0xff, 0xff, 0xff, 0xff);
	// draw the text centered
	canvas.drawText(text, 16, 112, textPaint);

	final int texture = initTex(GLES30.GL_TEXTURE_2D,
		texUnit, GLES30.GL_NEAREST, GLES30.GL_LINEAR, GLES30.GL_REPEAT);

	// Alpha blending
	// GLES30.glEnable(GLES30.GL_BLEND);
	// GLES30.glBlendFunc(GLES30.GL_SRC_ALPHA, GLES30.GL_ONE_MINUS_SRC_ALPHA);

	// Use the Android GLUtils to specify a two-dimensional texture image from our bitmap
	GLUtils.texImage2D(GLES30.GL_TEXTURE_2D, 0, bitmap, 0);
	// Clean up
	bitmap.recycle();

	return texture;
}
 
源代码10 项目: libcommon   文件: GLHelper.java
public static int createTextureWithTextContent(@NonNull final String text, final int texUnit) {
	if (DEBUG) Log.v(TAG, "createTextureWithTextContent:");
	// Create an empty, mutable bitmap
	final Bitmap bitmap = Bitmap.createBitmap(256, 256, Bitmap.Config.ARGB_8888);
	// get a canvas to paint over the bitmap
	final Canvas canvas = new Canvas(bitmap);
	canvas.drawARGB(0,0,255,0);

	// Draw the text
	final Paint textPaint = new Paint();
	textPaint.setTextSize(32);
	textPaint.setAntiAlias(true);
	textPaint.setARGB(0xff, 0xff, 0xff, 0xff);
	// draw the text centered
	canvas.drawText(text, 16, 112, textPaint);

	final int texture = initTex(GLES20.GL_TEXTURE_2D,
		texUnit, GLES20.GL_NEAREST, GLES20.GL_LINEAR, GLES20.GL_REPEAT);

	// Alpha blending
	// GLES20.glEnable(GLES20.GL_BLEND);
	// GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);

	// Use the Android GLUtils to specify a two-dimensional texture image from our bitmap
	GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
	// Clean up
	bitmap.recycle();

	return texture;
}
 
源代码11 项目: px-android   文件: ColorPicker.java
private void init() {

        colorPointerPaint = new Paint();
        colorPointerPaint.setStyle(Style.STROKE);
        colorPointerPaint.setStrokeWidth(2f);
        colorPointerPaint.setARGB(128, 0, 0, 0);

        valuePointerPaint = new Paint();
        valuePointerPaint.setStyle(Style.STROKE);
        valuePointerPaint.setStrokeWidth(2f);

        valuePointerArrowPaint = new Paint();

        colorWheelPaint = new Paint();
        colorWheelPaint.setAntiAlias(true);
        colorWheelPaint.setDither(true);

        valueSliderPaint = new Paint();
        valueSliderPaint.setAntiAlias(true);
        valueSliderPaint.setDither(true);

        colorViewPaint = new Paint();
        colorViewPaint.setAntiAlias(true);

        colorViewPath = new Path();
        valueSliderPath = new Path();
        arrowPointerPath = new Path();

        outerWheelRect = new RectF();
        innerWheelRect = new RectF();

        colorPointerCoords = new RectF();
    }
 
@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    mBgPaint = new Paint();
    mBgPaint.setARGB(255, 0, 0, 0);

    mTimePaint = new Paint();
    mTimePaint.setARGB(255, 255, 255, 255);
    mTimePaint.setAntiAlias(true);
    Typeface tf = Typeface.createFromAsset(getAssets(), "RobotoCondensed-Light.ttf");
    mTimePaint.setTypeface(tf);

    mMaxRangePaint = new Paint();
    mMaxRangePaint.setARGB(120, 255, 255, 255);
    mMaxRangePaint.setAntiAlias(true);

    mRangeValuePaint = new Paint();
    mRangeValuePaint.setARGB(190, 255, 255, 255);
    mRangeValuePaint.setAntiAlias(true);
    mRangeValuePaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));

    mDotsPaint = new Paint();
    mDotsPaint.setAntiAlias(true);

    mTime = new Time();

    Resources resources = TeslaWatchFaceService.this.getResources();

    Drawable chargingDrawable = resources.getDrawable(R.drawable.charging);
    mChargingBitmap = ((BitmapDrawable) chargingDrawable).getBitmap();

    Drawable mLockedBitmapDrawable = resources.getDrawable(R.drawable.locked_small);
    mLockedBitmap = ((BitmapDrawable) mLockedBitmapDrawable).getBitmap();

    Drawable unlockedDrawable = resources.getDrawable(R.drawable.unlocked_small);
    mUnLockedBitmap = ((BitmapDrawable) unlockedDrawable).getBitmap();

    configureStyle();

    initGoogleApiClient();
}
 
源代码13 项目: WidgetCase   文件: HorTaperChart.java
private void init(Context context) {
        mContext = context;
        mOffBtm = DensityUtil.dp2px(18);
        mQuadOffset = DensityUtil.dp2px(5);
        mInterSpace = DensityUtil.dp2px(24);
        mLabelWidth = DensityUtil.dp2px(98);
        mLeftAxisLabelMargin = DensityUtil.dp2px(4f);

        mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mPaint.setARGB(153, 255, 196, 0);
        mPaint.setStrokeWidth(6);

        mAxisPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mAxisPaint.setColor(Color.rgb(149, 199, 255));
        mAxisPaint.setStrokeWidth(DensityUtil.dp2px(0.5f));

        mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mTextPaint.setColor(Color.rgb(153, 153, 153));
        mTextPaint.setTextSize(DensityUtil.sp2px(mContext, 10));
//        mTextPaint.setTextAlign(Paint.Align.LEFT);

        mNullPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mNullPaint.setColor(Color.rgb(200, 200, 200));
        mNullPaint.setTextSize(DensityUtil.sp2px(mContext, 12f));

        mPointPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mPointPaint.setColor(Color.RED);
        mPointPaint.setStrokeWidth(10);
        mPointPaint.setStyle(Paint.Style.FILL_AND_STROKE);

        mLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mLinePaint.setStyle(Paint.Style.FILL);
        mLinePaint.setStrokeWidth(DensityUtil.dp2px(0.5f));
        mLinePaint.setColor(Color.RED);

        mYAxisList = new ArrayList<>(6);
        mList = new ArrayList<>(6);
        mXValues = new ArrayList<>(6);
        mYValues = new ArrayList<>(6);

        final ViewConfiguration vc = ViewConfiguration.get(mContext);
        mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
        mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();

        mScroller = new OverScroller(getContext(), interpolator);
    }
 
源代码14 项目: prayer-times-android   文件: ExportController.java
public static void exportPDF(Context ctx, Times times, @NonNull LocalDate from, @NonNull LocalDate to) throws IOException {
    PdfDocument document = new PdfDocument();

    PdfDocument.PageInfo pageInfo;
    int pw = 595;
    int ph = 842;
    pageInfo = new PdfDocument.PageInfo.Builder(pw, ph, 1).create();
    PdfDocument.Page page = document.startPage(pageInfo);
    Drawable launcher = Drawable.createFromStream(ctx.getAssets().open("pdf/launcher.png"), null);
    Drawable qr = Drawable.createFromStream(ctx.getAssets().open("pdf/qrcode.png"), null);
    Drawable badge =
            Drawable.createFromStream(ctx.getAssets().open("pdf/badge_" + LocaleUtils.getLanguage("en", "de", "tr", "fr", "ar") + ".png"),
                    null);

    launcher.setBounds(30, 30, 30 + 65, 30 + 65);
    qr.setBounds(pw - 30 - 65, 30 + 65 + 5, pw - 30, 30 + 65 + 5 + 65);
    int w = 100;
    int h = w * badge.getIntrinsicHeight() / badge.getIntrinsicWidth();
    badge.setBounds(pw - 30 - w, 30 + (60 / 2 - h / 2), pw - 30, 30 + (60 / 2 - h / 2) + h);


    Canvas canvas = page.getCanvas();

    Paint paint = new Paint();
    paint.setARGB(255, 0, 0, 0);
    paint.setTextSize(10);
    paint.setTextAlign(Paint.Align.CENTER);
    canvas.drawText("com.metinkale.prayer", pw - 30 - w / 2f, 30 + (60 / 2f - h / 2f) + h + 10, paint);

    launcher.draw(canvas);
    qr.draw(canvas);
    badge.draw(canvas);

    paint.setARGB(255, 61, 184, 230);
    canvas.drawRect(30, 30 + 60, pw - 30, 30 + 60 + 5, paint);


    if (times.getSource().drawableId != 0) {
        Drawable source = ctx.getResources().getDrawable(times.getSource().drawableId);

        h = 65;
        w = h * source.getIntrinsicWidth() / source.getIntrinsicHeight();
        source.setBounds(30, 30 + 65 + 5, 30 + w, 30 + 65 + 5 + h);
        source.draw(canvas);
    }

    paint.setARGB(255, 0, 0, 0);
    paint.setTextSize(40);
    paint.setTextAlign(Paint.Align.LEFT);
    canvas.drawText(ctx.getText(R.string.appName).toString(), 30 + 65 + 5, 30 + 50, paint);
    paint.setTextAlign(Paint.Align.CENTER);
    paint.setFakeBoldText(true);
    canvas.drawText(times.getName(), pw / 2.0f, 30 + 65 + 50, paint);

    paint.setTextSize(12);
    int y = 30 + 65 + 5 + 65 + 30;
    int p = 30;
    int cw = (pw - p - p) / 7;
    canvas.drawText(ctx.getString(R.string.date), 30 + (0.5f * cw), y, paint);
    canvas.drawText(FAJR.getString(), 30 + (1.5f * cw), y, paint);
    canvas.drawText(Vakit.SUN.getString(), 30 + (2.5f * cw), y, paint);
    canvas.drawText(Vakit.DHUHR.getString(), 30 + (3.5f * cw), y, paint);
    canvas.drawText(Vakit.ASR.getString(), 30 + (4.5f * cw), y, paint);
    canvas.drawText(Vakit.MAGHRIB.getString(), 30 + (5.5f * cw), y, paint);
    canvas.drawText(Vakit.ISHAA.getString(), 30 + (6.5f * cw), y, paint);
    paint.setFakeBoldText(false);
    do {
        y += 20;
        canvas.drawText((from.toString("dd.MM.yyyy")), 30 + (0.5f * cw), y, paint);
        canvas.drawText(times.getTime(from, FAJR.ordinal()).toLocalTime().toString(), 30 + (1.5f * cw), y, paint);
        canvas.drawText(times.getTime(from, SUN.ordinal()).toLocalTime().toString(), 30 + (2.5f * cw), y, paint);
        canvas.drawText(times.getTime(from, DHUHR.ordinal()).toLocalTime().toString(), 30 + (3.5f * cw), y, paint);
        canvas.drawText(times.getTime(from, ASR.ordinal()).toLocalTime().toString(), 30 + (4.5f * cw), y, paint);
        canvas.drawText(times.getTime(from, MAGHRIB.ordinal()).toLocalTime().toString(), 30 + (5.5f * cw), y, paint);
        canvas.drawText(times.getTime(from, ISHAA.ordinal()).toLocalTime().toString(), 30 + (6.5f * cw), y, paint);
    } while (!(from = from.plusDays(1)).isAfter(to));
    document.finishPage(page);


    File outputDir = ctx.getCacheDir();
    if (!outputDir.exists())
        outputDir.mkdirs();
    File outputFile = new File(outputDir, times.getName().replace(" ", "_") + ".pdf");
    if (outputFile.exists())
        outputFile.delete();
    FileOutputStream outputStream = new FileOutputStream(outputFile);
    document.writeTo(outputStream);
    document.close();

    Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND);
    shareIntent.setType("application/pdf");

    Uri uri = FileProvider.getUriForFile(ctx, ctx.getString(R.string.FILE_PROVIDER_AUTHORITIES), outputFile);
    shareIntent.putExtra(Intent.EXTRA_STREAM, uri);

    ctx.startActivity(Intent.createChooser(shareIntent, ctx.getResources().getText(R.string.export)));
}
 
源代码15 项目: codeexamples-android   文件: GameView.java
static void setPaintARGBBlend(Paint paint, float alpha,
        int a1, int r1, int g1, int b1,
        int a2, int r2, int g2, int b2) {
    paint.setARGB(blend(alpha, a1, a2), blend(alpha, r1, r2),
            blend(alpha, g1, g2), blend(alpha, b1, b2));
}
 
源代码16 项目: codeexamples-android   文件: GameView.java
public Obstacle() {
    mPaint = new Paint();
    mPaint.setARGB(255, 127, 127, 255);
    mPaint.setStyle(Style.FILL);
}
 
源代码17 项目: bluetooth   文件: GameView.java
private static void setPaintARGBBlend(Paint paint, float alpha,
        int a1, int r1, int g1, int b1,
        int a2, int r2, int g2, int b2) {
    paint.setARGB(blend(alpha, a1, a2), blend(alpha, r1, r2),
            blend(alpha, g1, g2), blend(alpha, b1, b2));
}
 
源代码18 项目: Beats   文件: GUIScoreDisplay.java
public void draw(Canvas canvas, int time_ms) {
	
	int opa = time_ms * Tools.MAX_OPA / 3000;
	if (opa > Tools.MAX_OPA) opa = Tools.MAX_OPA;
	
	filterPaint.setARGB(opa/2, 0, 0, 0);
	canvas.drawRect(0,0,Tools.screen_w, Tools.screen_h + Tools.scale(70), filterPaint);
	
	gameOverPaint.ARGB(opa, 255,255,255);
	gameOverPaint.strokeARGB(opa,0,0,0);
	gameOverPaint.draw(canvas, gameOverText, Tools.screen_w/2, Tools.scale(34));
	
	//int[] chart = score.accuracyChart;
	AccuracyTypes[] types = AccuracyTypes.values();
	int i=0;
	for (i=0; i<types.length-3; i++) { //-3 to cut off ignores
		AccuracyTypes at = types[i];
		GUITextPaint textPaint = new GUITextPaint(Tools.scale(18)).alignRight().
			ARGB(opa, at.r, at.g, at.b);
		
		Paint bkgndPaint = new Paint();
		bkgndPaint.setARGB(opa, at.r/8, at.g/8, at.b/8);

		//todo unpublicify
		double dif = 20*Math.sin((i*500.0 + time_ms)*Math.PI/4000);
		float x = Tools.screen_w/2 + Tools.scale((float)dif);
		float y = Tools.scale(60 + i*22);
		canvas.drawRect(0, y - Tools.scale(16), Tools.screen_w, y + Tools.scale(2), bkgndPaint);
		textPaint.draw(canvas, at.toString(), x,y);
		textPaint.alignLeft().draw(canvas, "" + score.accuracyChart[at.ordinal()], x + Tools.scale(20), y);
	}
	
	scorePaint.ARGB(opa, 255, 255, 255);
	String scoreText;
	if (score.newHighScore) {
		scoreText = Tools.getString(R.string.GUIGame_highscore);
	} else {
		scoreText = Tools.getString(R.string.GUIGame_score);
	}
	scorePaint.draw(canvas, 
			scoreText + 
			score.score,
			Tools.screen_w/2, Tools.scale(70 + i*22));
	
	backBoxPaint.setARGB(opa/2, 0, 0, 0);
	canvas.drawRect(
			new Rect(0, Tools.screen_h - Tools.scale(130), Tools.screen_w, Tools.screen_h - Tools.scale(60)),
			backBoxPaint);
	
	backPaint.ARGB(opa, 255,255,255);
	
	backPaint.draw(canvas, back1, Tools.screen_w/2, Tools.screen_h - Tools.scale(100));
	backPaint.draw(canvas, back2, Tools.screen_w/2, Tools.screen_h - Tools.scale(75));
}
 
源代码19 项目: AndroidDemoProjects   文件: MyWatchFace.java
private void initTickPaint() {
    mTickPaint = new Paint();
    mTickPaint.setARGB(255, 200, 0, 0);
    mTickPaint.setStrokeWidth(2.f);
    mTickPaint.setAntiAlias(true);
}
 
源代码20 项目: prayer-times-android   文件: ExportController.java
public static void exportPDF(Context ctx, Times times, @NonNull LocalDate from, @NonNull LocalDate to) throws IOException {
    PdfDocument document = new PdfDocument();

    PdfDocument.PageInfo pageInfo;
    int pw = 595;
    int ph = 842;
    pageInfo = new PdfDocument.PageInfo.Builder(pw, ph, 1).create();
    PdfDocument.Page page = document.startPage(pageInfo);
    Drawable launcher = Drawable.createFromStream(ctx.getAssets().open("pdf/launcher.png"), null);
    Drawable qr = Drawable.createFromStream(ctx.getAssets().open("pdf/qrcode.png"), null);
    Drawable badge =
            Drawable.createFromStream(ctx.getAssets().open("pdf/badge_" + LocaleUtils.getLanguage("en", "de", "tr", "fr", "ar") + ".png"),
                    null);

    launcher.setBounds(30, 30, 30 + 65, 30 + 65);
    qr.setBounds(pw - 30 - 65, 30 + 65 + 5, pw - 30, 30 + 65 + 5 + 65);
    int w = 100;
    int h = w * badge.getIntrinsicHeight() / badge.getIntrinsicWidth();
    badge.setBounds(pw - 30 - w, 30 + (60 / 2 - h / 2), pw - 30, 30 + (60 / 2 - h / 2) + h);


    Canvas canvas = page.getCanvas();

    Paint paint = new Paint();
    paint.setARGB(255, 0, 0, 0);
    paint.setTextSize(10);
    paint.setTextAlign(Paint.Align.CENTER);
    canvas.drawText("com.metinkale.prayer", pw - 30 - w / 2f, 30 + (60 / 2f - h / 2f) + h + 10, paint);

    launcher.draw(canvas);
    qr.draw(canvas);
    badge.draw(canvas);

    paint.setARGB(255, 61, 184, 230);
    canvas.drawRect(30, 30 + 60, pw - 30, 30 + 60 + 5, paint);


    if (times.getSource().drawableId != 0) {
        Drawable source = ctx.getResources().getDrawable(times.getSource().drawableId);

        h = 65;
        w = h * source.getIntrinsicWidth() / source.getIntrinsicHeight();
        source.setBounds(30, 30 + 65 + 5, 30 + w, 30 + 65 + 5 + h);
        source.draw(canvas);
    }

    paint.setARGB(255, 0, 0, 0);
    paint.setTextSize(40);
    paint.setTextAlign(Paint.Align.LEFT);
    canvas.drawText(ctx.getText(R.string.appName).toString(), 30 + 65 + 5, 30 + 50, paint);
    paint.setTextAlign(Paint.Align.CENTER);
    paint.setFakeBoldText(true);
    canvas.drawText(times.getName(), pw / 2.0f, 30 + 65 + 50, paint);

    paint.setTextSize(12);
    int y = 30 + 65 + 5 + 65 + 30;
    int p = 30;
    int cw = (pw - p - p) / 7;
    canvas.drawText(ctx.getString(R.string.date), 30 + (0.5f * cw), y, paint);
    canvas.drawText(FAJR.getString(), 30 + (1.5f * cw), y, paint);
    canvas.drawText(Vakit.SUN.getString(), 30 + (2.5f * cw), y, paint);
    canvas.drawText(Vakit.DHUHR.getString(), 30 + (3.5f * cw), y, paint);
    canvas.drawText(Vakit.ASR.getString(), 30 + (4.5f * cw), y, paint);
    canvas.drawText(Vakit.MAGHRIB.getString(), 30 + (5.5f * cw), y, paint);
    canvas.drawText(Vakit.ISHAA.getString(), 30 + (6.5f * cw), y, paint);
    paint.setFakeBoldText(false);
    do {
        y += 20;
        canvas.drawText((from.toString("dd.MM.yyyy")), 30 + (0.5f * cw), y, paint);
        canvas.drawText(times.getTime(from, FAJR.ordinal()).toLocalTime().toString(), 30 + (1.5f * cw), y, paint);
        canvas.drawText(times.getTime(from, SUN.ordinal()).toLocalTime().toString(), 30 + (2.5f * cw), y, paint);
        canvas.drawText(times.getTime(from, DHUHR.ordinal()).toLocalTime().toString(), 30 + (3.5f * cw), y, paint);
        canvas.drawText(times.getTime(from, ASR.ordinal()).toLocalTime().toString(), 30 + (4.5f * cw), y, paint);
        canvas.drawText(times.getTime(from, MAGHRIB.ordinal()).toLocalTime().toString(), 30 + (5.5f * cw), y, paint);
        canvas.drawText(times.getTime(from, ISHAA.ordinal()).toLocalTime().toString(), 30 + (6.5f * cw), y, paint);
    } while (!(from = from.plusDays(1)).isAfter(to));
    document.finishPage(page);


    File outputDir = ctx.getCacheDir();
    if (!outputDir.exists())
        outputDir.mkdirs();
    File outputFile = new File(outputDir, times.getName().replace(" ", "_") + ".pdf");
    if (outputFile.exists())
        outputFile.delete();
    FileOutputStream outputStream = new FileOutputStream(outputFile);
    document.writeTo(outputStream);
    document.close();

    Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND);
    shareIntent.setType("application/pdf");

    Uri uri = FileProvider.getUriForFile(ctx, ctx.getString(R.string.FILE_PROVIDER_AUTHORITIES), outputFile);
    shareIntent.putExtra(Intent.EXTRA_STREAM, uri);

    ctx.startActivity(Intent.createChooser(shareIntent, ctx.getResources().getText(R.string.export)));
}