Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create a 'hole' in an image in vb.net
    primarykey
    data
    text
    <p>I am trying to create a hole in my image using code, like this <a href="http://i1293.photobucket.com/albums/b595/electrogeekguy/fogofwardemo_zps6a6108c8.png" rel="nofollow">http://i1293.photobucket.com/albums/b595/electrogeekguy/fogofwardemo_zps6a6108c8.png</a></p> <p>so that when i draw my image you can see what is underneath through the hole.</p> <p>Below is my code that creates a gradient transparent at the middle out to solid black at the edges, but it blends my gradient with the underlying black.</p> <p>vb.net or c# code to help me would be fine.</p> <p>My plan is to remove a circle such as in my picture above and then apply the gradient.</p> <pre><code>Private Function FogOfWarUpdate() As Image Dim FogOfWarBitmap As Bitmap = New Bitmap(FogOfWarOldImage) Dim FogOfWarGraphics As Graphics = Graphics.FromImage(FogOfWarBitmap) Dim FogOfWarGraphicsPath As New System.Drawing.Drawing2D.GraphicsPath FogOfWarGraphicsPath.AddEllipse(2048, 1024, 500, 500) Dim FogOfWarPathGradientBrush As New System.Drawing.Drawing2D.PathGradientBrush(FogOfWarGraphicsPath) FogOfWarPathGradientBrush.CenterPoint = New PointF(2048 + 250, 1024 + 250) FogOfWarPathGradientBrush.CenterColor = Color.FromArgb(0, Color.Black) FogOfWarPathGradientBrush.SurroundColors = New Color() {Color.FromArgb(128, Color.Black)} FogOfWarGraphics.FillPath(FogOfWarPathGradientBrush, FogOfWarGraphicsPath) 'FogOfWarGraphics.DrawEllipse(Pens.BlueViolet, 100, 100, 200, 200) FogOfWarPathGradientBrush.Dispose() FogOfWarGraphicsPath.Dispose() FogOfWarGraphics.Dispose() Return FogOfWarBitmap End Function </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload