[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Antialiasing again



On Sun, 13 Jan 2002 15:30, Magnus Lie Hetland wrote:
> Richard Jones <richardjones@optushome.com.au>:
>
> [...]
>
> > I had a helluva time getting the antialiasing to work with my font
> > contest entry "skyscraper". Have a look a the code there, it might give
> > you some hints.
>
> Will do. Any specific techniques I should look for?

Pretty much just the end section of do_repeat. Note that the techinique I use 
only works for greyscale images - for colour images with alpha, you'd have to 
do something else. Luckily, fonts are a-ok in this regard.


> > See the smudge and repeat operations specifically - which take the
> > antialiased source text surface and create a new surface with the source
> > repeated several times. You'll see that I had to manually render the
> > alpha channel with the correct values in both cases because the alpha
> > seemed to be either ignored or destroyed.
>
> Right... A problem inherent in SDL, as I've understood?

As I understand it, yes. I didn't actually get to investigate it fully, but I 
suspected that blitting didn't modify the target alpha, which is what I 
needed it to do. That is...

  1. I created a surface with the rendered text. Alpha is generated just a-ok 
and is used in blitting.
  2. I create a new surface - also has an alpha channel
  3. I blit the text surface to the new one. The new surface's alpha is not 
changed by the blit.
  4. I blit the new surface onto my display. Since the alpha channel is all 
255, no blending takes place. This is why the end of the do_render method 
manually reconstructs the alpha channel for the new surface.

Does help?


    Richard
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org