make. 9.png pictures
Compiling and making good pictures
Ninepathdrawable parsing:
public static drawable decodestream (Resources resources, inputstream is, options options) throws IOException{ Bitmap bitmap = bitmapfactory.decodestream (IS); Byte[] chunks = bitmap.getninepatchchunk (); Boolean isninepatchchunk = ninepatch.isninepatchchunk (chunks); &NBSP;&NBSP;&NBSP;LOG.V (tag, "Isninepatchchunk:" +isninepatchchunk); if (!isninepatchchunk) { Return new bitmapdrawable (resources, bitmap); } else { rect padding = new rect (); padding.left = getint (CHUNKS,&NBSP;12); padding.right = getint ( CHUNKS,&NBSP;16); padding.top = getint (chunks, 20); Padding.bottom = getint (chunks, 24); return new ninepatchdrawable (Resources, bitmap, chunks, padding, null); } } Private static int getint (Byte[] chunk, int from) { int result = 0; result = (RESULT&NBSP;<<&Nbsp;8) | (chunk[from + 3] & 0xff)); result = (result << 8) | (chunk[from + 2] &&NBSP;0XFF)); result = ((result << 8) | (chunk[from + 1] & 0xff)); result = (result << 8) | (chunk[from + 0] &&NBSP;0XFF)); return result; }
This article is from the "Jackyanngo" blog, make sure to keep this source http://jackyanngo.blog.51cto.com/5263823/1614542
[Android] Load external. 9 Pics