Reputation: 446
i tried to draw a headerCell.
original picture looks like this (increased):
I tried to stretch the images width:
Bitmap bmp = new Bitmap(3000, 1000);
Graphics graph = Graphics.FromImage(bmp);
Image headerMain = Image.FromFile(imagePfad + "header_main.jpg");
graph.DrawImage(headerMain, X, Y, 300, headerMain.Height);
Graphics g = CreateGraphics();
g.DrawImage(bmp, 0, 0);
But then it turns into transparent like this:
what am i doing wrong?
Upvotes: 0
Views: 166
Reputation: 941455
At such extreme magnifications, the work done by the interpolation filter becomes highly visible. You'll want to de-tune it to nearest-neighbor, pixel offset mode matters too:
graph.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
graph.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
Upvotes: 1