views:

293

answers:

2

I'm trying to convert an old Delphi program I wrote into Java to compile and run on my Android phone. I'm running the Android 2.1 operating system but am using version 1.6 of the SDK.

I have a routine in Delphi where I set the colour of pixels on a canvas individually along the lines of:

image1.canvas.pixels[x, y] := GetMyTColor(x, y);

Is there a Java equivalent to the property on the Canvas:

property Pixels[X, Y: Integer]: TColor
+1  A: 

dont know if it works for android, but can create java midlets in pascal with midletpascal.

http://sourceforge.net/projects/midletpascal/

it has a Plot() function to set a pixel in the cellphone canvas.

hope it helps

cg
That is an interesting project but unfortunately it doesn't answer the question. All I want to do is paint a pixel on a canvas in Java using the Android SDK.
Mattl
+2  A: 

It turns out this is very easy:

canvas.drawPoint(x, y, MyColour);

Where GetMyColor is a paint type:

Paint MyColour = new Paint();
int color = hex code for the colour I want to use
MyColour.setColor(color);
Mattl