日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

android点9图architecture

發布時間:2024/4/15 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android点9图architecture 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

編譯時aapt去掉黑圈, 并將信息寫入一個png chunk (npTc chunk + bitmap chunk)


加載Bitmap時會取出Chunk

Bitmp {private byte[] mBuffer;private final long mNativePtr;private byte[] mNinePatchChunk; }



創建NinePatchDrawable

public NinePatchDrawable(Resources res, Bitmap bitmap, byte[] chunk,Rect padding, Rect opticalInsets, String srcName){ }


點9加載庫(解析點9Chunk, 可解析原始xxx.9.png圖)
https://github.com/Anatolii/NinePatchChunk

/*** This chunk specifies how to split an image into segments for* scaling.** There are J horizontal and K vertical segments. These segments divide* the image into J*K regions as follows (where J=4 and K=3):** F0 S0 F1 S1* +-----+----+------+-------+* S2| 0 | 1 | 2 | 3 |* +-----+----+------+-------+* | | | | |* | | | | |* F2| 4 | 5 | 6 | 7 |* | | | | |* | | | | |* +-----+----+------+-------+* S3| 8 | 9 | 10 | 11 |* +-----+----+------+-------+** Each horizontal and vertical segment is considered to by either* stretchable (marked by the Sx labels) or fixed (marked by the Fy* labels), in the horizontal or vertical axis, respectively. In the* above example, the first is horizontal segment (F0) is fixed, the* next is stretchable and then they continue to alternate. Note that* the segment list for each axis can begin or end with a stretchable* or fixed segment.** The relative sizes of the stretchy segments indicates the relative* amount of stretchiness of the regions bordered by the segments. For* example, regions 3, 7 and 11 above will take up more horizontal space* than regions 1, 5 and 9 since the horizontal segment associated with* the first set of regions is larger than the other set of regions. The* ratios of the amount of horizontal (or vertical) space taken by any* two stretchable slices is exactly the ratio of their corresponding* segment lengths.** xDivs and yDivs are arrays of horizontal and vertical pixel* indices. The first pair of Divs (in either array) indicate the* starting and ending points of the first stretchable segment in that* axis. The next pair specifies the next stretchable segment, etc. So* in the above example xDiv[0] and xDiv[1] specify the horizontal* coordinates for the regions labeled 1, 5 and 9. xDiv[2] and* xDiv[3] specify the coordinates for regions 3, 7 and 11. Note that* the leftmost slices always start at x=0 and the rightmost slices* always end at the end of the image. So, for example, the regions 0,* 4 and 8 (which are fixed along the X axis) start at x value 0 and* go to xDiv[0] and slices 2, 6 and 10 start at xDiv[1] and end at* xDiv[2].** The colors array contains hints for each of the regions. They are* ordered according left-to-right and top-to-bottom as indicated above.* For each segment that is a solid color the array entry will contain* that color value; otherwise it will contain NO_COLOR. Segments that* are completely transparent will always have the value TRANSPARENT_COLOR.** The PNG chunk type is "npTc".*/

Android 9patch 圖片解析堆溢出漏洞分析

Android動態布局入門及NinePatchChunk解密

NinePatchChunk Library

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的android点9图architecture的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。