diff --git a/app/src/main/assets/01_VectorColorArea_1.x.svga b/app/src/main/assets/matteBitmap.svga similarity index 67% rename from app/src/main/assets/01_VectorColorArea_1.x.svga rename to app/src/main/assets/matteBitmap.svga index c61fa086..c73db699 100644 Binary files a/app/src/main/assets/01_VectorColorArea_1.x.svga and b/app/src/main/assets/matteBitmap.svga differ diff --git a/app/src/main/assets/02_BitmapColorArea_1.x.svga b/app/src/main/assets/matteBitmap_1.x.svga similarity index 99% rename from app/src/main/assets/02_BitmapColorArea_1.x.svga rename to app/src/main/assets/matteBitmap_1.x.svga index ed8e20b7..f65e8aad 100644 Binary files a/app/src/main/assets/02_BitmapColorArea_1.x.svga and b/app/src/main/assets/matteBitmap_1.x.svga differ diff --git a/library/src/main/java/com/opensource/svgaplayer/SVGAVideoEntity.kt b/library/src/main/java/com/opensource/svgaplayer/SVGAVideoEntity.kt index 17f7f1d6..c7a1598c 100644 --- a/library/src/main/java/com/opensource/svgaplayer/SVGAVideoEntity.kt +++ b/library/src/main/java/com/opensource/svgaplayer/SVGAVideoEntity.kt @@ -91,18 +91,19 @@ class SVGAVideoEntity { options.inPreferredConfig = Bitmap.Config.RGB_565 var filePath = cacheDir.absolutePath + "/" + imgObjects[imageKey] var bitmap = if (File(filePath).exists()) BitmapFactory.decodeFile(filePath, options) else null + val bitmapKey = imageKey.replace(".matte", "") if (bitmap != null) { - images.put(imageKey, bitmap) + images.put(bitmapKey, bitmap) } else { // bitmap.matte : bitmap var filePath = cacheDir.absolutePath + "/" + imgObjects[imageKey] + ".png" var bitmap = if (File(filePath).exists()) BitmapFactory.decodeFile(filePath, options) else null if (bitmap != null) { - images.put(imageKey, bitmap) + images.put(bitmapKey, bitmap) } else { (cacheDir.absolutePath + "/" + imageKey + ".png").takeIf { File(it).exists() }?.let { BitmapFactory.decodeFile(it, options)?.let { - images.put(imageKey, it) + images.put(bitmapKey, it) } } } diff --git a/library/src/main/java/com/opensource/svgaplayer/drawer/SVGACanvasDrawer.kt b/library/src/main/java/com/opensource/svgaplayer/drawer/SVGACanvasDrawer.kt index 6871ad96..1e9a4bcc 100644 --- a/library/src/main/java/com/opensource/svgaplayer/drawer/SVGACanvasDrawer.kt +++ b/library/src/main/java/com/opensource/svgaplayer/drawer/SVGACanvasDrawer.kt @@ -123,7 +123,8 @@ internal class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVG val imageKey = sprite.imageKey ?: return val isHidden = dynamicItem.dynamicHidden[imageKey] == true if (isHidden) { return } - val drawingBitmap = (dynamicItem.dynamicImage[imageKey] ?: videoItem.images[imageKey]) ?: return + val bitmapKey = imageKey.replace(".matte", "") + val drawingBitmap = (dynamicItem.dynamicImage[bitmapKey] ?: videoItem.images[bitmapKey]) ?: return val frameMatrix = shareFrameMatrix(sprite.frameEntity.transform) val paint = this.sharedValues.sharedPaint() paint.isAntiAlias = videoItem.antiAlias