Hi I would like to set in pygame non rectangle clipping area (in this case as character "P"), where it would be strict limited, where to draw another objects.
Is there any option?
thanks a lot
Hi I would like to set in pygame non rectangle clipping area (in this case as character "P"), where it would be strict limited, where to draw another objects.
Is there any option?
thanks a lot
Let's see if I correctly understand your question: you want to "blit" an image onto a surface, but do it through a mask which would only allow certain pixels of the source to actually end up on the surface?
I had this precise problem and at first I thought it would only be doable through PIL. However after some reading and experimentation, it turns out that it can actually be done with the help of pygame's rather obscure "special flags". Below is a function which hopefully does what you want.
The mask should be white where you want it to be transparent and black otherwise.
And here is full code, that blits 2 rects on "Hello World! :D" text. Enjoy.