6410 Eboot 顯示圖片

來源:互聯網
上載者:User

在Eboot裡面顯示圖片,如果要顯示一些非全屏大小的圖片,感覺不是很爽,所以封裝了幾個函數,用於顯示圖片,或者畫圖用。

螢幕大小是320*240的,這樣的螢幕,畫的時候在螢幕的左上方開始往右邊畫,畫完一行,接著畫下一行。要顯示的圖片,需要先轉成對應的數組。這裡使用的是bmp2c.exe軟體。由於,螢幕打豎來放,即變成240*320。這樣子的話,做出來的圖片需要逆時針旋轉90度之後,才能夠轉換成對應的數組。

下面的函數支援全屏或非全屏的圖片或顏色顯示

其中的幾個關鍵函數如下:

// 顯示圖片BOOL ShowPicture(int startX, int startY, int width, int high, const unsigned short *picture){unsigned int *pFB;int i,j;if(startX>320 || startY>240)return FALSE;if(picture == NULL)return FALSE;pFB = (unsigned int *)EBOOT_FRAMEBUFFER_UA_START;for(j=0; j<high; j++){for(i=0; i<width; i++){UpDataBitmaptmp4=(int)picture[i+j*width];UpDataBitmaptmp=(((UpDataBitmaptmp4>>11)<<19)|(((UpDataBitmaptmp4>>5)&0x3F)<<10)|((UpDataBitmaptmp4&0x1F)<<3)|0x0);*(pFB+(startY*320+startX)+j*320+i) = UpDataBitmaptmp;}}}// 顯示顏色BOOL ShowColor(int startX, int startY, int width, int high, const unsigned short color){unsigned int *pFB;int i,j;if(startX>320 || startY>240)return FALSE;pFB = (unsigned int *)EBOOT_FRAMEBUFFER_UA_START;for(j=0; j<high; j++){for(i=0; i<width; i++){UpDataBitmaptmp4=(int)color;UpDataBitmaptmp=(((UpDataBitmaptmp4>>11)<<19)|(((UpDataBitmaptmp4>>5)&0x3F)<<10)|((UpDataBitmaptmp4&0x1F)<<3)|0x0);*(pFB+(startY*320+startX)+j*320+i) = UpDataBitmaptmp;}}}// 清屏void ClearScreen(){unsigned int *pFB;volatile unsigned long i=0;pFB = (unsigned int *)EBOOT_FRAMEBUFFER_UA_START;for(i=0; i<76800; i++){*(pFB+i)=0x00000000;}}

上述函數中的參數說明:

startX  : 圖片開始的X座標(以螢幕為320*240為準)

startY  :  圖片開始的Y座標

width   : 圖片的寬度(旋轉後的圖片寬度)

high     : 圖片的高度(旋轉後的圖片高度)

picture : 圖片對應的數組指標

color    : 顏色值。0xFFFF表示白色,0x0000表示黑色

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.