L
Larry Serflaten
I am taking a 256 color bitmap from a file
and scaling it up X 16 to a 32bppPARGB bitmap
in memory. I copy that image to the screen.
After scaling, the edges of all the lines and
colors are blurred. I want the edges all
crisp, including inherent pixelation (jaggies).
Setting smoothing to none, or adjusting the
composting mode on the Graphics object still
yields blurred edges. What do I need to do
to the scale up the image, pixel for pixel?
The bitmaps are created like:
Maps = DirectCast(Bitmap.FromFile("..\images\maps.bmp"), Bitmap)
LargeMap = New Bitmap(MapSize.Width * 16 + 4, MapSize.Height * 16 + 4, Imaging.PixelFormat.Format32bppPArgb)
Then later;
Dim grx As Graphics = Graphics.FromImage(LargeMap)
grx.Clear(Color.DarkGreen)
grx.SmoothingMode = Drawing2D.SmoothingMode.None
grx.CompositingMode = Drawing2D.CompositingMode.SourceCopy
grx.DrawImage(Maps, New Rectangle(0, 0, MapSize.Width * 16, MapSize.Height * 16), _
New Rectangle(0, Index * MapSize.Height, MapSize.Width, MapSize.Height), _
GraphicsUnit.Pixel)
The image should be scaled there, and is later copied to the screen:
Dim grx As Graphics = Me.CreateGraphics
grx.SmoothingMode = Drawing2D.SmoothingMode.None
grx.DrawImage(LargeMap, New Rectangle(10, 40, 400, 400), New Rectangle(80, 80, 400, 400), GraphicsUnit.Pixel)
What I see on the screen is blurred, but I suspect I need to address the
problem during the scaling process.
Any/all help will be appreciated....
LFS
and scaling it up X 16 to a 32bppPARGB bitmap
in memory. I copy that image to the screen.
After scaling, the edges of all the lines and
colors are blurred. I want the edges all
crisp, including inherent pixelation (jaggies).
Setting smoothing to none, or adjusting the
composting mode on the Graphics object still
yields blurred edges. What do I need to do
to the scale up the image, pixel for pixel?
The bitmaps are created like:
Maps = DirectCast(Bitmap.FromFile("..\images\maps.bmp"), Bitmap)
LargeMap = New Bitmap(MapSize.Width * 16 + 4, MapSize.Height * 16 + 4, Imaging.PixelFormat.Format32bppPArgb)
Then later;
Dim grx As Graphics = Graphics.FromImage(LargeMap)
grx.Clear(Color.DarkGreen)
grx.SmoothingMode = Drawing2D.SmoothingMode.None
grx.CompositingMode = Drawing2D.CompositingMode.SourceCopy
grx.DrawImage(Maps, New Rectangle(0, 0, MapSize.Width * 16, MapSize.Height * 16), _
New Rectangle(0, Index * MapSize.Height, MapSize.Width, MapSize.Height), _
GraphicsUnit.Pixel)
The image should be scaled there, and is later copied to the screen:
Dim grx As Graphics = Me.CreateGraphics
grx.SmoothingMode = Drawing2D.SmoothingMode.None
grx.DrawImage(LargeMap, New Rectangle(10, 40, 400, 400), New Rectangle(80, 80, 400, 400), GraphicsUnit.Pixel)
What I see on the screen is blurred, but I suspect I need to address the
problem during the scaling process.
Any/all help will be appreciated....
LFS