Fuzzy brushes...

Ed McNierney ed at TOPOZONE.COM
Thu Dec 15 18:01:48 EST 2005


Steve -

Yes - I realized essentially the same thing on the drive home; the title
"fuzzy BRUSHES" should have tipped me off <g>.  Yes, there are a number
of symbolization weirdnesses and by now they're all features, not bugs,
so I would also not recommend changing anything.  I'll be able to look
at this again later tonight and I'll review it and get back to you.

	- Ed 

-----Original Message-----
From: UMN MapServer Developers List [mailto:MAPSERVER-DEV at LISTS.UMN.EDU]
On Behalf Of Steve Lime
Sent: Thursday, December 15, 2005 5:32 PM
To: MAPSERVER-DEV at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-DEV] Fuzzy brushes...

Ed: I checked the source and the problem:

  "However, if the polygon is filled, the WIDTH is ignored - all
outlines are the same thickness."

The code is behaving as intended. Outlinecolor with a color set will
always just get you a 1-pixel outline. Fat outlines are achieved by
adding the second style with no color, but outlinecolor and width set.
It can get confusing. The problem is that width is used for other line
thinkness issues related to polygon fills. For example:

  - with a vector symbol width will get you fatter lines in the created
tile (while size gets you bigger
tiles)

  - with a hatch symbol width gets you fatter lines (and size gets you
more space between lines)

In those cases the outlinecolor can't use width. I guess I figured it
would be more consistent as it is. I don't think I'll change that
behaviour for the 4.8 release.

MapServer symbolization is pretty flexible, perhaps too flexible, so
there are a billion possibilites.

Steve

>>> Ed McNierney <ed at TOPOZONE.COM> 12/15/05 11:53 AM >>>
Steve -

There's clearly something going on if you try to draw an antialiased
border around a polygon that is NOT filled.  If I take my simple polygon
example and use this style:

STYLE
  WIDTH 1
  COLOR 0 0 255
  OUTLINECOLOR 255 0 0 0
  ANTIALIAS TRUE
END

then I get what I expect, a thin antialiased red line around blue
polygons.  But if I omit the COLOR statement (to get a thin antialiased
red line around a hollow polygon) the red line is thicker; probably
equal to a WIDTH 3 or something.  However, if the polygon is filled, the
WIDTH is ignored - all outlines are the same thickness.  If the polygon
is not filled, the line is thicker than I expect, but it does respect
the WIDTH, and larger numbers produce wider lines.

On the bright side, the line is now drawn in the right color!

These are pretty simple test cases - let me know if you need output or
MAP snippets; it's the same example I sent you yesterday.

	- Ed 

-----Original Message-----
From: UMN MapServer Developers List [mailto:MAPSERVER-DEV at LISTS.UMN.EDU]
On Behalf Of Steve Lime
Sent: Thursday, December 15, 2005 12:05 PM
To: MAPSERVER-DEV at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-DEV] Fuzzy brushes...

Thanks for the feedback. Yes, with last nights modifications the polygon
outlines work too. You can also define simple symbols for applying
patterns:

SYMBOL
  NAME 'dashed'
  TYPE SIMPLE
  STYLE 20 20 END
END

and those can use the new brushes. I still need hook into the ELLIPSE
brushes though.

As for new parameters, yes I could see some being added for fine tuning
brush creation: hardness, shape (circle, square, diamond) and so on. At
this point I thought it better not to add new keywords and just get the
basics working. 

I'm really curious about the performance hit...

Steve

>>> Yewondwossen Assefa <assefa at DMSOLUTIONS.CA> 12/15/05 10:27 AM >>>
Steve,

 I just tried the antialias on lines and It seems to work well. There
are a couple of quetions that were raised here reagrding this :
  * would paremeters like hardness be available at some point for
setting ?

I did not yer try it with polygone outlines but I am assuming that It
should work too. Is that correct ?

I will continue the testing in the next days with diffrent features and
report regularly. That for the addition.

Later,

Steve Lime wrote:

>In case anyone would like to test I have hooked up the fuzzy brush
generator in mapgd.c for the most trivial line drawing case (no symbol
defined). To use:
>
>1) define a 24-bit output format, IMAGETYPE 'png24' works nicely
>2) define a simple style definition for a line layer (or polygon
outline) like so:
>
>  STYLE
>    WIDTH 3
>    COLOR 255 0 0
>    ANTIALIAS TRUE
>  END
>
>3) set TRANSPARENCY ALPHA to enable alpha blending
>
>Caveats:
>
> - brushes need to be odd sized. That requirement is enforced in the
brush builder which detects even sized requests and rounds up. Symbol
scaling should work just fine.
>
> - you'll notice that the line "fades" in at the start which is due to
the  transparent nature of the brush. Adjusting the default "hardness"
may minimize that.
>
>That should do it. I will enable for circles layers and other instances
where it makes sense (circle symbols, simple symbols with dash patterns
and so on) ASAP. I also will enable image cache use in the most simple
case which may help performance a bit.
>
>Note, I hope to do away with 3) (there is a bug filed) but can't yet
because of a problem in the image merging code in mapgd.c (not mine old
code for a change).
>
>Steve    
>  
>


--
----------------------------------------------------------------
Assefa Yewondwossen           
Software Analyst   

Email: assefa at dmsolutions.ca    
http://www.dmsolutions.ca/ 

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------



More information about the mapserver-dev mailing list