99热成人精品热久久6网站_无码中文亚洲AV吉吉影音_国产精品制服一区二区_中文字幕乱码一区二区三区免费

首頁 > 技術(shù)支持 > 應(yīng)用與案例 > 正文
RA8889/71M/73M/76M/77延展單色位圖為可變前景和背景色圖形 作者:david   發(fā)表日期:2020-12-28   來源:菱致電子   瀏覽:


本文章主要講解如何使用RA8889、RA8877、RA8876系列的芯片處理單色圖并可擴(kuò)展出不同顏色,顏色改變包括前景色和背景色,還可以使背景色為透明色。處理方法可以分為兩種:1、將圖片轉(zhuǎn)為數(shù)組是用單片機(jī)描點(diǎn)寫入;2、圖片存入flash并用DMA調(diào)用。

注意事項(xiàng):需要在芯片設(shè)置為16bpp模式下使用


方法一:單片機(jī)直接寫入

第一步:首先使用瑞佑的轉(zhuǎn)檔軟件將圖片轉(zhuǎn)為.h頭文件并添加到工程


內(nèi)容應(yīng)為數(shù)組:


第二步:API函數(shù)調(diào)用
1、設(shè)置前景色與背景色函數(shù)實(shí)例:

BTE_MCU_Write_ColorExpansion_MCU_8bit(0,1024, 0,50,720,100,color16M_red,color16M_green,tu);

函數(shù)解釋:

        void BTE_MCU_Write_ColorExpansion_MCU_8bit

        (
        unsigned long Des_Addr //start address of Destination
        ,unsigned short Des_W //image width of Destination (recommend = canvas image width)
        ,unsigned short XDes //coordinate X of Destination
        ,unsigned short YDes //coordinate Y of Destination
        ,unsigned short X_W //Width of BTE Window
        ,unsigned short Y_H //Length of BTE Window
        ,unsigned long Foreground_color 
        /*Foreground_color : The source (1bit map picture) map data 1 translate to Foreground color by color expansion*/
        ,unsigned long Background_color 
        /*Background_color : The source (1bit map picture) map data 0 translate to Foreground color by color expansion*/
        ,const unsigned char *data // 8-bit data
        )

2、改變前景色并設(shè)置背景色為透明色實(shí)例:

BTE_MCU_Write_ColorExpansion_Chroma_key_MCU_8bit(0,1024, 0,0,200,100,0xff00,tu);


函數(shù)解釋:

       void BTE_MCU_Write_ColorExpansion_Chroma_key_MCU_8bit

       (
       unsigned long Des_Addr //start address of Destination
       ,unsigned short Des_W //image width of Destination (recommend = canvas image width) 
       ,unsigned short XDes //coordinate X of Destination
       ,unsigned short YDes //coordinate Y of Destination
       ,unsigned short X_W //Width of BTE Window
       ,unsigned short Y_H //Length of BTE Window
       ,unsigned long Foreground_color 
       /*Foreground_color : The source (1bit map picture) map data 1 translate to Foreground color by color expansion*/
       ,const unsigned char *data //8-bit data
       )


方法二:將圖片燒入FLASH

第一步:通過瑞佑的轉(zhuǎn)檔軟件將圖片轉(zhuǎn)為bin檔并燒入FLASH
 

第二步:API函數(shù)調(diào)用
1、改變背景色和前景色

   /*設(shè)定第二個(gè)圖層作為DMA圖層,只能設(shè)置為8bpp或者16bpp模式*/
    Canvas_Image_Start_address(1024*600*3); //第二個(gè)圖層

    Memory_8bpp_Mode();
    DMA_24bit(1,0,0,0,50,240,50,0);    
 
    /*設(shè)置S0圖層*/
    BTE_S0_Color_8bpp(); //[92h] Source_0 Color Depth
    BTE_S0_Memory_Start_Address(1024*600*3);
    BTE_S0_Image_Width(1024);
    BTE_S0_Window_Start_XY(0,0);
 
    /*設(shè)置顯示圖層,可設(shè)為16bpp或24bpp*/
    BTE_Destination_Color_24bpp(); //[92h] Destination Color Depth
    BTE_Destination_Memory_Start_Address(0);
    BTE_Destination_Image_Width(1024);
    BTE_Destination_Window_Start_XY(0,0);
    Canvas_Image_Start_address(0);
    Memory_24bpp_Mode();
    Foreground_color_16M(0xff0000);
    Background_color_16M(0x00ff00);
    BTE_Window_Size(400,240);
    BTE_Operation_Code(0xE);
    BTE_ROP_Code(7);
    /*開啟BTE功能*/
    BTE_Enable();
    Check_BTE_Busy();

2、改變前景色透明背景色

   /*設(shè)定第二個(gè)圖層作為DMA圖層,只能設(shè)置為8bpp或者16bpp模式*/
    Canvas_Image_Start_address(1024*600*3);  //第二個(gè)圖層

    Memory_8bpp_Mode();
    DMA_24bit(1,0,0,0,50,240,50,0);    
 
    /*設(shè)置S0圖層*/
    BTE_S0_Color_8bpp(); //[92h] Source_0 Color Depth
    BTE_S0_Memory_Start_Address(1024*600*3);
    BTE_S0_Image_Width(1024);
    BTE_S0_Window_Start_XY(0,0);
 
    /*設(shè)置顯示圖層,可設(shè)為16bpp或24bpp*/
    BTE_Destination_Color_24bpp(); //[92h] Destination Color Depth
    BTE_Destination_Memory_Start_Address(0);
    BTE_Destination_Image_Width(1024);
    BTE_Destination_Window_Start_XY(0,0);
    Canvas_Image_Start_address(0);
    Memory_24bpp_Mode();
    Foreground_color_16M(0xff0000);
    
    BTE_Window_Size(400,240);
    BTE_Operation_Code(0xF);   //Chroma_key 透明背景色
    BTE_ROP_Code(7);
    /*開啟BTE功能*/
    BTE_Enable();
    Check_BTE_Busy();


效果展示


應(yīng)用
用戶可以借此功能,將常用的數(shù)字、符號、字母等預(yù)先設(shè)計(jì)好多套尺寸并保存到FLASH中備用,就相當(dāng)于矢量字庫了!后續(xù)調(diào)用起來就相當(dāng)方便。

分享到:

相關(guān)熱詞搜索:RA8889 RA8876 RA8873M 位圖 矢量

上一篇:用瑞佑的控制芯片實(shí)現(xiàn)淡入淡出,半透效果
下一篇:51單片機(jī)+RA8875控制液晶顯示