Hi,
I'm trying to draw layers onto a GeoImage using the GdiPlusGeoCanvas wrapper.
The layer drawing works fine, but the background of the image, i.e. the areas that isn't covered by layer drawing, is rendered black. I want it to be white.
So I used the GdiPlusGeoCanvas.FillBackground(), and that works if no layers are being drawn.
But if a single layer later is drawn on top of the GeoImage, the background turns black.
Can this be prevented in any way ?
'--- prereq.s:
Dim imageWidth As Integer 'set previously
Dim imageHeight As Integer 'set previously
Dim bbox(3) as Double 'set previously
Dim lyr as Layer 'set previously
'--- relevant code:
Dim mapExtent As New RectangleShape(bbox(0), bbox(3), bbox(2), bbox(1))
Dim myGeoImage As GeoImage = GdiPlusGeoCanvas.CreateGeoImage(imageWidth, imageHeight)
Dim myGdiPlusGeoCanvas As GdiPlusGeoCanvas = New GdiPlusGeoCanvas()
Try
myGdiPlusGeoCanvas.BeginDrawing(myGeoImage, mapExtent, GeographyUnit.Meter)
GdiPlusGeoCanvas.FillBackground(myGeoImage, New GeoSolidBrush(New GeoColor(255, 255, 255))) 'white background
lyr.Open()
SyncLock lyr
lyr.Draw(myGdiPlusGeoCanvas, New Collection(Of SimpleCandidate)())
End SyncLock
lyr.Close()
Catch ex As Exception
If myGdiPlusGeoCanvas.IsDrawing Then
myGdiPlusGeoCanvas.EndDrawing()
End If
Finally
If myGdiPlusGeoCanvas.IsDrawing Then
myGdiPlusGeoCanvas.EndDrawing()
End If
End Try
Cheers.