void _drawWithMaskFilter(Rect meshBounds, Action <Paint> drawAction, Paint paint, MaskFilter maskFilter) { var layer = this._currentLayer; var clipBounds = layer.layerBounds; Rect stackBounds; bool iior; layer.clipStack.getBounds(out stackBounds, out iior); if (stackBounds != null) { clipBounds = clipBounds.intersect(stackBounds); } if (clipBounds.isEmpty) { return; } var state = layer.currentState; float sigma = state.scale * maskFilter.sigma; if (sigma <= 0) { return; } float sigma3 = 3 * sigma; var maskBounds = meshBounds.inflate(sigma3); maskBounds = maskBounds.intersect(clipBounds.inflate(sigma3)); if (maskBounds.isEmpty) { return; } var maskLayer = this._createMaskLayer(layer, maskBounds, drawAction, paint); var blurLayer = this._createBlurLayer(maskLayer, sigma, layer); var blurMesh = ImageMeshGenerator.imageMesh(null, Rect.one, maskBounds); if (!this._applyClip(blurMesh.bounds)) { return; } layer.draws.Add(CanvasShader.texRT(layer, paint, blurMesh, blurLayer)); }
public static void debugPaintPadding(Canvas canvas, Rect outerRect, Rect innerRect, float outlineWidth = 2.0f) { assert(() => { if (innerRect != null && !innerRect.isEmpty) { _debugDrawDoubleRect(canvas, outerRect, innerRect, new Color(0x900090FF)); _debugDrawDoubleRect(canvas, innerRect.inflate(outlineWidth).intersect(outerRect), innerRect, new Color(0xFF0090FF)); } else { Paint paint = new Paint(); paint.color = new Color(0x90909090); canvas.drawRect(outerRect, paint); } return(true); }); }