zoukankan      html  css  js  c++  java
  • [EMWIN]关于 GUI_GetPixelIndex 使用的问题

     在模拟器上和st单片机上使用以下代码:

     GUI_COLOR color0,color1;

    color0 = GUI_GetPixelIndex(rect.x1+1, rect.y0);
    color1 = GUI_GetPixelIndex(rect.x1+1, rect.y1);

     

     左边模拟器,右边st单片机(keil)

    发现读取出来的色值不一样,于是折腾下找到解决办法:

    单片机上使用

    color0 = GUI_Index2Color(GUI_GetPixelIndex(rect.x1+1, rect.y0));
    color1 = GUI_Index2Color(GUI_GetPixelIndex(rect.x1+1, rect.y1));

    代码如果要兼容单片机和模拟器 可以这么写:

    #ifdef WIN32
        color0 = GUI_GetPixelIndex(rect.x1+1, rect.y0);
        color1 = GUI_GetPixelIndex(rect.x1+1, rect.y1);
    #else
        color0 = GUI_Index2Color(GUI_GetPixelIndex(rect.x1+1, rect.y0));
        color1 = GUI_Index2Color(GUI_GetPixelIndex(rect.x1+1, rect.y1));
    #endif

    就能获取正确的像素颜色,具体原因没有细查,请知道的小伙伴回复下,让后边的小伙伴知道怎么回事,谢谢。

     特此记录。

    相关问题有 :

    1.    http://bbs.armfly.com/read.php?tid=6584

    2.   http://bbs.21ic.com/forum.php?mod=viewthread&tid=1570306

    如果问题解决起来不妥或者有更好的解决办法,麻烦请告知,帮助曾经和你一样的入门者,谢谢。
  • 相关阅读:
    文件下载并删除
    程序输出
    什么是并发
    跨站脚本攻击为什么要过滤危险字符串
    正则表达式——极速入门
    输出的为X= 1 ,Y = 0;
    Eclipse+MyEclipse安装及环境配置
    J2EE有三个开发环境级。
    TCP和UDP的区别
    asp.net2.0导出pdf文件完美解决方案(转载)
  • 原文地址:https://www.cnblogs.com/ourran/p/6627417.html
Copyright © 2011-2022 走看看