Opened 18 years ago

Closed 18 years ago

#1659 closed defect (fixed)

Antialiased line thickness

Reported by: michele.manzato@… Owned by: sdlime
Priority: high Milestone:
Component: MapServer CGI Version: 4.8
Severity: normal Keywords:
Cc: pspencer@…

Description

There is a considerable difference in the thickness of WIDTH 2 lines when  
antialiasing is turned on and off. The look of WIDTH 2 antialiased lines is  
comparable to the look of WIDTH 5 non-antialiased lines.  
 
It would be much nicer to have intermediate line thicknesses between WIDTH 1 
and WIDTH 2.  
 
I guess this has something to do with the settings of the fuzzy brushes used   
when antialiased line widths is > 1. 
 
Also, when antialiasing is turned on, it happens that WIDTH 2 = WIDTH 3, WIDTH 
4 = WIDTH 5, and so on. 
 
Thanks all

Change History (4)

comment:1 by michele.manzato@…, 18 years ago

Here is a proposed fix to the problem above. In "mapgd.c", inside  
"createFuzzyBrush()", change:  
  
  ...  
  double hardness=.5;  
    
  if(size % 2 == 0) /* requested an even-sized brush, add one to size */  
  ...  
  
to:  
  
  ...  
  double hardness=.5;  
  size--;    
  if(size % 2 == 0) /* requested an even-sized brush, add one to size */  
  ...  
  
so to reduce the fuzzy brush size to 3 by 3 instead of 5 by 5. Hopefully, this  
patch still gives acceptable results when using WIDTH 2 "antialiased" lines.  
Also the line thickness is just 1 pixel wider than the WIDTH 2 non-antialiased  
lines.  

comment:2 by sdlime, 18 years ago

Cc: pspencer@… added
Status: newassigned
Michele: zI think you are right. The way the code was you'd never see a 3x3 
fuzzy brush unless size=1 (which never happens since we use the straight GD 
antialiasing code in that case). I've committed a slightly different version of 
the patch to mapgd.c in CVS HEAD. I simply changed:

if(size % 2 == 0) /* requested an even-sized brush, add one to size */  
  size++;

to:

if(size % 2 == 0) /* requested an even-sized brush, subtract one from size */  
  size--;

I think the outcome is the same.

I've also CC'd Paul Spencer at DM Solutions since he's one of the bigger users 
of this functionality for any comments.

I will backport to 4.8 if you all can do a bit of testing with the CVS 
version...

Steve

comment:3 by pspencer@…, 18 years ago

thanks Steve.  This is a very good change IMO.  I haven't started to do more detailed work with antialiasing 
as I am waiting on the ability to set the hardness on a per-style basis (hint, hint), but this change would 
really help with the smaller scales.  I'm trying to test this change on my existing setup to see what effect it 
has.

comment:4 by sdlime, 18 years ago

Resolution: fixed
Status: assignedclosed
Marking as fixed...
Note: See TracTickets for help on using tickets.