如题,我用getpixel在98和xp系统中对同一图片的同一点取色,
系统的分辨率和颜色数都相同,
结果不相同,为什么?如何解决?

解决方案 »

  1.   

    There are cases this could happen.How is the bitmap loaded into memory? What is your screen settings? What are the differencces?If you're using DDB, switch to DIB section.As a general comments, you should add more details into your posting.
      

  2.   

    哦,其实我是对一个游戏中全屏的窗口的图像用getpixel取色,
    除了操作系统不同,其他分辨率都是800×600,颜色都是16位色,可是在98系统和xp系统下却不一样,
    关键代码是:
    dc1:=getdc(getforegroundwindow());
    mycolor:=getpixel(dc1,200,200);
    可是mycolor的值却不一样,我转成16进制看,98下是ffc410,xp下是ffc308
    而对另外一个点取色98下是787078,xp下是 736d73 why!why!why!
      

  3.   

    不会的,一定有办法可以转换的,xp和98下用getpixel得到的颜色格式有不同,是吗?
      

  4.   

    Sounds reasonable. 16-bit per pixel could be either 5-5-5 or 5-6-5. GetPixel needs to convert 15-bit or 16-bit color int 24-bit color, and there are different ways of doing that.What are you doing with the returne value. Why do you need them to be exactly the same?One way to avoid the problem is figure out whether it's 5-5-5 or 5-6-5 and get DIB from the HDC, then convert to 24-bpp yourself.
      

  5.   

    好像还是不行,哪位大哥有通过DIB取色而不是简单的用getpixel取色的例子啊?先谢谢了~~分可以加~~~~
      

  6.   

    Describe your problem in more detail?Have you check whether your machine is running 5-5-5 or 5-6-5? Why do you need 9X and XP to match in pixel value?