Per-pixel alpha stuff

Hello,

I’m playing around with various algorithms for antialiasing lines (don’t ask
me why), and it occured to me to try and make something that functions with
per-pixel alpha blending instead of linear, foreground-to-background color
blending. Now I wonder, is this possible using SDL?

Thank you for your time,

Johannes Staffans
@Johannes_Staffans

Hello,

I’m playing around with various algorithms for antialiasing lines (don’t ask
me why), and it occured to me to try and make something that functions with
per-pixel alpha blending instead of linear, foreground-to-background color
blending. Now I wonder, is this possible using SDL?

Sure, just write your own blitter functions. :slight_smile:

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Johannes Staffans wrote:

Hello,

I’m playing around with various algorithms for antialiasing lines (don’t ask
me why), and it occured to me to try and make something that functions with
per-pixel alpha blending instead of linear, foreground-to-background color
blending. Now I wonder, is this possible using SDL?

Thank you for your time,

Johannes Staffans
troezen at iki.fi

You can create surfaces with alpha channels. Just don’t use
SDL_DisplayFormat on them.

-John–
Underfull \account (badness 10000) has occurred while \spend is active
John R. Hall - Student, Georgia Tech - Contractor, Loki Software

I’m playing around with various algorithms for antialiasing lines (don’t ask
me why), and it occured to me to try and make something that functions with
per-pixel alpha blending instead of linear, foreground-to-background color
blending. Now I wonder, is this possible using SDL?

SDL can alpha-blend a surface onto another, so you could render an antialiased
line on an RGBA surface and blit it. But that is probably wasteful since
you would have to make the surface the bounding box of your line; better
combine each pixel of your line the way you want it

Tue, 09 Jan 2001 Johannes Staffans wrote:

Hello,

I’m playing around with various algorithms for antialiasing lines (don’t ask
me why), and it occured to me to try and make something that functions with
per-pixel alpha blending instead of linear, foreground-to-background color
blending. Now I wonder, is this possible using SDL?

That’s the correct way to do it, and it should be possible - all you need is
a way to read the pixels before changing them.

However, that kind of access patterns don’t mix well with speed… If you’re
writing directly to VRAM now, you should probably do the reads from system RAM,
rather than from VRAM, at least if you’re going to do a lot of antialiazed
drawing in real time.

//David

…- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' ..- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -’