From d425c37cab5b1daa6eb504d3753aca4a5ea4e698 Mon Sep 17 00:00:00 2001 From: renpengfei Date: Thu, 27 May 2021 10:39:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9Readme=E4=B8=AD=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E6=B7=B7=E5=90=88=E8=AF=B4=E6=98=8E=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 9637eda..51aad16 100755 --- a/README.md +++ b/README.md @@ -39,67 +39,67 @@ ## 使用说明 +1.初始化GlideBitmapPool ```java GlideBitmapPool.initialize(10 * 1024 * 1024); // 10mb max memory size ``` -### Decoding the bitmap from file path +### 根据文件路径解码图片 ```java PixelMap pixelMap = GlideBitmapFactory.decodeFile(filePath); ``` -### Decoding the bitmap from resources +### 根据资源文件解码图片 ```java PixelMap pixelMap = GlideBitmapFactory.decodeResource(getContext(), ResourceTable.Media_test1); ``` -### Decoding the down sample bitmap +### 根据文件路径解码指定大小图片 ```java PixelMap pixelMap = GlideBitmapFactory.decodeFile(filePath,100,100); ``` -### Making the bitmap available for recycle or reuse +### 图片回收重复使用 ```java GlideBitmapPool.putBitmap(bitmap); ``` -### Getting the empty bitmap from the pool +### 从位图池中取出空图 ```java PixelMap pixelMap = GlideBitmapPool.getBitmap(width, height, config); ``` -### Clearing or Trimming Memory +### 清除缓存、整理缓存 ```java GlideBitmapPool.clearMemory(); GlideBitmapPool.trimMemory(level); ``` -### Migrating to Glide Bitmap Pool +### 迁移到位图池 ```java -// ------ decoding ------- -// new code +// ------ 解码图片 ------- PixelMap pixelMap = GlideBitmapFactory.decodeResource(getContext(), ResourceTable.Media_test1); -// ------ recycling ------- +// ------ 回收 ------- -// old code +// 旧代码 bitmap.recycle(); -// new code +// 新代码 GlideBitmapPool.putBitmap(bitmap); -// ------ creating a bitmap ------- -// new code +// ------ 创建图片 ------- +// 新代码 PixelMap pixelMap = GlideBitmapPool.getBitmap(width, height, config); ``` -### Important +### 重要 ``` -// Do not use bitmap.recycle(); -// use GlideBitmapPool.putBitmap(bitmap); as it will put bitmap in the pool for further reuse. +// 不要使用 bitmap.recycle(); +// 使用GlideBitmapPool.putBitmap(bitmap);因为它将位图放入池中以供进一步重用。 -// Do not use Bitmap.create(width, height, config); -// use GlideBitmapPool.getBitmap(width, height, config); as it returns bitmap from the pool that can be reused. +// 不要使用 Bitmap.create(width, height, config); +// 使用GlideBitmapPool.getBitmap(width,height,config);因为它从池中返回可重复使用的位图。 ``` -- Gitee