Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
fix: Remove clipPath support.
Browse files Browse the repository at this point in the history
  • Loading branch information
errnull committed May 28, 2019
1 parent a0c5a79 commit f9e3827
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
Binary file added app/src/main/assets/matte.svga
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void onClick(View view) {

private void loadAnimation() {
SVGAParser parser = new SVGAParser(this);
parser.decodeFromAssets(this.randomSample(), new SVGAParser.ParseCompletion() {
parser.decodeFromAssets("matte.svga", new SVGAParser.ParseCompletion() {
@Override
public void onComplete(@NotNull SVGAVideoEntity videoItem) {
animationView.setVideoItem(videoItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,15 @@ internal class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVG
paint.style = Paint.Style.FILL
paint.color = it
paint.alpha = Math.min(255, Math.max(0, (sprite.frameEntity.alpha * 255).toInt()))
if (sprite.frameEntity.maskPath !== null) canvas.save()
sprite.frameEntity.maskPath?.let { maskPath ->
val path2 = this.sharedValues.sharedPath2()
maskPath.buildPath(path2)
path2.transform(frameMatrix)
canvas.clipPath(path2)
}
// if (sprite.frameEntity.maskPath !== null) canvas.save()
// sprite.frameEntity.maskPath?.let { maskPath ->
// val path2 = this.sharedValues.sharedPath2()
// maskPath.buildPath(path2)
// path2.transform(frameMatrix)
// canvas.clipPath(path2)
// }
// if (sprite.frameEntity.maskPath !== null) canvas.restore()
canvas.drawPath(path, paint)
if (sprite.frameEntity.maskPath !== null) canvas.restore()
}
}
shape.styles?.strokeWidth?.let {
Expand Down Expand Up @@ -220,15 +220,15 @@ internal class SVGACanvasDrawer(videoItem: SVGAVideoEntity, val dynamicItem: SVG
), it[2] * scale)
}
}
if (sprite.frameEntity.maskPath !== null) canvas.save()
sprite.frameEntity.maskPath?.let { maskPath ->
val path2 = this.sharedValues.sharedPath2()
maskPath.buildPath(path2)
path2.transform(frameMatrix)
canvas.clipPath(path2)
}
// if (sprite.frameEntity.maskPath !== null) canvas.save()
// sprite.frameEntity.maskPath?.let { maskPath ->
// val path2 = this.sharedValues.sharedPath2()
// maskPath.buildPath(path2)
// path2.transform(frameMatrix)
// canvas.clipPath(path2)
// }
// if (sprite.frameEntity.maskPath !== null) canvas.restore()
canvas.drawPath(path, paint)
if (sprite.frameEntity.maskPath !== null) canvas.restore()
}
}
}
Expand Down

0 comments on commit f9e3827

Please sign in to comment.