Help with .getRGB() method

Joined
Dec 15, 2009
Messages
1
Reaction score
0
Hi
I'm trying to make a BMTron game using color detection and i cant seem to get the getRGB() method to work.
Ive never used this before but it doesn't seem to hard from what I've seen on the internet, the only thing is i don't know why Ii cant get it to work.

I have two variables in order to buffer my screen
Code:
Image dbImage;
Graphics dbg;

and then I buffer my screen with
Code:
public void update (Graphics g)
  {
    if (dbImage == null)
    {
      dbImage = createImage (this.getSize().width, this.getSize().height);
      dbg = dbImage.getGraphics ();
    }
    
    dbg.setColor (getForeground());
    paint (dbg);
    
    g.drawImage (dbImage, 0, 0, this);
  }

and when i try to get an RBG value with .getRGB using
Code:
int pixel = dbImage.getRGB(50, 50);

I get an error message that says

Error: cannot find symbol
symbol : method getRGB(int,int)
location: class java.awt.Image

can anyone tell me what I'm doing wrong or what I have to include in order to make this work?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top