Skip to content

Commit f60648e

Browse files
committed
Fix layer compositer issues (#5283)
1 parent 4681463 commit f60648e

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed

mapdraw.c

+1
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@ int msDrawLayer(mapObj *map, layerObj *layer, imageObj *image)
771771
"msDrawLayer()");
772772
return (MS_FAILURE);
773773
}
774+
image_draw->map = map;
774775
renderer->startLayer(image_draw,map,layer);
775776
}
776777
}

mapfile.c

+105
Original file line numberDiff line numberDiff line change
@@ -4695,6 +4695,110 @@ int msUpdateLayerFromString(layerObj *layer, char *string, int url_string)
46954695
return MS_SUCCESS;
46964696
}
46974697

4698+
static void writeCompositingFilter(FILE *stream, int indent, CompositingFilter *filter) {
4699+
if(filter) {
4700+
writeString(stream, indent, "COMPFILTER", "", filter->filter);
4701+
}
4702+
}
4703+
4704+
static void writeLayerCompositer(FILE *stream, int indent, LayerCompositer *compositor) {
4705+
indent++;
4706+
while(compositor) {
4707+
writeBlockBegin(stream, indent, "COMPOSITE");
4708+
writeCompositingFilter(stream, indent, compositor->filter);
4709+
if(compositor->comp_op != MS_COMPOP_SRC_OVER) {
4710+
switch(compositor->comp_op) {
4711+
case MS_COMPOP_CLEAR:
4712+
writeString(stream, indent, "COMPOP", NULL, "clear");
4713+
break;
4714+
case MS_COMPOP_COLOR_BURN:
4715+
writeString(stream, indent, "COMPOP", NULL, "color-burn");
4716+
break;
4717+
case MS_COMPOP_COLOR_DODGE:
4718+
writeString(stream, indent, "COMPOP", NULL, "color-dodge");
4719+
break;
4720+
case MS_COMPOP_CONTRAST:
4721+
writeString(stream, indent, "COMPOP", NULL, "contrast");
4722+
break;
4723+
case MS_COMPOP_DARKEN:
4724+
writeString(stream, indent, "COMPOP", NULL, "darken");
4725+
break;
4726+
case MS_COMPOP_DIFFERENCE:
4727+
writeString(stream, indent, "COMPOP", NULL, "difference");
4728+
break;
4729+
case MS_COMPOP_DST:
4730+
writeString(stream, indent, "COMPOP", NULL, "dst");
4731+
break;
4732+
case MS_COMPOP_DST_ATOP:
4733+
writeString(stream, indent, "COMPOP", NULL, "dst-atop");
4734+
break;
4735+
case MS_COMPOP_DST_IN:
4736+
writeString(stream, indent, "COMPOP", NULL, "dst-in");
4737+
break;
4738+
case MS_COMPOP_DST_OUT:
4739+
writeString(stream, indent, "COMPOP", NULL, "dst-out");
4740+
break;
4741+
case MS_COMPOP_DST_OVER:
4742+
writeString(stream, indent, "COMPOP", NULL, "dst-over");
4743+
break;
4744+
case MS_COMPOP_EXCLUSION:
4745+
writeString(stream, indent, "COMPOP", NULL, "exclusion");
4746+
break;
4747+
case MS_COMPOP_HARD_LIGHT:
4748+
writeString(stream, indent, "COMPOP", NULL, "hard-light");
4749+
break;
4750+
case MS_COMPOP_INVERT:
4751+
writeString(stream, indent, "COMPOP", NULL, "invert");
4752+
break;
4753+
case MS_COMPOP_INVERT_RGB:
4754+
writeString(stream, indent, "COMPOP", NULL, "invert-rgb");
4755+
break;
4756+
case MS_COMPOP_LIGHTEN:
4757+
writeString(stream, indent, "COMPOP", NULL, "lighten");
4758+
break;
4759+
case MS_COMPOP_MINUS:
4760+
writeString(stream, indent, "COMPOP", NULL, "minus");
4761+
break;
4762+
case MS_COMPOP_MULTIPLY:
4763+
writeString(stream, indent, "COMPOP", NULL, "multiply");
4764+
break;
4765+
case MS_COMPOP_OVERLAY:
4766+
writeString(stream, indent, "COMPOP", NULL, "overlay");
4767+
break;
4768+
case MS_COMPOP_PLUS:
4769+
writeString(stream, indent, "COMPOP", NULL, "plus");
4770+
break;
4771+
case MS_COMPOP_SCREEN:
4772+
writeString(stream, indent, "COMPOP", NULL, "screen");
4773+
break;
4774+
case MS_COMPOP_SOFT_LIGHT:
4775+
writeString(stream, indent, "COMPOP", NULL, "soft-light");
4776+
break;
4777+
case MS_COMPOP_SRC:
4778+
writeString(stream, indent, "COMPOP", NULL, "src");
4779+
break;
4780+
case MS_COMPOP_SRC_ATOP:
4781+
writeString(stream, indent, "COMPOP", NULL, "src-atop");
4782+
break;
4783+
case MS_COMPOP_SRC_IN:
4784+
writeString(stream, indent, "COMPOP", NULL, "src-in");
4785+
break;
4786+
case MS_COMPOP_SRC_OUT:
4787+
writeString(stream, indent, "COMPOP", NULL, "src-out");
4788+
break;
4789+
case MS_COMPOP_SRC_OVER:
4790+
writeString(stream, indent, "COMPOP", NULL, "src-over");
4791+
break;
4792+
case MS_COMPOP_XOR:
4793+
writeString(stream, indent, "COMPOP", NULL, "xor");
4794+
break;
4795+
}
4796+
}
4797+
writeNumber(stream,indent,"OPACITY",100,compositor->opacity);
4798+
writeBlockEnd(stream,indent,"COMPOSITE");
4799+
compositor = compositor->next;
4800+
}
4801+
}
46984802
static void writeLayer(FILE *stream, int indent, layerObj *layer)
46994803
{
47004804
int i;
@@ -4710,6 +4814,7 @@ static void writeLayer(FILE *stream, int indent, layerObj *layer)
47104814
writeString(stream, indent, "CLASSGROUP", NULL, layer->classgroup);
47114815
writeString(stream, indent, "CLASSITEM", NULL, layer->classitem);
47124816
writeCluster(stream, indent, &(layer->cluster));
4817+
writeLayerCompositer(stream, indent, layer->compositer);
47134818
writeString(stream, indent, "CONNECTION", NULL, layer->connection);
47144819
writeKeyword(stream, indent, "CONNECTIONTYPE", layer->connectiontype, 10, MS_OGR, "OGR", MS_POSTGIS, "POSTGIS", MS_WMS, "WMS", MS_ORACLESPATIAL, "ORACLESPATIAL", MS_WFS, "WFS", MS_PLUGIN, "PLUGIN", MS_UNION, "UNION", MS_UVRASTER, "UVRASTER", MS_CONTOUR, "CONTOUR", MS_KERNELDENSITY, "KERNELDENSITY");
47154820
writeString(stream, indent, "DATA", NULL, layer->data);

0 commit comments

Comments
 (0)