Hi,
I finally found a solution by overriding the WmsOverlay and the UriTile classes, and by setting image opacity client side.
Here is the code if someone is interested in :
public class CustomWmsUriTile : UriTile
{
private const float OPACITY = 1.0f;
protected override Bitmap GetBitmapCore(UriTileArguments args)
{
HttpWebResponse response = null;
Bitmap bitmap = null;
try
{
var webRequest = (HttpWebRequest)WebRequest.Create(args.Uri.ToString());
request.Proxy = args.WebProxy;
response = (HttpWebResponse)request.GetResponse();
bitmap = new Bitmap(response.GetResponseStream());
return SetImgOpacity(bitmap, OPACITY);
}
finally
{
if (response != null) { response.Close(); }
}
}
public static Bitmap SetImgOpacity(Bitmap bitmap, double opacity)
{
// If opacity is 1, we have nothing to do
if (opacity == 1)
return bitmap;
var newBitmap = new Bitmap(bitmap.Width, bitmap.Height);
using (Graphics graphics = Graphics.FromImage(newBitmap))
{
graphics.FillRectangle(Brushes.White, 0, 0, bitmap.Width, bitmap.Height);
var matrix = new ColorMatrix();
matrix.Matrix33 = (float) opacity;
var attributes = new ImageAttributes();
attributes.SetColorMatrix(matrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
graphics.DrawImage(bitmap, new Rectangle(0, 0, newBitmap.Width, newBitmap.Height), 0, 0, bitmap.Width, bitmap.Height, GraphicsUnit.Pixel, attributes);
}
return newBitmap;
}
}