Questions tagged [android-paint]

68 questions
2
votes
1 answer

How to efficiently resize image with antialias?

I try to resize an image like this: aPaint.setAntiAlias(true); // Enabling this flag will cause all draw operations that support antialiasing to use it. aPaint.setFilterBitmap(True); // enable bilinear sampling on scaled bitmaps. If cleared, scaled…
user8614758
2
votes
1 answer

Set letter spacing to drawTextOnPath

I am using following code to make a spinner wheel. @Override public void onDraw(Canvas canvas) { super.onDraw(canvas); for (int i = 0; i < segmentColors.length; i ++) { drawDataSet(canvas, i); } …
Muhammad Umar
  • 10,865
  • 19
  • 79
  • 179
2
votes
1 answer

Undo and Redo on canvas

I am developing drawing app, in which user can draw Shapes like Rectangle, circle etc. User can also make a free hand drawing(Pen). I want to add undo, redo feature. I have searched and read most of SO answer for undo and redo, but all are related…
Rohan Patel
  • 1,508
  • 2
  • 15
  • 32
2
votes
2 answers

How to create graph with edges and vertices in Android

I want to create graph (with edges and vertices), to implement a problem called 3-color. I just need a little guidance on how to start, should i use a multiple views and draw each view as a circle, and then how can i connect lines (edges) between…
2
votes
0 answers

Android Path FILL_AND_STROKE not completely filling inside of Path

I am seeing a weird fill behavior on some of the Paths I am drawing to a Canvas in Android. When the Path has a stroke and a fill (Paint style Paint.Style.FILL_AND_STROKE) and the Path is sharply curved, the Paths stroke renders correctly but the…
jacobmoncur
  • 46
  • 2
  • 2
2
votes
1 answer

How tro draw fading path

How can I draw Path with fading (opacity or thicknes) line? Something like this. I know there is LinearGradient shader for Paint, but it won't bend along the Path. One possible solution might be to get points along the Path and just draw it by…
Pitel
  • 4,588
  • 5
  • 34
  • 65
1
vote
1 answer

Masking inputted text using canvas on android kotlin

I'm currently doing a custom pin code and doing it with a canvas and paint, Unfortunately I cant seems to copy what the iputType="numberPassword" is doing with my custom design, I want to show the number momentarily before masking it and proceed to…
user3262438
  • 63
  • 1
  • 7
1
vote
0 answers

How Android Zoom works properly?

Circle 1 in the image shows the correct location.But when I draw the same circle in the second circle area, there is a different background. I have trouble solving the problem.Can you help me ? if (zooming) { zMatrix!!.reset() …
1
vote
0 answers

Paint is not visible when we use xfermode as PorterDuffXfermode(PorterDuff.Mode.DARKEN) in Android 10

I'm drawing a background color in canvas using a Paint object. I'm using xfermode as PorterDuffXfermode(PorterDuff.Mode.DARKEN) for this paint. The background color is visible in devices below Android 10. But when I run in Android 10 devices, the…
Vijay
  • 516
  • 5
  • 14
1
vote
1 answer

How to draw a path where the tail fades to transparent

I am creating a simple Android app within which there are particles which move across the screen. These particles are currently drawn with a paint which has a LinearGradient shader applied. This allows the particle to nicely fade to transparent…
Alex
  • 11
  • 2
1
vote
1 answer

How to center text horizontally on Canvas

I have an ImageView with 2 TextViews. I am trying to align the captions by its median with the median (width/2) of the Canvas. Here is an illustration of what I'm trying to achieve: https://imgur.com/a/7fklSBv So far, my attempt aligns the…
1
vote
1 answer

One edge of stroke is bigger after change the left in Rect

I try to create a stroke for my view and it work well if the left and top is 0. After I change the left rect, the left edge stroke is bigger than normal. Example, I set the left to 10 public class SimpleView extends View { Paint paint = new…
Linh
  • 43,513
  • 18
  • 206
  • 227
1
vote
1 answer

Custom Progress Bar's drawable does not fit

I am trying to implement the below progress bar: and the result I am getting is: The problem here is that the lines do not fit in the progress bar as it is clear in the left and right side of the image. The reason is that I am using the progress…
1
vote
0 answers

Filling a shape of multiple paths

I have created a shape with multiple paths on a canvas and now I want to fill that shape with a color, I tried using paint.setStyle(Paint.Style.FILL); but that only seems to fill the paths separately, my question is how to fill the whole shape. Here…
smovie9
  • 648
  • 1
  • 8
  • 14
1
vote
1 answer

Modifying bitmap is very slow...Is there any other way for this?

I am here trying to convert my current bitmap in black and white bitmap by writing following method.But it takes very long time to convert because of its for loop of every pixels.Am i wrong here any where? or is there any other way to do this?..Help…