[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Fast Blit with mask



How do you quickly set the alpha in a circle without changing the
color bits? Also sometimes it is a fat line at an angle that I am
using.

Thanks

Douglas

On 11/27/05, Guillaume Proux <gproux@xxxxxxxxxxxxxx> wrote:
> You might want to copy what you need from surface A into an offscreen
> buffer then set the per-pixel alpha of that surface to match your "hole"
> and then blit the resulting surface to the (black) screen
>
> Regards,
>
> Guillaume
>
> Knapp wrote:
> > I need to have 3 surfaces.
> > A is the main image
> > B is the mask. This would be a round hole that moves around like
> > looking through a gun sight on a surface the same size as A.
> > C would be the screen surface.
> >
> > In the past I would have B surface be all black and the circle be
> > white and then AND it with the A surface as I blit it to the screen
> > within the area the size of a rect of the circle.
> >
> > How is this best done in pygame?
> > I have tried many ways but all of it is to slow. It should be simple
> > to define a rect the size of the circle and AND blit it to the
> > surface.
> >
> > Thanks for any help!!
> >
> > Douglas AKA magick on IRC or magick.crow on the docs.
> >
> >
>
>
>