This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| File file = getFileStreamPath(fileName); | |
| String path = file.getAbsolutePath(); | |
| String html = "<body style=\"margin:0;padding:0;border:0;\"><img width=\"100%\" src=\"file://" + path + "\" /></body>"; | |
| getWebView().loadDataWithBaseURL("http://noneed.url", html, "text/html", "UTF-8", "about:blank"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| InputStream is; | |
| try { | |
| is = openFileInput(fileName); | |
| ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
| byte[] buffer = new byte[10240]; | |
| int count; | |
| while(-1 != (count = is.read(buffer, 0, buffer.length))) { | |
| baos.write(buffer, 0, count); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class BitmapHelper { | |
| //gapRatio:間距的比例 | |
| //reflectRatio:鏡像的比例 | |
| public static Bitmap reflection(Bitmap src, float gapRatio, float reflectRatio) { | |
| int origWidth = src.getWidth(); | |
| int origHeight = src.getHeight(); | |
| int gapHeight = Float.valueOf(origHeight * gapRatio).intValue(); | |
| int reflectHeight = Float.valueOf(origHeight * reflectRatio).intValue(); | |
| //統一色彩定義,讓圖片色盤不會跑掉。不然jpg沒有alpha channel會很怪。 |