mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-04 23:54:53 +00:00
[android] Support image onLayout, transform arrays, and fix clipping.
This commit is contained in:
@@ -195,33 +195,22 @@ class ImageView extends RenderableView {
|
||||
if (mMatrix != null) {
|
||||
mMatrix.mapRect(vbRect);
|
||||
}
|
||||
if (mTransform != null) {
|
||||
mTransform.mapRect(vbRect);
|
||||
}
|
||||
|
||||
canvas.clipPath(getPath(canvas, paint));
|
||||
|
||||
Path clip = new Path();
|
||||
Path clipPath = getClipPath(canvas, paint);
|
||||
Path path = getPath(canvas, paint);
|
||||
if (clipPath != null) {
|
||||
// clip by the common area of clipPath and mPath
|
||||
clip.setFillType(Path.FillType.INVERSE_EVEN_ODD);
|
||||
|
||||
Path inverseWindingPath = new Path();
|
||||
inverseWindingPath.setFillType(Path.FillType.INVERSE_WINDING);
|
||||
inverseWindingPath.addPath(path);
|
||||
inverseWindingPath.addPath(clipPath);
|
||||
|
||||
Path evenOddPath = new Path();
|
||||
evenOddPath.setFillType(Path.FillType.EVEN_ODD);
|
||||
evenOddPath.addPath(path);
|
||||
evenOddPath.addPath(clipPath);
|
||||
|
||||
canvas.clipPath(evenOddPath, Region.Op.DIFFERENCE);
|
||||
canvas.clipPath(inverseWindingPath, Region.Op.DIFFERENCE);
|
||||
} else {
|
||||
canvas.clipPath(path, Region.Op.REPLACE);
|
||||
canvas.clipPath(clipPath);
|
||||
}
|
||||
|
||||
Paint alphaPaint = new Paint();
|
||||
alphaPaint.setAlpha((int) (opacity * 255));
|
||||
canvas.drawBitmap(bitmap, null, vbRect, alphaPaint);
|
||||
canvas.getMatrix().mapRect(vbRect);
|
||||
this.setClientRect(vbRect);
|
||||
}
|
||||
|
||||
private void tryRender(ImageRequest request, Canvas canvas, Paint paint, float opacity) {
|
||||
|
||||
Reference in New Issue
Block a user