winforms - C# image drawing colours are incorrect -


I have a source bitmap which is 1x1 and I am trying to draw that image and draw a new bitmap I am The source bitmap is all red, but for some reason the new bitmap ends with a gradient (see image). Using the code below, should the new bitmap be completely red? Where is it being white / alpha?

  Private Zero Drives () {bitmap bmpSOURCE = new bitmap (1, 1, pixel format.format 32bparbb); Using (Graphics G = Graphics. Framesize (BMPs)) {g.Clear (Color.Red); } Bitmap BMPTist = new bitmap (300, 100, pixel format.format 32bparbbb); Use (graphics g = graphics. Framesize (bmptext)) {g.CompositingMode = CompositingMode.SourceCopy; G.CompositingQuality = Compositing Quality Ajumliner; G. Interpolation mode = Interpolation mode. Highquite bibbic; G.PageUnit = GraphicsUnit.Pixel; G.PixelOffsetMode = PixelOffsetMode.None; G. SmoothingMode = Smoothing. Non; Rectangle rectDest = new rectangle (0, 0, bmpTest.Width, bmpTest.Height); Rectangle rectSource = new rectangle (0, 0, 1, 1); G.DrawImage (bmpSOURCE, rectDest, rectSource, GraphicsUnit.Pixel); } PictureBox1.Image = bmpTest; }  

This is not a good way to fill a color filling area. A better way is to determine the pixel color in the source image and use that color to fill the goal.

  get bitmap source = // source color color = source.gate pixel (1 1); Get Bitmap Target = // Goal Goal. Clear (color);  

However, this problem is Interpolation Mode , because this is what happens when scaling the images less istead's HighQualityBicubic .

g.InterpolationMode = InterpolationMode.Low; Try to use;

Comments

Popular posts from this blog

MVP, design question -

excel - Populate list via a bi-Condition -

iphone - How do I make a UIPickerView in a UIActionSheet -