OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 3438|回复: 4

关于开窗的问题

[复制链接]

8

主题

71

帖子

0

精华

初级会员

Rank: 2

积分
183
金钱
183
注册时间
2017-4-5
在线时间
36 小时
发表于 2017-6-29 10:53:55 | 显示全部楼层 |阅读模式
5金钱
下面是一个写图片的函数,但是我取模得到的类型char型,函数要求是int型,强制转换数据应该不对。那么有什么办法修改这个函数,直接利用取模得到的就可以显示呢?我的屏幕利用的是RGB模式,是不是不能直接开窗啊?



typedef unsigned          char uint8_t;
typedef unsigned short     int uint16_t;
typedef unsigned           int uint32_t;
typedef unsigned       __int64 uint64_t;


void LCD_WriteBMP(uint32_t BmpAddress)
{
    uint32_t index = 0, size = 0, width = 0, height = 0, bit_pixel = 0;
    uint32_t Address;
    uint32_t currentline = 0, linenumber = 0;

    Address = CurrentFrameBuffer;

    /* Read bitmap size */
    size = *(__IO uint16_t *) (BmpAddress + 2);
    size |= (*(__IO uint16_t *) (BmpAddress + 4)) << 16;//òì&#187;ò£¨òì1í&#172;0£&#169;

    /* Get bitmap data address offset */
    index = *(__IO uint16_t *) (BmpAddress + 10);
    index |= (*(__IO uint16_t *) (BmpAddress + 12)) << 16;
       

    /* Read bitmap width */
    width = *(uint16_t *) (BmpAddress + 18);
    width |= (*(uint16_t *) (BmpAddress + 20)) << 16;

    /* Read bitmap height */
    height = *(uint16_t *) (BmpAddress + 22);
    height |= (*(uint16_t *) (BmpAddress + 24)) << 16;

    /* Read bit/pixel */
    bit_pixel = *(uint16_t *) (BmpAddress + 28);

    if (CurrentLayer == LCD_BACKGROUND_LAYER)
    {
        /* reconfigure layer size in accordance with the picture */
        TLDI_LayerSize(TLDI_Layer1, width, height);
        TLDI_ReloadConfig(TLDI_RELOADLAYERTYPE_FBR);

        /* Reconfigure the Layer pixel format in accordance with the picture */   
        if ((bit_pixel/8) == 4)
        {
            TLDI_LayerPixelFormat(TLDI_Layer1, PF_ARGB8888);
            TLDI_ReloadConfig(TLDI_RELOADLAYERTYPE_FBR);
        }
        else if ((bit_pixel/8) == 2)
        {
            TLDI_LayerPixelFormat(TLDI_Layer1, PF_RGB565);
            TLDI_ReloadConfig(TLDI_RELOADLAYERTYPE_FBR);
        }
        else
        {
            TLDI_LayerPixelFormat(TLDI_Layer1, PF_RGB888);
            TLDI_ReloadConfig(TLDI_RELOADLAYERTYPE_FBR);
        }
    }
    else
    {
        /* reconfigure layer size in accordance with the picture */
        TLDI_LayerSize(TLDI_Layer2, width, height);
        TLDI_ReloadConfig(TLDI_RELOADLAYERTYPE_FBR);

        /* Reconfigure the Layer pixel format in accordance with the picture */
        if ((bit_pixel/8) == 4)
        {
            TLDI_LayerPixelFormat(TLDI_Layer2, PF_ARGB8888);
            TLDI_ReloadConfig(TLDI_RELOADLAYERTYPE_FBR);
        }
        else if ((bit_pixel/8) == 2)
        {
            TLDI_LayerPixelFormat(TLDI_Layer2, PF_RGB565);
            TLDI_ReloadConfig(TLDI_RELOADLAYERTYPE_FBR);
        }
        else
        {
            TLDI_LayerPixelFormat(TLDI_Layer2, PF_RGB888);
            TLDI_ReloadConfig(TLDI_RELOADLAYERTYPE_FBR);
        }
    }

    /* compute the real size of the picture (without the header)) */  
    size = (size - index);

    /* bypass the bitmap header */
    BmpAddress += index;

    /* start copie image from the bottom */
    Address += width*(height-1)*(bit_pixel/8);

    for(index = 0; index < size; index++)
    {
        *(__IO uint8_t*) (Address) = *(__IO uint8_t *)BmpAddress;

        /*jump on next byte */   
        BmpAddress++;
        Address++;
        currentline++;

        if((currentline/(bit_pixel/8)) == width)
        {
            if(linenumber < height)
            {
                linenumber++;
                Address -=(2*width*(bit_pixel/8));
                currentline = 0;
            }
        }
    }
}

最佳答案

查看完整内容[请看2#楼]

可以开窗的,不过只能按RGB特定的扫描方式开
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165540
金钱
165540
注册时间
2010-12-1
在线时间
2117 小时
发表于 2017-6-29 10:53:56 | 显示全部楼层
houyongtao 发表于 2017-7-6 10:01
原子哥,利用RGB模式是不是不支持开窗啊?对于开窗有什么要求吗?

可以开窗的,不过只能按RGB特定的扫描方式开
我是开源电子网www.openedv.com站长,有关站务问题请与我联系。
正点原子STM32开发板购买店铺http://openedv.taobao.com
正点原子官方微信公众平台,点击这里关注“正点原子”
回复

使用道具 举报

8

主题

71

帖子

0

精华

初级会员

Rank: 2

积分
183
金钱
183
注册时间
2017-4-5
在线时间
36 小时
 楼主| 发表于 2017-7-3 11:53:54 | 显示全部楼层
有木有人啊
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165540
金钱
165540
注册时间
2010-12-1
在线时间
2117 小时
发表于 2017-7-4 01:18:37 | 显示全部楼层
自己拼成16位。。。
我是开源电子网www.openedv.com站长,有关站务问题请与我联系。
正点原子STM32开发板购买店铺http://openedv.taobao.com
正点原子官方微信公众平台,点击这里关注“正点原子”
回复

使用道具 举报

8

主题

71

帖子

0

精华

初级会员

Rank: 2

积分
183
金钱
183
注册时间
2017-4-5
在线时间
36 小时
 楼主| 发表于 2017-7-6 10:01:10 | 显示全部楼层
正点原子 发表于 2017-7-4 01:18
自己拼成16位。。。

原子哥,利用RGB模式是不是不支持开窗啊?对于开窗有什么要求吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-8-17 01:43

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表