Example #1
0
// GetRGBAt( point )
//  Return the RGB color at the given point.
//  Invalid in Greyscale mode
const IMG_BYTE * ImageClass::GetRGBAt( int point ) {
  int index;

  if( type == IMAGE_INDEXED ) {         // Indexed Image
    index = image[ GetIndexAt( point ) ];
    return GetPaletteColor( index );
  } else if( type == IMAGE_GREY ) {     // Grey; Invalid
    SetErrorState( IMAGE_WRONG_MODE_FOR_FUNCTION );
    return NULL;
  } else if( (type == IMAGE_RGBA) || ( type = IMAGE_RGB ) ) {  // True-Color Image
    return &( image[ GetIndexAt( point ) ] );
  }

  // Unknown; return 0
  return 0;
}
Example #2
0
void CGUIList::OnMouseDown()
{
	int i = GetIndexAt((float) GetMouse()->GetX(), (float) GetMouse()->GetY());
	if (i >= 0) SetIndex(i);
}