Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I got a strange results using my software in Windows 7.

To draw my image I use following code:
C#
protected override void OnPaint(PaintEventArgs e)
{
    ColorMap[] m = new ColorMap[2];
    ImageAttributes ia = new ImageAttributes();
    m[0] = new ColorMap();
    m[1] = new ColorMap();
    m[0].OldColor = Color.FromArgb(255, 0, 0, 0);
    m[1].OldColor = Color.FromArgb(255, 255, 255, 255);
    m[0].NewColor = Color.FromArgb(0, 0, 0, 0);
    m[1].NewColor = Color.FromArgb(mBlend, 250, 125, 114);
    ia.SetRemapTable(m);
                
    Graphics gdiGfx = e.Graphics;                
    //gdiGfx.CompositingMode = CompositingMode.SourceOver;
    //gdiGfx.InterpolationMode=InterpolationMode.HighQualityBicubic;
// 1-st.
    //gdiGfx.CompositingQuality = CompositingQuality.HighQuality;
// 2-nd.
    gdiGfx.CompositingQuality = CompositingQuality.HighSpeed;
               
    gdiGfx.DrawImage(mImg1, new Rectangle(0, 0, this.Width, 
          this.Height), 0, 0, this.Width, this.Height, 
          GraphicsUnit.Pixel, ia);
}

where my Image mImg1 is
mImg1 = new Bitmap(Width, Height, PixelFormat.Format1bppIndexed);
filled with 1.

I am playing with mBlend from 0 to 255.
If I use 1-st setting my Image is still gray when mBlend = 128 in W7, when in Vista/XP image is pink (Salmon color).
If I change CompositingQuality = CompositingQuality.HighSpeed; (2-nd setting) I can even get different colors (blue, green) in Windows 7.

When I change my Image from
mImg1 = new Bitmap(Width, Height, PixelFormat.Format1bppIndexed);
to
mImg1 = new Bitmap(Width, Height, PixelFormat.Format32bppArgb);
everything works fine.
Posted
Updated 22-Jan-11 2:13am
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900