Why would I go to all that trouble when I could just create a solid
brush of the background color, set the SmoothingMode to AntiAlias and
get the desired effect? The problem is I don't have a solid
background color. My background is alpha 0 (transparent). In design
mode (when the user is drawing the graphics) I draw whatever the user
wants to put in the background as a backdrop to see the transparency
in action (a diamond or diagonal crosshatch pattern of gray shades).
But I clearly don't want to be putting this in the image being edited
itself. The graphics they are creating need to be able to blend with
any background. Since my primary goal is to erase to alpha 0, I think
SrcCopy is as close as I can get (although I should be able to do
getpixel and setpixel to set the alpha components manually and get
exactly what I need). Anti-aliasing is a secondary goal, and I
definitely wouldn't want to give up being able to truly erase (to
alpha = 0) in order to get it.
[quoted text, click to view] "Frank Hileman" <frankhil@no.spamming.prodigesoftware.com> wrote in message news:<en#Ejs6LEHA.1312@TK2MSFTNGP12.phx.gbl>...
> What about this: Create a small bitmap, clear its pixels to transparent,
> create a Graphics from that Bitmap, and draw into it a path gradient fill
> the shape of a circle, with the center opaque, the background color, and the
> edges transparent. The size of the circle is the size of your eraser. Since
> you are using a path gradient it will be opaque at the center and fade to
> transparent at the edges. There are many other path gradient parameters you
> can use.
>
> Now when you draw this bitmap onto another bitmap, or the screen, it will
> "erase" strongest in the center, and less around the edge. It does not erase
> by changing alpha, but by covering with the background color.
>
> I think this is as close as you can get -- I don't think there is a way to
> modify only the alpha component, short of writing your own pixel
> manipulation routines, but it would be nice if someone could prove me wrong!
>
> Regards,