Hello...
I Have simple gradient, Canvas..
FullGradient.getInstance().createGradient(g,0x003A78D3,0x00000000,5,5);
but, need RADIAL GRADIENT create in Canvas, please...?
[]´s
Hello...
I Have simple gradient, Canvas..
FullGradient.getInstance().createGradient(g,0x003A78D3,0x00000000,5,5);
but, need RADIAL GRADIENT create in Canvas, please...?
[]´s
Roberto Teixeira
You could simply draw circles, from inside out, changing the colors, as much as you want.
Something like:
for (int i = 0; i < 0x100; i++){
g.setColor(i);
g.drawArc(x_position, y_position, i , i, 0, 360);
}
Hi JacksonZih...
Thanks for source. But, I Need example, this type:
http://www.tinyline.com/svgt/samples...grad-11-b.html
The problem, want does´t TinyLine, yes simple source for my Package...
very thanks!
Roberto Teixeira
I don't think i understood your question.
You posted on the J2ME section, so I thought I could help with coding =)
Hi JacksonZih...good ?
View, this is simple gradient...I use my project. But, I need by GRADIENT RADIAL...please, copy the source and compile.
public class FullGradient extends Canvas {
public void paint(Graphics g) {
Image imgBack = null;
Image imgEcra = null;
try {
imgBack = Image.createImage(10,10);
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
}
int imgDados[] = new int[getHeight()*getWidth()];
int cor = 0x00737BE1;
int c;
for (int i = 0; i < getHeight(); i++) {
c = cor | ((i*255/getHeight())<<24);
for (int j = 0; j < getWidth(); j++) {
imgDados[i*getWidth() +j] = c;
}
}
imgEcra = Image.createRGBImage(imgDados, getWidth(), getHeight(), true);
g.fillRect(0, 0, getWidth(),getHeight());
g.drawImage(imgBack, getWidth()/2, getHeight()/2, Graphics.HCENTER | Graphics.VCENTER);
g.drawImage(imgEcra, 0, 0, Graphics.TOP|Graphics.LEFT);
g.setColor(0x00000000);
g.drawString("Este é um exemplo de Gradiente. YES ! But need Go RADIAL", getWidth()/2, getHeight()/2, Graphics.HCENTER | Graphics.VCENTER);
}
}
Please All...
And please... my Blog: http://joserobertoteixeira.blogspot.com/
Thanks![]()
Last edited by j.teixeira; 2007-03-15 at 00:35.
Roberto Teixeira