1
Answer

GDI+ - how can I deactivate antialiasing?


Hi,
if using the code below to fill an area on a bitmap...
 

Dim ImgBg As Bitmap = System.Drawing.Bitmap.FromFile(Filename1)
ImgBg.SetResolution(72, 72)
Dim g As Graphics = Graphics.FromImage(ImgBg)
g.SmoothingMode = Drawing2D.SmoothingMode.None
Dim mybrush As Brush = Brushes.Beige
g.FillRectangle(mybrush, rect)
g.Dispose()
ImgBg.Save(
Filename2)

also the pixels around the 'rect' area are manipulated, but they should remain, as they are.
The same effect I'm having, when inserting images using g.DrawImage(...), g.DrawImageUnscaled(...), g.DrawImageUnscaledAndClipped(...)
Does anyone know, how to prevent this?
Michael
Answers (1)