Anti-alias lines?

Hey guys, should lines be anti-aliased by default? Should there be an
option to enable or disable anti-aliased lines?

I’m attaching two images, one using the Bresenham line algorithm with
no anti-aliasing, and one using the Wu anti-aliased line algorithm.

See ya!–
-Sam Lantinga, Founder and President, Galaxy Gameworks LLC
-------------- next part --------------
A non-text attachment was scrubbed…
Name: bresenham.png
Type: image/png
Size: 694 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20091222/bba50ceb/attachment.png
-------------- next part --------------
A non-text attachment was scrubbed…
Name: wu-aa.png
Type: image/png
Size: 1249 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20091222/bba50ceb/attachment-0001.png

My vote: anti-aliased by default with option to disable.

The Wu looks much better than Bresenham.

JeffOn Tuesday 22 December 2009 18:06, Sam Lantinga wrote:

Hey guys, should lines be anti-aliased by default? Should there be an
option to enable or disable anti-aliased lines?

I’m attaching two images, one using the Bresenham line algorithm with
no anti-aliasing, and one using the Wu anti-aliased line algorithm.

See ya!

I’ll second what Jeff said.

Bob PendletonOn Tue, Dec 22, 2009 at 8:23 PM, Jeff Post <j_post at pacbell.net> wrote:

On Tuesday 22 December 2009 18:06, Sam Lantinga wrote:

Hey guys, should lines be anti-aliased by default? ?Should there be an
option to enable or disable anti-aliased lines?

I’m attaching two images, one using the Bresenham line algorithm with
no anti-aliasing, and one using the Wu anti-aliased line algorithm.

See ya!

My vote: anti-aliased by default with option to disable.

The Wu looks much better than Bresenham.

Jeff


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


±----------------------------------------------------------

I’d have to disagree. Antialiasing is the graphical version of code
optimization: Applying it prematurely is the root of all evil. The
default should be off, with the option to enable it. I don’t want
to have to do extra work just to make my lines not be blurry!>----- Original Message ----

From: Bob Pendleton
Subject: Re: [SDL] Anti-alias lines?

I’ll second what Jeff said.

Bob Pendleton

On Tue, Dec 22, 2009 at 8:23 PM, Jeff Post <j_post at pacbell.net> wrote:

On Tuesday 22 December 2009 18:06, Sam Lantinga wrote:
Hey guys, should lines be anti-aliased by default? Should there be an
option to enable or disable anti-aliased lines?

I’m attaching two images, one using the Bresenham line algorithm with
no anti-aliasing, and one using the Wu anti-aliased line algorithm.

See ya!

My vote: anti-aliased by default with option to disable.

The Wu looks much better than Bresenham.

Sam Lantinga wrote:

Hey guys, should lines be anti-aliased by default? Should there be an
option to enable or disable anti-aliased lines?

I’m attaching two images, one using the Bresenham line algorithm with
no anti-aliasing, and one using the Wu anti-aliased line algorithm.

For green-on-black vector graphics, the anti-aliased version obviously
looks better. The sample images don’t give me enough information to
draw conclusions about complex scenes with bitmapped backgrounds. I
know that anti-aliased filled polygons can cause all kinds of trouble,
but these problems may not apply to lines.

The non-controversial thing to do would be to make anti-aliasing optional.–
Rainer Deyke - rainerd at eldwood.com

+1On 12/23/2009 06:53 AM, Mason Wheeler wrote:

I’d have to disagree. Antialiasing is the graphical version of code
optimization: Applying it prematurely is the root of all evil. The
default should be off, with the option to enable it. I don’t want
to have to do extra work just to make my lines not be blurry!

Mason Wheeler wrote:

I’d have to disagree. Antialiasing is the graphical version of code
optimization: Applying it prematurely is the root of all evil. The
default should be off, with the option to enable it. I don’t want
to have to do extra work just to make my lines not be blurry!

Also, another thought. The anti-aliased one looks so nice that in
no time everybody will be clamouring for a full-blown vector
drawing library… :slight_smile:

Perhaps we can attempt an informal survey. How many on the list
uses line drawing in a serious app?>> ----- Original Message ----

From: Bob Pendleton
Subject: Re: [SDL] Anti-alias lines?
[snip]


Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia

Hey guys, should lines be anti-aliased by default? Should there be an
option to enable or disable anti-aliased lines?

I’m attaching two images, one using the Bresenham line algorithm with
no anti-aliasing, and one using the Wu anti-aliased line algorithm.

I would enable antialiasing by default, with an option to disable it at
runtime. Wu looks nice and is fast, but it has to read the destination
memory which might slow things down, or may not be possible.On Tue, 22 Dec 2009 18:06:56 -0800 Sam Lantinga wrote:

Johannes Kroll wrote:> On Tue, 22 Dec 2009 18:06:56 -0800 Sam Lantinga wrote:

Hey guys, should lines be anti-aliased by default? Should there be an
option to enable or disable anti-aliased lines?

I’m attaching two images, one using the Bresenham line algorithm with
no anti-aliasing, and one using the Wu anti-aliased line algorithm.

I would enable antialiasing by default, with an option to disable it at
runtime. Wu looks nice and is fast, but it has to read the destination
memory which might slow things down, or may not be possible.


I’m not sure, I’d vote for not antialiased, unless the antialiasing is
somehow gamma corrected. Antialiased graphics without gamma correction
doesn’t necessarily look better than non antialiased graphics.

Looks nice. Do you have some numbers about the performance penalty?On Tue, 22 Dec 2009 18:06:56 -0800, Sam Lantinga wrote:

I’m attaching two images, one using the Bresenham line algorithm with
no anti-aliasing, and one using the Wu anti-aliased line algorithm.


Christoph Nelles

E-Mail : @Christoph_Nelles
Jabber : eazrael at evilazrael.net ICQ : 78819723

PGP-Key : ID 0x424FB55B on subkeys.pgp.net
or http://evilazrael.net/pgp.txt

I think in the spirit of SDL, it should not put AA on you by default.
The least surprising choice is to leave AA off to start.

Jonny DOn Wed, Dec 23, 2009 at 7:34 AM, Christoph Nelles wrote:

On Tue, 22 Dec 2009 18:06:56 -0800, Sam Lantinga wrote:

I’m attaching two images, one using the Bresenham line algorithm with
no anti-aliasing, and one using the Wu anti-aliased line algorithm.

Looks nice. Do you have some numbers about the performance penalty?


Christoph Nelles

E-Mail ? ?: evilazrael at evilazrael.de
Jabber ? ?: eazrael at evilazrael.net ? ? ?ICQ ? ? ? : 78819723

PGP-Key ? : ID 0x424FB55B on subkeys.pgp.net
? ? ? ? ? ?or http://evilazrael.net/pgp.txt


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

There should definitely be an option, I think. You may not always want AA -
and not just for performance reasons.

The default should probably match the default for filtered scaling.On Wednesday 23 December 2009, at 03.06.56, Sam Lantinga wrote:

Hey guys, should lines be anti-aliased by default? Should there be an
option to enable or disable anti-aliased lines?


//David Olofson - Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://olofson.net http://kobodeluxe.com http://audiality.org |
| http://eel.olofson.net http://zeespace.net http://reologica.se |
’---------------------------------------------------------------------’

whether it is on or off, i guess the real solution would be to put the
enable/disable AA option in a very evident position, such as a parameter of
SDL_Init (or one of its flag).

VittorioOn Wed, Dec 23, 2009 at 3:49 PM, David Olofson wrote:

On Wednesday 23 December 2009, at 03.06.56, Sam Lantinga < slouken at libsdl.org> wrote:

Hey guys, should lines be anti-aliased by default? Should there be an
option to enable or disable anti-aliased lines?

There should definitely be an option, I think. You may not always want AA -
and not just for performance reasons.

The default should probably match the default for filtered scaling.


//David Olofson - Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://olofson.net http://kobodeluxe.com http://audiality.org |
| http://eel.olofson.net http://zeespace.net http://reologica.se |
’---------------------------------------------------------------------’


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Ogden Nash http://www.brainyquote.com/quotes/authors/o/ogden_nash.html -
“The trouble with a kitten is that when it grows up, it’s always a cat.”

whether it is on or off, i guess the real solution would be to put the
enable/disable AA option in a very evident position, such as a parameter of
SDL_Init (or one of its flag).

But SDL_Init is usually called only on startup. An extra function would
be better.On Wed, 23 Dec 2009 16:16:38 +0100 “Vittorio G.” <vitto.giova at yahoo.it> wrote:

Well, the standard solution that most people would expect is probably the
usual SDL_Enable*() call or something like that.

Anyway, I don’t think SDL_Init() is the best place. You may want to mix AA and
non-AA lines in an application, and I don’t think there’s any technical reason
to rule that out by design.On Wednesday 23 December 2009, at 16.16.38, “Vittorio G.” <vitto.giova at yahoo.it> wrote:

whether it is on or off, i guess the real solution would be to put the
enable/disable AA option in a very evident position, such as a parameter of
SDL_Init (or one of its flag).


//David Olofson - Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://olofson.net http://kobodeluxe.com http://audiality.org |
| http://eel.olofson.net http://zeespace.net http://reologica.se |
’---------------------------------------------------------------------’

I do, but I’m a minority in that I don’t write games. I use SDL as a simple
general purpose GUI for utilities and math programs.

JeffOn Wednesday 23 December 2009 01:07, KHMan wrote:

Perhaps we can attempt an informal survey. How many on the list
uses line drawing in a serious app?

Perhaps we can attempt an informal survey. How many on the list
uses line drawing in a serious app?

I do, but I’m a minority in that I don’t write games. I use SDL as a simple
general purpose GUI for utilities and math programs.

I’m writing a game editor, and line drawing really comes in handy for
creating cursors and stuff like that.>----- Original Message ----

From: Jeff Post <j_post at pacbell.net>
Subject: Re: [SDL] Anti-alias lines?
On Wednesday 23 December 2009 01:07, KHMan wrote:

well SDL_init was just an example
I agree on the SDL_Enable or adding a parameter to the function that draws
lines

VittorioOn Wed, Dec 23, 2009 at 4:23 PM, David Olofson wrote:

On Wednesday 23 December 2009, at 16.16.38, “Vittorio G.” <vitto.giova at yahoo.it> wrote:

whether it is on or off, i guess the real solution would be to put the
enable/disable AA option in a very evident position, such as a parameter
of
SDL_Init (or one of its flag).

Well, the standard solution that most people would expect is probably the
usual SDL_Enable*() call or something like that.

Anyway, I don’t think SDL_Init() is the best place. You may want to mix AA
and
non-AA lines in an application, and I don’t think there’s any technical
reason
to rule that out by design.


//David Olofson - Developer, Artist, Open Source Advocate

…— Games, examples, libraries, scripting, sound, music, graphics —.
| http://olofson.net http://kobodeluxe.com http://audiality.org |
| http://eel.olofson.net http://zeespace.net http://reologica.se |
’---------------------------------------------------------------------’


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Joan Crawfordhttp://www.brainyquote.com/quotes/authors/j/joan_crawford.html

  • “I, Joan Crawford, I believe in the dollar. Everything I earn, I
    spend.”

And to Sam - libcrtxy’s Wu implementation includes gamma-correction
capabilities. (I didn’t write it, and I forget now if it was
optional, or was always used when using AA lines.)

Just in case you wanted to lift or examine some example code.
It only handles sRGB, if I recall. (And, honestly, I know almost
nothing about gamma correction, so I think I’ve just exhausted any
input I can provide on the subject. :wink: )On Wed, Dec 23, 2009 at 04:33:09AM -0500, Gato wrote:

I’m not sure, I’d vote for not antialiased, unless the antialiasing is
somehow gamma corrected. Antialiased graphics without gamma correction
doesn’t necessarily look better than non antialiased graphics.


-bill!
Sent from my computer

Why not at the time of drawing? Or have AA vs non-AA line-drawing
functions to call? Or is that cluttering the API up too much? :^/

-bill!On Wed, Dec 23, 2009 at 04:16:38PM +0100, Vittorio G. wrote:

whether it is on or off, i guess the real solution would be to put the
enable/disable AA option in a very evident position, such as a parameter
of SDL_Init (or one of its flag).