挿入した画像の全体的な色を変更するプログラムをPygameで作成しています。正常に動作しますが、画像の特定の部分(黒のみ)を変更したいと思います。すべての黒いピクセルの色を別の色に変更する方法はありますか?
私はすでに、他のいくつかと同様にを使用してみましsurface.set_at()
たsurface.get_at()
。助けてください?:)
PixelArrayを試してみるべきかもしれません
ドキュメントから:
PixelArray.replace
Replaces the passed color in the PixelArray with another one.
PixelArray.replace (color, repcolor, distance=0, weights=(0.299, 0.587, 0.114)): Return None
Replaces the pixels with the passed color in the PixelArray by changing them them to the passed replacement color.