Getting pixel color at location with pygame

前端 未结 1 415
北荒
北荒 2021-01-11 13:40

I\'m drawing a bunch of rectangles to the siaply screen, and I\'m wondering how I would go about reading the rgb color at a certain pixel location? For example, I want to ge

相关标签:
1条回答
  • 2021-01-11 14:01

    http://www.pygame.org/docs/ref/surface.html#Surface.get_at

    Surface.get_at((x, y)): return Color

    Return a copy of the RGBA Color value at the given pixel. If the Surface has no per pixel alpha, then the alpha value will always be 255 (opaque). If the pixel position is outside the area of the Surface an IndexError exception will be raised.

    0 讨论(0)
提交回复
热议问题