Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WMS raster transparency problem #11593

Closed
qgib opened this issue Feb 8, 2009 · 6 comments
Closed

WMS raster transparency problem #11593

qgib opened this issue Feb 8, 2009 · 6 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Map and Legend Related to map or legend rendering

Comments

@qgib
Copy link
Contributor

qgib commented Feb 8, 2009

Author Name: John Tull (John Tull)
Original Redmine Issue: 1533

Redmine category:map_canvas
Assignee: ersts -


It appears that a WMS raster layer with transparency set in the layer properties will increase transparency with every screen refresh until it becomes invisible. To replicate, try the NED shaded relief layer from:

http://toposervices.cr.usgs.gov/wmsconnector/com.esri.wms.Esrimap/USGS_EDNA_geo?WMTVER=1.1.1&LAYERS=NED_2003_SHADEDRELIEF&SRS=EPSG:4326&FORMAT=PNG&BGCOLOR=0xFF0000&TRANSPARENT=true&SERVICE=WMS&STYLES=&REQUEST=capabilities

@qgib
Copy link
Contributor Author

qgib commented Feb 8, 2009

Author Name: John Tull (John Tull)


I realize now that the link can be shortened to:

http://toposervices.cr.usgs.gov/wmsconnector/com.esri.wms.Esrimap/USGS_EDNA_geo?

@qgib
Copy link
Contributor Author

qgib commented Feb 9, 2009

Author Name: ersts - (ersts -)


This is a known issue. If you keep repeatedly hitting apply, the transparency it is additive. Likewise, if you decrease the transparency, it is still additive. However, if you pan the map canvas a little and cause a new fetch request, your layer will be at the correct/expected transparency level.

It seems to be a bug in Qt with setting the alpha value for an image more than once. Each apply causes a refresh and thus a reapplication of the alpha value. Too speed things up, the WMS provider does not request a new version of the image if the extent has not changed, it uses a cached version.

I am going to downgrade this a little, while it needs to get fixed but it does not cause a crash or a damage of data


  • status_id was changed from Open to In Progress

@qgib
Copy link
Contributor Author

qgib commented Feb 9, 2009

Author Name: John Tull (John Tull)


Peter: Thanks for the detailed explanation. I did not see a bug filed, so added it this weekend. It sounds like I need to be filing bugs against Qt instead... Also, it's good to know that forcing a wms refresh works around the problem.

@qgib
Copy link
Contributor Author

qgib commented Feb 9, 2009

Author Name: ersts - (ersts -)


I think it is more just that setAlphaChannel() does not work quite a expected. When you use that method it changes the image format to QImage::Format_ARGB32_Premultiplied

The image is stored using a premultiplied 32-bit 

ARGB format (0xAARRGGBB), i.e. the red, green,

and blue channels are multiplied by the alpha component 

divided by 255. (If RR, GG, or BB has a

higher value than the alpha channel, the results 

are undefined.) Certain operations (such as 

image composition using alpha blending) are faster 

using premultiplied ARGB32 than with plain ARGB32.

So I changed it around a little have had the WMS Provider store a QImage::Format_ARGB32 then just adjusted the pixel values on each refresh. WMS images should be small enough to not see any performance hit.

The mods were made to the trunk r:10146. If you can take it for a spin and make sure it works more as expected. If it does I will close the ticket and add it to the Version-1_0 branch for inclusion in the next release.

@qgib
Copy link
Contributor Author

qgib commented Feb 10, 2009

Author Name: John Tull (John Tull)


It does appear to be working now. Great! I closed the ticket.


  • status_id was changed from In Progress to Closed
  • resolution was changed from to fixed

@qgib
Copy link
Contributor Author

qgib commented Aug 21, 2009

Author Name: Anónimo (Anónimo)


Milestone Version 1.0.1 deleted

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Map and Legend Related to map or legend rendering labels May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Map and Legend Related to map or legend rendering
Projects
None yet
Development

No branches or pull requests

1 participant