I have a shape that I draw using a path. I fill this shape with a gradient, and then I need to put another gray area on top of this gradient, depending on%. I use path.quadTo to make my shape, so I donβt know the y coordinates of the top line to cross it correctly. This is what I get when I just set it to maximum y:

The white bar is an image that I am trying to partially fill. The right gray area that I want to save, but I need to get rid of the left gray area. Any ideas? This is what I am trying to do so far:
@Override public void onDraw(Canvas canvas) { Path path = new Path(); Path grayPath = new Path(); float x1,y1,x3,y3,x2,y2; float x1g,x2g; int width = canvas.getWidth(); int height = canvas.getHeight(); gradientPaint.setShader(new LinearGradient(0, height,width,height, new int[]{Color.RED, Color.YELLOW, Color.GREEN}, new float[] {0,0.6f,1}, Shader.TileMode.REPEAT)); x1 = 0; y1 = (float) (height * .90); x2 = (float) (width * .75); y2 = (float) (height * .50); x3 = width; y3 = (float) (height * .10); x2g = (float) (width*.50);
Shawn source share