Android Canvas Gradient -


example

i try draw on android canvas, , have qwestions....

1)why shaders result have white , black? there no colors...

2)how set color more 2 points (x,y)?

3)where can find examples show simple combinations of usege?

 shader1 = new lineargradient(0, 0, 0,barheight,0xff696969 ,0xffffffff, shader.tilemode.clamp);  shader2 = new lineargradient(barheight/2, barheight/2, 0,34,0xf0696969 ,0xfff34f5f, shader.tilemode.clamp);  composeshader mshader = new composeshader(shader2, shader1, porterduff.mode.multiply);         graundpaint.setshader(mshader);         canvas.drawroundrect(rectf, 0, 0, graundpaint); 

you can set more 2 points using this constructor of lineargradient, takes array of colors , corresponding array of positions (between 0 , 1).

for simple example using lineargradient, may here.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -