查看: 2943|回复: 2

asf里面的gfx_mono_generic_put_bitmap

[复制链接]
  • TA的每日心情
    郁闷
    昨天 13:57
  • 签到天数: 1659 天

    连续签到: 1 天

    [LV.Master]伴坛终老

    发表于 2013-4-28 15:27:36 | 显示全部楼层 |阅读模式
    分享到:
    仔细看了下asf里面的gfx_mono_generic_put_bitmap:
    1. /**
    2. * \brief Put bitmap from FLASH or RAM to display
    3. *
    4. * This function will output bitmap data from FLASH or RAM.
    5. * The bitmap y-coordinate will be aligned with display pages, rounded down.
    6. * Ie: placing a bitmap at x=10, y=5 will put the bitmap at x = 10,y = 0 and
    7. * placing a bitmap at x = 10, y = 10 will put the bitmap at x = 10, y = 8
    8. *
    9. */
    10. void gfx_mono_generic_put_bitmap(struct gfx_mono_bitmap *bitmap, gfx_coord_t x,
    11.                 gfx_coord_t y)
    12. {
    13.         gfx_coord_t num_pages = bitmap->height / 8;
    14.         gfx_coord_t page = y / 8;
    15.         gfx_coord_t column;
    16.         gfx_coord_t i;
    17.         gfx_mono_color_t temp;

    18.         switch (bitmap->type) {
    19.         case GFX_MONO_BITMAP_PROGMEM:
    20.                 for (i = 0; i < num_pages; i++) {
    21.                         for (column = 0; column < bitmap->width; column++) {
    22.                                 temp = PROGMEM_READ_BYTE(bitmap->data.progmem
    23.                                                 + (i * bitmap->width)
    24.                                                 + column);
    25.                                 gfx_mono_put_byte(i + page, column + x, temp);
    26.                         }
    27.                 }
    28.                 break;

    29.         case GFX_MONO_BITMAP_RAM:
    30.                 for (i = 0; i < num_pages; i++) {
    31.                         gfx_mono_put_page(bitmap->data.pixmap
    32.                                         + (i * bitmap->width), page + i, x,
    33.                                         bitmap->width);
    34.                 }
    35.                 break;

    36.         default:
    37.                 break;
    38.         }
    39. }
    复制代码
    得出3个结论:
    1】y实际上会当作 (y>>3)<<3来用
    2】是按整页(page)画的图
    3】struct gfx_mono_bitmap 中.height 应该是8的倍数
    顺便说一下,和其他的页更新lcd控制器类似,图存储时是旋转了90度的。比如那个8x5的月亮,bitmap数组里是这样的:
    2013-04-28_144213_00003.png


    回复

    使用道具 举报

  • TA的每日心情
    开心
    2015-12-1 09:28
  • 签到天数: 90 天

    连续签到: 1 天

    [LV.6]常住居民II

    发表于 2013-4-28 22:06:27 | 显示全部楼层
    之所以显示会旋转90度,是和液晶控制器ST7565的控制有关,不是所有的液晶都是这样的,有的12864液晶显示是横着显示,而nokia5110显示和这个显示方式一样一样的.看了st7565的资料就知道了
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    郁闷
    昨天 13:57
  • 签到天数: 1659 天

    连续签到: 1 天

    [LV.Master]伴坛终老

     楼主| 发表于 2013-5-2 10:13:16 | 显示全部楼层
    ??? 发表于 2013-4-28 22:06
    之所以显示会旋转90度,是和液晶控制器ST7565的控制有关,不是所有的液晶都是这样的,有的12864液晶显示是横 ...

    多谢指教。
    请问横的控制器是什么型号?
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条



    手机版|小黑屋|与非网

    GMT+8, 2024-6-3 09:05 , Processed in 0.115277 second(s), 19 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.