cpBitmap檔案產生

來源:互聯網
上載者:User

原文:http://hi.baidu.com/yaxch/item/419b1877ae59bc377044233b

蘋果在4.2.1以後都用cpBitmap來當做螢幕和鎖屏的背景圖檔案。

找了一圈 網上基本都沒有文章說如何從jpg或者png產生cpBitmap,只有一個文章說的是從cpBitmap產生jpg

http://cpbitmap.cleverbyte.com.au/ 這個哥們在codeproject有個C#的項目也就是讀取cpBitmap 產生jpg http://www.codeproject.com/Articles/265333/Reading-Apple-iDevice-CPBitmap-files

後來用vi分析了一下cpBitmap 發現cpBitmap的格式很簡單

就是把每個點rgb值和alpha值取出來簡單一下排列,沒有任何壓縮,最後加了一個包尾

rrggbbaa rrggbbaa rrggbbaa rrggbbaa ..... 

包尾似乎有兩個版本 

舊版的比較簡單就24個位元組

新版本有70個位元組

直接用舊版本的格式就行了

第0個int無用 第一個int是width 第二個int是height,其餘的直接拷貝就行了

staticunsignedchartailData[] = {

        0x00, 0x00, 0x00, 0x00, 

        0x80, 0x02, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00,  //0x280 0x3c0 640x960

        0x00, 0x00, 0x00, 0x00, 0x01, 0x00,

        0x00, 0x00, 0x91, 0x32, 0xa4, 0xcb,   

    };

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.