Skip to main content

Color Gradient in an rectangle

2 replies [Last post]
Joined: 2010-02-03


I would draw an rectangle with a color gradient (blue to red)

But the Graphics.setPaint method doesn´t work in phoneme personale profile.

I have tried it with following code, but it is very slow. The rectangle is often repaint, so I need
a fast workaround.

for(int i=1; i < this.width ; i++){
for(int y=1; y < this.height ; y++){
int rot = (int) Math.floor( 255*i/this.width );
int blau = (int) Math.floor( 255*y/this.height );
_g.setColor(new Color(rot,0,blau));

Does anybody know a workoaround for a color gradeint?

Thank you.

Best tregards,


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Hinkmond Wong wrote:
> Hello,
> I would draw an rectangle with a color gradient (blue to red)

Hi Mathias,

If you want to speed up drawing a color gradient on phoneME Advanced
Personal Profile, one way is to pre-render the color gradient rectangle
as an image off-device using a 3rd party tool, such as Gimp. Save the
image as a PNG or GIF file, then transfer the image file to your device
and use Personal Profile to load that image file and drawImage to your


To unsubscribe, e-mail:
For additional commands, e-mail:

Joined: 2010-02-03

Thank you. I will try this.

Best regards,