[mapserver-commits] r13154 - in branches/branch-6-0/mapserver: . mapscript/php

svn at osgeo.org svn at osgeo.org
Wed Feb 15 14:05:59 EST 2012


Author: aboudreault
Date: 2012-02-15 11:05:59 -0800 (Wed, 15 Feb 2012)
New Revision: 13154

Modified:
   branches/branch-6-0/mapserver/HISTORY.TXT
   branches/branch-6-0/mapserver/mapscript/php/style.c
Log:
Backport 6.0: Fixed PHP MapScript opacity property of StyleObj no longer works (#3920)

Modified: branches/branch-6-0/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-6-0/mapserver/HISTORY.TXT	2012-02-15 19:00:15 UTC (rev 13153)
+++ branches/branch-6-0/mapserver/HISTORY.TXT	2012-02-15 19:05:59 UTC (rev 13154)
@@ -15,6 +15,8 @@
 Current Version (future 6.0.3, SVN branch-6-0):
 ---------------------------
 
+- Fixed PHP MapScript opacity property of StyleObj no longer works (#3920)
+
 - Added MS_CJC_* constants in PHP/MapScript (#4183)
 
 - Fixed Memory leak with fribidi strings (#4188)

Modified: branches/branch-6-0/mapserver/mapscript/php/style.c
===================================================================
--- branches/branch-6-0/mapserver/mapscript/php/style.c	2012-02-15 19:00:15 UTC (rev 13153)
+++ branches/branch-6-0/mapserver/mapscript/php/style.c	2012-02-15 19:05:59 UTC (rev 13154)
@@ -234,7 +234,24 @@
     else IF_SET_LONG("linejoinmaxsize", php_style->style->linejoinmaxsize, value)
     else IF_SET_DOUBLE("angle", php_style->style->angle, value)
     else IF_SET_LONG("autoangle", php_style->style->autoangle, value)
-    else IF_SET_LONG("opacity", php_style->style->opacity, value)
+    else if (STRING_EQUAL("opacity", property))
+    {
+        int alpha;
+        convert_to_long(value);
+        php_style->style->opacity = Z_LVAL_P(value);
+
+        /* apply opacity as the alpha channel color(s) */
+        if(php_style->style->opacity < 100)
+          alpha = MS_NINT(php_style->style->opacity*2.55);
+        else
+            alpha = 255;
+
+        php_style->style->color.alpha = alpha; 
+        php_style->style->outlinecolor.alpha = alpha;
+        php_style->style->backgroundcolor.alpha = alpha;
+        php_style->style->mincolor.alpha = alpha;
+        php_style->style->maxcolor.alpha = alpha;
+    }
     else if (STRING_EQUAL("symbolname", property))
     {
         convert_to_string(value);



More information about the mapserver-commits mailing list