List of usage examples for android.graphics Paint setAntiAlias
public void setAntiAlias(boolean aa)
From source file:ch.carteggio.ui.ConversationIconLoader.java
/** * Calculates a bitmap with a color and a capital letter for contacts without picture. */// w w w . j a v a 2 s . com private Bitmap calculateFallbackBitmap(String emails[]) { Bitmap result = Bitmap.createBitmap(mPictureSizeInPx, mPictureSizeInPx, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(result); int rgb = CONTACT_DUMMY_COLORS_ARGB[0]; if (emails.length > 0) { calcUnknownContactColor(emails[0]); } result.eraseColor(rgb); String letter = FALLBACK_CONTACT_LETTER; Paint paint = new Paint(); paint.setAntiAlias(true); paint.setStyle(Paint.Style.FILL); paint.setARGB(255, 255, 255, 255); paint.setTextSize(mPictureSizeInPx * 3 / 4); // just scale this down a bit Rect rect = new Rect(); paint.getTextBounds(letter, 0, 1, rect); float width = paint.measureText(letter); canvas.drawText(letter, (mPictureSizeInPx / 2f) - (width / 2f), (mPictureSizeInPx / 2f) + (rect.height() / 2f), paint); return result; }
From source file:com.nextgis.maplib.display.SimpleMarkerStyle.java
protected void onDraw(GeoPoint pt, GISDisplay display) { if (null == pt) return;//from w w w . j ava 2 s . c o m switch (mType) { case MarkerStylePoint: Paint ptPaint = new Paint(); ptPaint.setColor(mColor); ptPaint.setStrokeWidth((float) (mSize / display.getScale())); ptPaint.setStrokeCap(Paint.Cap.ROUND); ptPaint.setAntiAlias(true); display.drawPoint((float) pt.getX(), (float) pt.getY(), ptPaint); break; case MarkerStyleCircle: Paint fillCirclePaint = new Paint(); fillCirclePaint.setColor(mColor); fillCirclePaint.setStrokeCap(Paint.Cap.ROUND); display.drawCircle((float) pt.getX(), (float) pt.getY(), mSize, fillCirclePaint); Paint outCirclePaint = new Paint(); outCirclePaint.setColor(mOutColor); outCirclePaint.setStrokeWidth((float) (mWidth / display.getScale())); outCirclePaint.setStyle(Paint.Style.STROKE); outCirclePaint.setAntiAlias(true); display.drawCircle((float) pt.getX(), (float) pt.getY(), mSize, outCirclePaint); break; case MarkerStyleDiamond: break; case MarkerStyleCross: break; case MarkerStyleTriangle: break; case MarkerStyleBox: break; } }
From source file:com.camnter.easyrecyclerviewsidebar.EasyRecyclerViewSidebar.java
private Paint createImagePaint() { Paint imagePaint = new Paint(); imagePaint.setAntiAlias(true); imagePaint.setStrokeWidth(this.dp2px(DEFAULT_IMAGE_SECTION_PAINT_WIDTH)); return imagePaint; }
From source file:com.android.example.alwaysonstopwatch.StopwatchActivity.java
@Override public void onEnterAmbient(Bundle ambientDetails) { Log.d(TAG, "ENTER Ambient"); super.onEnterAmbient(ambientDetails); if (mRunning) { mActiveModeUpdateHandler.removeMessages(R.id.msg_update); mNotice.setVisibility(View.VISIBLE); }/* w w w. j a va2 s .c o m*/ mActiveClockUpdateHandler.removeMessages(R.id.msg_update); mTimeView.setTextColor(Color.WHITE); Paint textPaint = mTimeView.getPaint(); textPaint.setAntiAlias(false); textPaint.setStyle(Paint.Style.STROKE); textPaint.setStrokeWidth(2); mStartStopButton.setVisibility(View.INVISIBLE); mResetButton.setVisibility(View.INVISIBLE); mBackground.setBackgroundColor(Color.BLACK); mClockView.setTextColor(Color.WHITE); mClockView.getPaint().setAntiAlias(false); updateDisplayAndSetRefresh(); }
From source file:com.android.example.alwaysonstopwatch.StopwatchActivity.java
@Override public void onExitAmbient() { Log.d(TAG, "EXIT Ambient"); super.onExitAmbient(); if (mRunning) { mAmbientStateAlarmManager.cancel(mAmbientStatePendingIntent); }/*www. j a v a 2s. co m*/ mTimeView.setTextColor(mActiveForegroundColor); Paint textPaint = mTimeView.getPaint(); textPaint.setAntiAlias(true); textPaint.setStyle(Paint.Style.FILL); mStartStopButton.setVisibility(View.VISIBLE); mResetButton.setVisibility(View.VISIBLE); mBackground.setBackgroundColor(mActiveBackgroundColor); mClockView.setTextColor(mActiveForegroundColor); mClockView.getPaint().setAntiAlias(true); mActiveClockUpdateHandler.sendEmptyMessage(R.id.msg_update); if (mRunning) { mNotice.setVisibility(View.INVISIBLE); updateDisplayAndSetRefresh(); } }
From source file:com.clov4r.moboplayer.android.nil.codec.activity.MoboThumbnailTestActivity.java
public Bitmap getRoundedCornerBitmap(Bitmap bitmap, float roundPx) { try {//from w w w.j a v a2 s. c o m Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(output); final Paint paint = new Paint(); final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()); final RectF rectF = new RectF(new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight())); paint.setAntiAlias(true); canvas.drawARGB(0, 0, 0, 0); paint.setColor(Color.BLACK); canvas.drawRoundRect(rectF, roundPx, roundPx, paint); paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); final Rect src = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()); canvas.drawBitmap(bitmap, src, rect, paint); return output; } catch (Exception e) { return bitmap; } }
From source file:org.stockchart.core.Appearance.java
public void applyOutline(Paint p) { p.reset();/*from w w w . j a v a 2 s . co m*/ p.setShader(null); p.setColor(fOutlineColor); p.setAntiAlias(fIsAntialias); p.setStrokeWidth(fOutlineWidth); p.setStyle(Style.STROKE); switch (fOutlineStyle) { case DASH: p.setPathEffect(DASH_EFFECT); break; default: p.setPathEffect(null); } }
From source file:com.gj.administrator.gjerp.view.CircleIndicator.java
private void createTabItems() { for (int i = 0; i < viewPager.getAdapter().getCount(); i++) { OvalShape circle = new OvalShape(); ShapeDrawable drawable = new ShapeDrawable(circle); ShapeHolder shapeHolder = new ShapeHolder(drawable); Paint paint = drawable.getPaint(); paint.setColor(mIndicatorBackground); paint.setAntiAlias(true); shapeHolder.setPaint(paint);//from w w w . jav a2 s . c o m tabItems.add(shapeHolder); } }
From source file:com.gj.administrator.gjerp.view.CircleIndicator.java
private void createMovingItem() { OvalShape circle = new OvalShape(); ShapeDrawable drawable = new ShapeDrawable(circle); movingItem = new ShapeHolder(drawable); Paint paint = drawable.getPaint(); paint.setColor(mIndicatorSelectedBackground); paint.setAntiAlias(true); switch (mIndicatorMode) { case INSIDE://from ww w.j a v a2s. c o m paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP)); break; case OUTSIDE: paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); break; case SOLO: paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC)); break; } movingItem.setPaint(paint); }
From source file:gov.sfmta.sfpark.AnnotationsOverlay.java
public void draw(Canvas canvas, MapView mapv, boolean shadow) { if (shadow) { return;// w ww . j av a 2 s. c o m } Projection projection = mapv.getProjection(); Point from = new Point(); Point to = new Point(); Paint mPaint = new Paint(); mPaint.setStyle(Style.STROKE); mPaint.setAntiAlias(true); mPaint.setStrokeWidth(6); mPaint.setStrokeCap(Paint.Cap.ROUND); // could have NPE: try { for (MyAnnotation a : MainScreenActivity.annotations) { if (a.onStreet) { projection.toPixels(a.nw, from); projection.toPixels(a.se, to); if (MainScreenActivity.showPrice) { mPaint.setColor(a.blockColorPrice); canvas.drawLine(from.x, from.y, to.x, to.y, mPaint); } else { // new: no more availability data on blockfaces. // mPaint.setColor(a.blockColorAvailability); } } } } catch (NullPointerException npe) { // oh sadface! just ignore. } super.draw(canvas, mapv, shadow); }