android Programming Glossary: paint.anti_alias_flag
Masking(crop) image in frame http://stackoverflow.com/questions/12614542/maskingcrop-image-in-frame Canvas mCanvas new Canvas result Paint paint new Paint Paint.ANTI_ALIAS_FLAG paint.setXfermode new PorterDuffXfermode PorterDuff.Mode.DST_IN..
How to Show Circular Text using TextView in Android http://stackoverflow.com/questions/13153201/how-to-show-circular-text-using-textview-in-android circle.addCircle 230 350 150 Direction.CW cPaint new Paint Paint.ANTI_ALIAS_FLAG cPaint.setStyle Paint.Style.STROKE cPaint.setColor Color.LTGRAY.. 3 setBackgroundResource R.drawable.heart tPaint new Paint Paint.ANTI_ALIAS_FLAG tPaint.setStyle Paint.Style.FILL_AND_STROKE tPaint.setColor..
Android Maps API v2 draw circle http://stackoverflow.com/questions/13991301/android-maps-api-v2-draw-circle Bitmap getBitmap fill color Paint paint1 new Paint Paint.ANTI_ALIAS_FLAG paint1.setColor 0x110000FF paint1.setStyle Style.FILL stroke.. Style.FILL stroke color Paint paint2 new Paint Paint.ANTI_ALIAS_FLAG paint2.setColor 0xFF0000FF paint2.setStyle Style.STROKE icon..
Crop image by polygon area http://stackoverflow.com/questions/15969028/crop-image-by-polygon-area Canvas maskCanvas new Canvas maskImg Paint paint new Paint Paint.ANTI_ALIAS_FLAG paint.setAntiAlias true paint.setStyle Paint.Style.FILL paint.setXfermode..
Android color picker to be included in the activity http://stackoverflow.com/questions/16363235/android-color-picker-to-be-included-in-the-activity s new SweepGradient 0 0 mColors null mPaint new Paint Paint.ANTI_ALIAS_FLAG mPaint.setShader s mPaint.setStyle Paint.Style.STROKE mPaint.setStrokeWidth.. mPaint.setStrokeWidth 32 mCenterPaint new Paint Paint.ANTI_ALIAS_FLAG mCenterPaint.setColor color mCenterPaint.setStrokeWidth 5 private..
Android: BitmapFactory.decodeByteArray gives pixelated bitmap http://stackoverflow.com/questions/2183808/android-bitmapfactory-decodebytearray-gives-pixelated-bitmap the onDraw method of a View object Paint paint new Paint Paint.ANTI_ALIAS_FLAG Paint.FILTER_BITMAP_FLAG canvas.drawBitmap bitmap 0 0 paint..
Creating Custom Overlay on the map http://stackoverflow.com/questions/4428730/creating-custom-overlay-on-the-map Math.abs pt2.y pt.y Paint circlePaint new Paint Paint.ANTI_ALIAS_FLAG circlePaint.setColor 0x30000000 circlePaint.setStyle Style.FILL_AND_STROKE..
Android Edit Bitmap Channels http://stackoverflow.com/questions/4560265/android-edit-bitmap-channels Color.BLUE Mode.DARKEN Paint alphaPaint new Paint Paint.ANTI_ALIAS_FLAG alphaPaint.setXfermode new PorterDuffXfermode Mode.DST_IN c.setBitmap..
Make certain area of bitmap transparent on touch http://stackoverflow.com/questions/5368774/make-certain-area-of-bitmap-transparent-on-touch true c2 new Canvas overlay pTouch new Paint Paint.ANTI_ALIAS_FLAG pTouch.setXfermode new PorterDuffXfermode Mode.SRC_OUT pTouch.setColor..
Horizontal scrolling grid view http://stackoverflow.com/questions/5725745/horizontal-scrolling-grid-view this.setBackgroundColor Color.LTGRAY Paint paint new Paint Paint.ANTI_ALIAS_FLAG paint.setColor color canvas.drawCircle 20 20 20 paint share..
Cardio graph for android http://stackoverflow.com/questions/6041190/cardio-graph-for-android instance ready during initialization Paint paint new Paint Paint.ANTI_ALIAS_FLAG paint.setStyle Paint.Style.STROKE paint.setStrokeWidth 3 paint.setColor..
How to draw a Line in ImageView on Android? http://stackoverflow.com/questions/6178896/how-to-draw-a-line-in-imageview-on-android onDraw Canvas canvas super.onDraw canvas Paint p new Paint Paint.ANTI_ALIAS_FLAG canvas.drawLine 0 0 20 20 p and in your main class create object..
Android How to draw a smooth line following your finger http://stackoverflow.com/questions/8287949/android-how-to-draw-a-smooth-line-following-your-finger you change your paint from fill to stroke paint new Paint Paint.ANTI_ALIAS_FLAG paint.setStyle Paint.Style.STROKE paint.setStrokeWidth 2 paint.setColor..
How to write curved text? http://stackoverflow.com/questions/8337221/how-to-write-curved-text 100 200 250 mArc.addArc oval 180 200 mPaintText new Paint Paint.ANTI_ALIAS_FLAG mPaintText.setStyle Paint.Style.FILL_AND_STROKE mPaintText.setColor..
How to draw lines over ImageView on Android? http://stackoverflow.com/questions/8831642/how-to-draw-lines-over-imageview-on-android canvas TODO Auto generated method stub Paint p new Paint Paint.ANTI_ALIAS_FLAG canvas.drawLine 0 0 20 20 p super.onDraw canvas Now how can..
ImageView with rounded corners and inner shadow http://stackoverflow.com/questions/9469748/imageview-with-rounded-corners-and-inner-shadow getWidth padding getHeight padding mPaint new Paint Paint.ANTI_ALIAS_FLAG mPaint.setColor 0xFF000000 canvas.drawRoundRect frame radius.. mBitmap TileMode.CLAMP TileMode.CLAMP mPaint new Paint Paint.ANTI_ALIAS_FLAG mPaint.setColor 0xFF000000 mPaint.setMaskFilter new BlurMaskFilter..
Masking(crop) image in frame http://stackoverflow.com/questions/12614542/maskingcrop-image-in-frame mask.getWidth mask.getHeight Config.ARGB_8888 Canvas mCanvas new Canvas result Paint paint new Paint Paint.ANTI_ALIAS_FLAG paint.setXfermode new PorterDuffXfermode PorterDuff.Mode.DST_IN mCanvas.drawBitmap original 0 0 null mCanvas.drawBitmap..
How to Show Circular Text using TextView in Android http://stackoverflow.com/questions/13153201/how-to-show-circular-text-using-textview-in-android context int color Color.argb 127 255 0 255 circle new Path circle.addCircle 230 350 150 Direction.CW cPaint new Paint Paint.ANTI_ALIAS_FLAG cPaint.setStyle Paint.Style.STROKE cPaint.setColor Color.LTGRAY cPaint.setStrokeWidth 3 setBackgroundResource R.drawable.heart.. cPaint.setColor Color.LTGRAY cPaint.setStrokeWidth 3 setBackgroundResource R.drawable.heart tPaint new Paint Paint.ANTI_ALIAS_FLAG tPaint.setStyle Paint.Style.FILL_AND_STROKE tPaint.setColor Color.BLACK tPaint.setTextSize 50 @Override protected void onDraw..
Android Maps API v2 draw circle http://stackoverflow.com/questions/13991301/android-maps-api-v2-draw-circle lat2 lng2 return Math.abs p1.x p2.x 3. bitmap creation private Bitmap getBitmap fill color Paint paint1 new Paint Paint.ANTI_ALIAS_FLAG paint1.setColor 0x110000FF paint1.setStyle Style.FILL stroke color Paint paint2 new Paint Paint.ANTI_ALIAS_FLAG paint2.setColor.. Paint Paint.ANTI_ALIAS_FLAG paint1.setColor 0x110000FF paint1.setStyle Style.FILL stroke color Paint paint2 new Paint Paint.ANTI_ALIAS_FLAG paint2.setColor 0xFF0000FF paint2.setStyle Style.STROKE icon Bitmap icon BitmapFactory.decodeResource YourActivity.getResources..
Crop image by polygon area http://stackoverflow.com/questions/15969028/crop-image-by-polygon-area Bitmap.Config.ARGB_8888 Canvas mCanvas new Canvas resultImg Canvas maskCanvas new Canvas maskImg Paint paint new Paint Paint.ANTI_ALIAS_FLAG paint.setAntiAlias true paint.setStyle Paint.Style.FILL paint.setXfermode new PorterDuffXfermode Mode.DST_IN Path path new..
Android color picker to be included in the activity http://stackoverflow.com/questions/16363235/android-color-picker-to-be-included-in-the-activity 0xFF0000FF 0xFF00FFFF 0xFF00FF00 0xFFFFFF00 0xFFFF0000 Shader s new SweepGradient 0 0 mColors null mPaint new Paint Paint.ANTI_ALIAS_FLAG mPaint.setShader s mPaint.setStyle Paint.Style.STROKE mPaint.setStrokeWidth 32 mCenterPaint new Paint Paint.ANTI_ALIAS_FLAG.. mPaint.setShader s mPaint.setStyle Paint.Style.STROKE mPaint.setStrokeWidth 32 mCenterPaint new Paint Paint.ANTI_ALIAS_FLAG mCenterPaint.setColor color mCenterPaint.setStrokeWidth 5 private boolean mTrackingCenter private boolean mHighlightCenter..
Android: BitmapFactory.decodeByteArray gives pixelated bitmap http://stackoverflow.com/questions/2183808/android-bitmapfactory-decodebytearray-gives-pixelated-bitmap 0 data.length opt I then draw the bitmap onto a canvas in the onDraw method of a View object Paint paint new Paint Paint.ANTI_ALIAS_FLAG Paint.FILTER_BITMAP_FLAG canvas.drawBitmap bitmap 0 0 paint The problem is that the resulting picture is pixelated and I..
Creating Custom Overlay on the map http://stackoverflow.com/questions/4428730/creating-custom-overlay-on-the-map pt2 new Point projection.toPixels newGeos pt2 float circleRadius Math.abs pt2.y pt.y Paint circlePaint new Paint Paint.ANTI_ALIAS_FLAG circlePaint.setColor 0x30000000 circlePaint.setStyle Style.FILL_AND_STROKE canvas.drawCircle float pt.x float pt.y circleRadius..
Android Edit Bitmap Channels http://stackoverflow.com/questions/4560265/android-edit-bitmap-channels TileMode.CLAMP bluePaint.setColorFilter new PorterDuffColorFilter Color.BLUE Mode.DARKEN Paint alphaPaint new Paint Paint.ANTI_ALIAS_FLAG alphaPaint.setXfermode new PorterDuffXfermode Mode.DST_IN c.setBitmap resultImage c.drawRect 0 0 width height redPaint c.drawRect..
Make certain area of bitmap transparent on touch http://stackoverflow.com/questions/5368774/make-certain-area-of-bitmap-transparent-on-touch getResources R.drawable.over .copy Config.ARGB_8888 true c2 new Canvas overlay pTouch new Paint Paint.ANTI_ALIAS_FLAG pTouch.setXfermode new PorterDuffXfermode Mode.SRC_OUT pTouch.setColor Color.TRANSPARENT pTouch.setMaskFilter new BlurMaskFilter..
Horizontal scrolling grid view http://stackoverflow.com/questions/5725745/horizontal-scrolling-grid-view
Cardio graph for android http://stackoverflow.com/questions/6041190/cardio-graph-for-android the graph by hand using Path and a SurfaceView. Get a Paint instance ready during initialization Paint paint new Paint Paint.ANTI_ALIAS_FLAG paint.setStyle Paint.Style.STROKE paint.setStrokeWidth 3 paint.setColor Color.GREEN Change to what you want When you need..
How to draw a Line in ImageView on Android? http://stackoverflow.com/questions/6178896/how-to-draw-a-line-in-imageview-on-android Auto generated constructor stub @Override protected void onDraw Canvas canvas super.onDraw canvas Paint p new Paint Paint.ANTI_ALIAS_FLAG canvas.drawLine 0 0 20 20 p and in your main class create object MyImageView and when you touch your display call the update..
Android How to draw a smooth line following your finger http://stackoverflow.com/questions/8287949/android-how-to-draw-a-smooth-line-following-your-finger point.x point.y canvas.drawPath path paint make sure you change your paint from fill to stroke paint new Paint Paint.ANTI_ALIAS_FLAG paint.setStyle Paint.Style.STROKE paint.setStrokeWidth 2 paint.setColor Color.WHITE Another option is to connect the points..
How to write curved text? http://stackoverflow.com/questions/8337221/how-to-write-curved-text context super context mArc new Path RectF oval new RectF 50 100 200 250 mArc.addArc oval 180 200 mPaintText new Paint Paint.ANTI_ALIAS_FLAG mPaintText.setStyle Paint.Style.FILL_AND_STROKE mPaintText.setColor Color.WHITE mPaintText.setTextSize 20f @Override protected..
How to draw lines over ImageView on Android? http://stackoverflow.com/questions/8831642/how-to-draw-lines-over-imageview-on-android constructor stub @Override protected void onDraw Canvas canvas TODO Auto generated method stub Paint p new Paint Paint.ANTI_ALIAS_FLAG canvas.drawLine 0 0 20 20 p super.onDraw canvas Now how can i add this MyImageView to my app android android imageview..
ImageView with rounded corners and inner shadow http://stackoverflow.com/questions/9469748/imageview-with-rounded-corners-and-inner-shadow 4 int padding 2 int bleed 2 RectF frame new RectF padding padding getWidth padding getHeight padding mPaint new Paint Paint.ANTI_ALIAS_FLAG mPaint.setColor 0xFF000000 canvas.drawRoundRect frame radius radius mPaint Shader bitmapShader new BitmapShader mBitmap.. frame radius radius mPaint Shader bitmapShader new BitmapShader mBitmap TileMode.CLAMP TileMode.CLAMP mPaint new Paint Paint.ANTI_ALIAS_FLAG mPaint.setColor 0xFF000000 mPaint.setMaskFilter new BlurMaskFilter bleed Blur.INNER mPaint.setShader bitmapShader canvas.drawRoundRect..
|