Sampling a pixel off the current drawing

Hello I am trying to sample pixels off the drawing I am making for use with collision detection, and I cant figure out a way to do it.

  
void myDrawingApplication::draw(){  
    ofSetColor(255, 255, 255);  
  
    ofSetColor(0, 0, 0);  
    ofRect(20, 20, 100, 100);  
  
    // would sample a pixel at x, y position of the mouse here and see if it's black  
}  

Is there any way to do this?

look at getPixels()

Are there any examples of accessing that info? Right now I am copying the screen to an ofImage (just white at the moment) and am getting strange values:

  
  
  
// sample color from drawing here  
screenImage.grabScreen( 0, 0, ofGetScreenWidth(), ofGetScreenHeight() );  
unsigned char *pixels = screenImage.getPixels();  
		  
int widthOfLine = ofGetScreenWidth();  
int mod = round(touchXPos * touchYPos);  
		  
int r = pixels[mod * 0];  
int g = pixels[mod * 1];  
int b = pixels[mod * 2];  
		  
printf("r: %d g: %d b: %d \n", r, g, b);