From 2fbf11a77bc32c978fe996e7ebf3ec38e3b48588 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Wed, 4 May 2016 18:50:38 -0700 Subject: [PATCH] Expose blurSigma (#3743) Fixes #3741 --- packages/flutter/lib/src/painting/box_painter.dart | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/flutter/lib/src/painting/box_painter.dart b/packages/flutter/lib/src/painting/box_painter.dart index ed854fd725..3b504451e6 100644 --- a/packages/flutter/lib/src/painting/box_painter.dart +++ b/packages/flutter/lib/src/painting/box_painter.dart @@ -395,9 +395,13 @@ class BoxShadow { final double spreadRadius; + /// The [blurRadius] in sigmas instead of logical pixels. + /// + /// See the sigma argument to [MaskFilter.blur]. + /// // See SkBlurMask::ConvertRadiusToSigma(). - // https://github.com/google/skia/blob/bb5b77db51d2e149ee66db284903572a5aac09be/src/effects/SkBlurMask.cpp#L23 - double get _blurSigma => blurRadius * 0.57735 + 0.5; + // + double get blurSigma => blurRadius * 0.57735 + 0.5; /// Returns a new box shadow with its offset, blurRadius, and spreadRadius scaled by the given factor. BoxShadow scale(double factor) { @@ -1291,7 +1295,7 @@ class _BoxDecorationPainter extends BoxPainter { for (BoxShadow boxShadow in _decoration.boxShadow) { final Paint paint = new Paint() ..color = boxShadow.color - ..maskFilter = new MaskFilter.blur(BlurStyle.normal, boxShadow._blurSigma); + ..maskFilter = new MaskFilter.blur(BlurStyle.normal, boxShadow.blurSigma); final Rect bounds = rect.shift(boxShadow.offset).inflate(boxShadow.spreadRadius); _paintBox(canvas, bounds, paint); }