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

Re: [pygame] Transparent text + scrollback



On Mon, 2001-11-26 at 15:25, Pete Shinners wrote:
[...]
> you have two options. the first one is to use the Numeric and surfarray 
> modules to transfer the alpha information around. this will get you the 
> exact results you want, but is a bit of a hassle, and will require 
> Numeric python as a dependency.

I'm trying to keep the number of dependencies to a minimum. I may look
into this if other methods don't work or are too slow or ugly.

> the other option is to stick with colorkeys. you can still use colorkeys 
> with smoothed text. what you need is to supply a background color that 
> matches the background area for the text as best as possible. then set 
> the colorkey for the image and blit away.

Unfortunately, I don't have a way to predict what the background will
look like, so this would end up with a non-alpha-blended halo around the
text, which I imagine would look kind of ugly.

> btw, i don't think you are going to really gain anything by keeping the 
> text in a full image. it does let you blit the scrolling text tool in a 
> single blit call, but it won't really be faster than blitting each line 
> separately. still, as long as you don't let the image get too long, you 
> won't have any trouble either :]

I am attempting to avoid looping through the lines in the buffer.

> btw, this colorkeyed smooth text is a lot faster than using regular 
> smoothed text with alphas. here's a simple version of the text rendering 
> code in solarwolf...

Thanks for the info! I will try blitting each text line directly onto
the surface, then if that's too slow I'll try colorkeyed non-smooth
text. If that doesn't look good I'll try Surfarray. Perhaps we should
bug the SDL people about the ability to copy alpha.

PGP signature