@Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { Paint strokePaint = new Paint(); strokePaint.setARGB(255, 0, 0, 0); strokePaint.setTextAlign(Paint.Align.CENTER); strokePaint.setTextSize(16); strokePaint.setTypeface(Typeface.DEFAULT_BOLD); strokePaint.setStyle(Paint.Style.STROKE); strokePaint.setStrokeWidth(2); Paint textPaint = new Paint(); textPaint.setARGB(255, 255, 255, 255); textPaint.setTextAlign(Paint.Align.CENTER); textPaint.setTextSize(16); textPaint.setTypeface(Typeface.DEFAULT_BOLD); canvas.drawText("Some Text", 100, 100, strokePaint); canvas.drawText("Some Text", 100, 100, textPaint); super.draw(canvas, mapView, shadow); }
Paint fgPaintSel = new Paint(); fgPaintSel.setARGB(255, 0, 0,0); fgPaintSel.setStyle(Style.STROKE); fgPaintSel.setPathEffect(new DashPathEffect(new float[] {10,20}, 0));
textPaint.setTextSize(32); textPaint.setAntiAlias(true); textPaint.setARGB(0xff, 0x00, 0x00, 0x00);
public void setup(Matrix m, Rect imageRect, RectF cropRect, boolean maintainAspectRatio) { matrix = new Matrix(m); this.cropRect = cropRect; this.imageRect = new RectF(imageRect); this.maintainAspectRatio = maintainAspectRatio; initialAspectRatio = this.cropRect.width() / this.cropRect.height(); drawRect = computeLayout(); outsidePaint.setARGB(125, 50, 50, 50); outlinePaint.setStyle(Paint.Style.STROKE); outlinePaint.setAntiAlias(true); outlineWidth = dpToPx(OUTLINE_DP); handlePaint.setColor(highlightColor); handlePaint.setStyle(Paint.Style.FILL); handlePaint.setAntiAlias(true); handleRadius = dpToPx(HANDLE_RADIUS_DP); modifyMode = ModifyMode.None; }
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(); }
mPaint.setDither(true); mPaint.setColor(0xFFFF0000); mPaint.setARGB(255, 0, 0, 0); mPaint.setStyle(Paint.Style.STROKE); mPaint.setPathEffect(new DashPathEffect(new float[]{10, 40,}, 0));
void drawDebugInformation(Canvas c) { if (debugPaint == null) { debugPaint = new Paint(); debugPaint.setARGB(255, 255, 0, 0); debugPaint.setStyle(Paint.Style.STROKE); debugPaint.setStrokeWidth(UiUtil.dp(getContext(), 1)); debugPaint.setARGB(220, 0, 0, 0); c.translate(0.0f, topBoundary); c.drawRect(0.0f, 0.0f, debugLayout.getWidth(), debugLayout.getHeight(), debugPaint); debugPaint.setARGB(255, 255, 0, 0); debugLayout.draw(c);
int g = Color.green(fillColor); int b = Color.blue(fillColor); mFillPaint.setARGB(a, r, g, b); canvas.drawPath(glyphData.path, mFillPaint);
// start with a Bitmap bmp // make a mutable copy and a canvas from this mutable bitmap Bitmap mb = bmp.copy(Bitmap.Config.ARGB_8888, true); Canvas c = new Canvas(mb); // get the int for the colour which needs to be removed Paint p = new Paint(); p.setARGB(255, 255, 0, 0); // ARGB for the color, in this case red int removeColor = p.getColor(); // store this color's int for later use // Next, set the alpha of the paint to transparent so the color can be removed. // This could also be non-transparent and be used to turn one color into another color p.setAlpha(0); // then, set the Xfermode of the pain to AvoidXfermode // removeColor is the color that will be replaced with the pain't color // 0 is the tolerance (in this case, only the color to be removed is targetted) // Mode.TARGET means pixels with color the same as removeColor are drawn on p.setXfermode(new AvoidXfermode(removeColor, 0, AvoidXfermode.Mode.TARGET)); // draw transparent on the "brown" pixels c.drawPaint(p); // mb should now have transparent pixels where they were red before
@Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { Paint strokePaint = new Paint(); strokePaint.setARGB(255, 0, 0, 0); strokePaint.setTextAlign(Paint.Align.CENTER); strokePaint.setTextSize(16); strokePaint.setTypeface(Typeface.DEFAULT_BOLD); strokePaint.setStyle(Paint.Style.STROKE); strokePaint.setStrokeWidth(2); Paint textPaint = new Paint(); textPaint.setARGB(255, 255, 255, 255); textPaint.setTextAlign(Paint.Align.CENTER); textPaint.setTextSize(16); textPaint.setTypeface(Typeface.DEFAULT_BOLD); canvas.drawText("Some Text", 100, 100, strokePaint); canvas.drawText("Some Text", 100, 100, textPaint); super.draw(canvas, mapView, shadow); }
public void setup(Matrix m, Rect imageRect, RectF cropRect, boolean circle, boolean maintainAspectRatio) { if (circle) { maintainAspectRatio = true; } mMatrix = new Matrix(m); mCropRect = cropRect; mImageRect = new RectF(imageRect); mMaintainAspectRatio = maintainAspectRatio; mCircle = circle; mInitialAspectRatio = mCropRect.width() / mCropRect.height(); mDrawRect = computeLayout(); mFocusPaint.setARGB(125, 50, 50, 50); mNoFocusPaint.setARGB(125, 50, 50, 50); mOutlinePaint.setStrokeWidth(3F); mOutlinePaint.setStyle(Paint.Style.STROKE); mOutlinePaint.setAntiAlias(true); mMode = ModifyMode.None; init(); }
public void setup(Matrix m, Rect imageRect, RectF cropRect, boolean circle, boolean maintainAspectRatio) { if (circle) { maintainAspectRatio = true; } mMatrix = new Matrix(m); mCropRect = cropRect; mImageRect = new RectF(imageRect); mMaintainAspectRatio = maintainAspectRatio; mCircle = circle; mInitialAspectRatio = mCropRect.width() / mCropRect.height(); mDrawRect = computeLayout(); mFocusPaint.setARGB(125, 50, 50, 50); mNoFocusPaint.setARGB(125, 50, 50, 50); mOutlinePaint.setStrokeWidth(3F); mOutlinePaint.setStyle(Paint.Style.STROKE); mOutlinePaint.setAntiAlias(true); mMode = ModifyMode.None; init(); }
mPaint.setARGB(255, 255, 0, 0); mPaint.setStrokeWidth(2); mPaint.setStyle(Style.FILL);
public class CustomBorderDrawable extends ShapeDrawable { private Paint fillpaint, strokepaint; private static final int WIDTH = 3; public CustomBorderDrawable(Shape s) { super(s); fillpaint = this.getPaint(); strokepaint = new Paint(fillpaint); strokepaint.setStyle(Paint.Style.STROKE); strokepaint.setStrokeWidth(WIDTH); strokepaint.setARGB(255, 0, 0, 0); } @Override protected void onDraw(Shape shape, Canvas canvas, Paint fillpaint) { shape.draw(canvas, fillpaint); shape.draw(canvas, strokepaint); } public void setFillColour(int c){ fillpaint.setColor(c); } }
textPaint.setARGB(50,100,100,250); textPaint.setTextAlign(Align.CENTER); textPaint.setTextSize(50);
/** Setting up settings variables (paint, settings, etc) and pre-load images */ private void init() { // Pre-loading bitmaps mBackgroundBitmap = loadBitmaps(R.array.elfBackgroundIds); mFigureBitmap = loadBitmaps(R.array.elfFigureIds); mFaceBitmap = loadBitmaps(R.array.elfFaceIds); mHourHandBitmap = loadBitmaps(R.array.elfHourHandIds); mMinuteHandBitmap = loadBitmaps(R.array.elfMinuteHandIds); // Initialising paint object for Bitmap draws mFilterPaint = new Paint(); mFilterPaint.setFilterBitmap(true); // Initialising background paint mAmbientBackgroundPaint = new Paint(); mAmbientBackgroundPaint.setARGB(255, 0, 0, 0); mAmbientPeekCardBorderPaint = new Paint(); mAmbientPeekCardBorderPaint.setColor(Color.WHITE); mAmbientPeekCardBorderPaint.setStrokeWidth(BORDER_WIDTH_PX); // Load UFO and pre-scale Bitmap fullSizeUfo = BitmapFactory.decodeResource(getResources(), R.drawable.ufo); mUfoBitmap = Bitmap.createScaledBitmap( fullSizeUfo, fullSizeUfo.getWidth() / UFO_DISTANCE, fullSizeUfo.getHeight() / UFO_DISTANCE, true); // Initialising time mCalendar = GregorianCalendar.getInstance(); }
ShapeDrawable sd = new ShapeDrawable(new RectShape()); sd.setIntrinsicHeight(1); Paint fgPaintSel = sd.getPaint(); fgPaintSel.setARGB(255, 0, 0, 0); fgPaintSel.setStyle(Paint.Style.STROKE); fgPaintSel.setPathEffect(new DashPathEffect(new float[]{5, 10}, 0)); LinearLayout linearLayout = (LinearLayout) findViewById(R.id.main); linearLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE | LinearLayout.SHOW_DIVIDER_END); linearLayout.setDividerDrawable(sd);
mAmbientBackgroundPaint.setARGB(255, 0, 0, 0); mAmbientPeekCardBorderPaint = new Paint(); mAmbientPeekCardBorderPaint.setColor(Color.WHITE);
public void draw(Canvas canvas) { final RectF rectF = new RectF(); final Paint paint = new Paint(); paint.setARGB(128, 255, 255, 255); rectF.set(0,0, getMeasuredWidth(), getMeasuredHeight()); canvas.drawRect(rectF, paint); }