Skip to content

Instantly share code, notes, and snippets.

@LarsSchy
Created February 23, 2022 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LarsSchy/4aa75fd2a6bc7eb01a7cff9beb64b59a to your computer and use it in GitHub Desktop.
Save LarsSchy/4aa75fd2a6bc7eb01a7cff9beb64b59a to your computer and use it in GitHub Desktop.
Testing "Chainable Compositing Filters"
MAP
#
# layer_comp.map
#
# Lars Schylberg, 2022-02-23
#
# Testing "Chainable Compositing Filters" from RFC113
#
# Test command: map2img -m layer_comp.map -o layer_comp.png
# tested with: MapServer version 7.7-dev, but should work with 7.4 and 7.6
#
# documentation from mapservers-users list
#
# COMPFILTER
# The currently available filters are:
# - "blur(integer)"
# - "translate(integer,integer)"
# - "grayscale()"
# - "blacken()"
# - "whiten()"
#
# The COMPOP values that can be used should be explicit
# and are listed here:
# clear
# color-burn
# color-dodge
# contrast*
# darken
# difference
# dst
# dst-atop
# dst-in
# dst-out
# dst-over
# exclusion
# hard-light
# invert*
# invert-rgb*
# lighten
# minus*
# multiply
# overlay
# plus
# screen
# soft-light
# src
# src-atop
# src-in
# src-out
# src-over
# xor
# Operators marked with a star (*) will only
# be supported when using an AGG backends and
# when pixman support is not enabled,
# and will fall back to “src-over” when this is not the case.
#
NAME test_layer_comppipeline
EXTENT 0 0 20 15
SIZE 400 300
UNITS DD
IMAGECOLOR 200 200 200
# CONFIG "MS_ERRORFILE" "/tmp/test.log"
DEBUG 5
OUTPUTFORMAT
NAME "AGG"
DRIVER AGG/PNG
IMAGEMODE RGB
END
WEB
IMAGEPATH "/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
METADATA
"wms_srs" "EPSG:3006 EPSG:4326 EPSG:3857"
"ows_enable_request" "*"
"ows_title" " test"
END
END
PROJECTION
"init=epsg:4326"
END
SYMBOL
NAME "Tree"
TYPE VECTOR
POINTS
5 0
4 0
3 1
3 2
0 5
0 7
1 8
8 8
9 7
9 5
6 2
6 1
5 0
-99 -99
4 7
4 12
5 12
5 7
END
END
# Start of layer definitions
#
LAYER
NAME "lake"
TYPE POLYGON
FEATURE POINTS 10 5 15 10 5 10 10 5 END END
STATUS ON
COMPOSITE
#first we render normal water color
# OPACITY 100
END
COMPOSITE
COMPFILTER "whiten()"
COMPFILTER "blur(10)"
COMPOP "soft-light"
OPACITY 50
END
CLASS
STYLE
COLOR 156 192 249 # watercolor
END
END
END # Layer
LAYER
NAME "house"
TYPE POLYGON
FEATURE POINTS 4 5 4 6 5 6 5 5 4 5 END END
STATUS ON
COMPOSITE
#create the shadow/blur effect by translating a blurred version of the layer
COMPFILTER "grayscale()"
COMPFILTER "translate(5,5)"
COMPFILTER "blur(4)"
OPACITY 50
END
COMPOSITE
#and render the buildings themselves
OPACITY 100
END
CLASS
STYLE
COLOR 128 128 128
OUTLINECOLOR 0 0 0
WIDTH 1
END
END
END # Layer
LAYER
NAME "line-test"
TYPE LINE
FEATURE POINTS 14 5 18 10 END END
STATUS ON
COMPOSITE
#create the shadow/blur effect by translating a blurred version of the layer
# COMPFILTER "grayscale()"
COMPFILTER "translate(5,5)"
COMPFILTER "blur(5)"
OPACITY 50
END
COMPOSITE
OPACITY 100
END
CLASS
STYLE
COLOR 225 95 31
WIDTH 2
END
END
END # Layer
LAYER
NAME "point-symbol-test"
TYPE POINT
FEATURE POINTS 2 10 END END
STATUS ON
COMPOSITE
#create the shadow/blur effect by translating a blurred version of the layer
COMPFILTER "blacken()"
COMPFILTER "translate(-6,-5)"
COMPFILTER "blur(7)"
OPACITY 50
END
COMPOSITE
OPACITY 100
END
CLASS
STYLE
SYMBOL "Tree"
SIZE 24
COLOR 5 255 10
WIDTH 2
END
END
END # Layer
END # Map File
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment