1
Reply

GDI+ - how can I deactivate antialiasing?

Michael Rettkowitz

Michael Rettkowitz

Nov 29 2010 2:18 AM
13k

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)