Opened 20 years ago
Closed 17 years ago
#931 closed defect (fixed)
After map.clone(), pixmap symbol loses transparency
Reported by: | Owned by: | sdlime | |
---|---|---|---|
Priority: | high | Milestone: | 5.0.1 release |
Component: | MapScript-SWIG | Version: | 4.3 |
Severity: | normal | Keywords: | |
Cc: |
Description (last modified by )
See testClone.png after unit tests. Problem is almost certainly in 4.2.
Attachments (7)
Change History (31)
comment:2 by , 20 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
a few new tests in clonetest.py to demonstrate the fix, all the rest of the work confined to msCopySymbol in mapsymbol.c.
comment:3 by , 17 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Doing: Dim p_mapObj As mapObj = m_mapObj.clone() p_mapObj.draw() causes the PNG symbols to lose transparency. MapServer is compiled from 4.10 release sources using MS Visual Studio 2005 SP1 and runs against .NET framework 2.0.
comment:4 by , 17 years ago
I'll attach the images of the symbol before and after it loses transparency today.
by , 17 years ago
Attachment: | symbol_before_losing_transparency.JPG added |
---|
Symbol image prior to call to clone()
by , 17 years ago
Attachment: | symbol_after_losing_transparency.JPG added |
---|
Symbol image after call to clone()
comment:5 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
comment:7 by , 17 years ago
Cc: | added |
---|
comment:8 by , 17 years ago
Description: | modified (diff) |
---|
The symbols in your example are jpg. These don't carry transparency, right?
comment:9 by , 17 years ago
testDrawClonePNG24 in clonetest.py of the MapScript tests seems to render a transparent png just fine with the latest GD. I don't understand what the issues could be. I suggest we close this bug.
comment:10 by , 17 years ago
I believe this was a known bug in GD that has been resolved. If the rotation/resize functions of GD also are fixed then that would be terrific too. Does the test pass with an older version of GD?
Steve
comment:11 by , 17 years ago
Today, I tested this issue with mapserver 4.10.2 and GD-2.0.34. Issue still exist. I did try this with mapserver 5.0 beta 3. Same Issue there. Operating system tested on Fedora core 4 , Fedora core 6 and windows XP service pack2
I am using Java mapscript to show US street maps. All the pixmap symbols which happens to be GIF files lose tranparency after mapObj.clone().
Attaching two files. 1 Actual gif file interstate.gif
- GIF shown in map output maptile.gif
Here is the code mapObj tileMap = (mapObj)oMap.cloneMap(); .... oImg = tileMap.draw(); oImg.save(szMetaImg, tileMap);
This is my first post, please let me know if you need any additional info. I will be happy to test things on my end.
comment:13 by , 17 years ago
Operating system -Fedora Core 4. Mapserver 4.10.2 gd -2.0.35
Result is same. I mean transpareny is lost after map clone. Compiled gd.2.0.35 today. For that I have to upgrade my autoconf to autoconf.2.61. Previously I had autocnf 2.59-5. After compiling & install gd2.0.35, a) ./configure b) make c) sudo make install
My /usr/local/lib dir shows
-rwxr-xr-x 1 root root 922 Aug 15 10:11 libgd.la
lrwxrwxrwx 1 root root 14 Aug 15 10:11 libgd.so -> libgd.so.2.0.0
lrwxrwxrwx 1 root root 14 Aug 15 10:11 libgd.so.2 -> libgd.so.2.0.0
-rwxr-xr-x 1 root root 532653 Aug 15 10:11 libgd.so.2.0.0
Now I recomipled mapserver 4.10.2
./configure --with-httpd=/www/http/bin/httpd \
--with-wfsclient \ --with-wmsclient \ --enable-debug \ --with-curl-config \ --with-proj \ --with-gdal \ --with-tiff \ --with-png \ --with-gd=/usr/local \ --with-freetype \ --enable-ignore-missing-data \
--with-threads
After mapserver install, ran my application, map.clone() still removes transparency. While not using map.clone preserves pixmap tranparency.
I am writing detailed info so that it can be of some help to mapserver developers. Please let me know if u need any screenshots or any other info.
comment:14 by , 17 years ago
Also symobol in symbol file is defined as
Symbol Name 'interstate' Type PIXMAP IMAGE "../etc/markers/interstate.gif" Transparent 4 END
comment:15 by , 17 years ago
Milestone: | 5.0 release → 5.0.1 release |
---|---|
Status: | new → assigned |
Something weird is going on. This probably is the same problem as the "losing transparency after rotation" bug. I think what may be happening is that the color palette is getting shuffled in the copy and simply re-using the transparent index from the original doesn't work. I've tried copying the palette using a GD function but I'm not having much luck. I'm going to defer until 5.0.1 unless I have success in the next few minutes...
Steve
comment:16 by , 17 years ago
Milestone: | 5.0.1 release → 5.0 release |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
I finally figured out how to copy a paletted symbol and preserve transparency...
Steve
comment:17 by , 17 years ago
I also fixed the truecolor cloning. Key is to fill the new image with a fully transparent color and then copy into it. That way anything in the source image that is transparent will also be transparent in the new image.
Steve
comment:18 by , 17 years ago
Milestone: | 5.0 release → 5.0.1 release |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
What you say in your last comment is very true, Steve, unfortunately the implementation doesn't reflect this logic properly. Most likely something got screwed up.
In fact, http://trac.osgeo.org/mapserver/changeset/6789 shows that the image is filled with a transparent color after it has been copied, thus making the copied image disappear. And that is what I am actually getting on my cloned maps.
Simply swapping lines 980 and 982 of mapsymbol.c fixes this again here.
comment:19 by , 17 years ago
aalbarello,
Can you provide a patch? In my mapsymbol.c, line 980 is an if statement, and I'm a bit confused as to what to rearrange.
Howard
comment:20 by , 17 years ago
Sorry Howard, I should have been more specific, but I see you've figured out yourself what I meant (http://trac.osgeo.org/mapserver/changeset/6919). I was referring to lines 980 and 982 in the mapserver 5.0.0 source distribution, not in the svn 5.0 branch, where there have apparently been some changes to mapsymbol.c in the meantime. I was indeed talking about swapping the gdImageFilledRectangle and gdImageCopy call.
If you still need a patch, let me know.
Thanks, Andreas
comment:21 by , 17 years ago
Any chance this can make it into 5.0.1? I'm including a patch against svn trunk which fixes this new issue introduced with rev 6789.
Thanks,
Andreas
by , 17 years ago
Attachment: | mapsymbol.diff added |
---|
Diff against rev 6998 of svn trunk which swaps the gdImageCopy and gdImageFilledRectangle calls.
comment:23 by , 17 years ago
Patch applied to both the main trunk and the 5.0 branch. Could someone please confirm the fix and close this sucker? Thanks!
Steve
comment:24 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Confirming the fix, everything works as expected now. Closing.
Thanks,
Andreas