Repository: flutter
Issue: Text shadow blurRadius is not same in captured image using renderRepaintBoundary.toImage with higher pixelRatio
Labels: engine,has reproducible steps,P2,team-engine,triaged-engine,found in release: 3.13,found in release: 3.14

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

I have searched for the existing issue:  [Link](https://github.com/flutter/flutter/issues?q=toImage+pixelRatio+text+).
 But didn't find any solution for it. So here are the steps to reproduce it. 

1. Add a text widget 
2. Then apply shadow to it with `blurRadius`.
3. Now capture an image with `renderRepaintBoundary.toImage(pixelRatio: 6)`
4. Then compare the result with the original UI widgets on the captured image. Shadow is a bit different than the original widget. Looks like the blur radius is not increased with the pixelRatio we have provided during image capture.

Tested  on Android, iOS, MacOS, Web. Using flutter master branch.

### Expected results

The expected result captured image should be the same as the original UI widgets.

### Actual results

The actual result is blur radius in the captured image and the blur radius in the UI is not the same.

### Code sample

<details><summary>Code sample</summary>

```dart
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'dart:ui' as ui;

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Shadow Bug',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Shadow Bug'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Uint8List? capturedImage;
  final GlobalKey _globalKey = GlobalKey();
  Future<void> captureImage() async {
    final boundary =
    _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary;

    final ui.Image image = await boundary.toImage(pixelRatio: 6);
    final ByteData? byteData =
    await image.toByteData(format: ui.ImageByteFormat.png);
    capturedImage = byteData?.buffer.asUint8List();
    setState(() {});
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Column(
        children: [
          const SizedBox(height: 16),
          const Text("Original Widget"),
          RepaintBoundary(
            key: _globalKey,
            child: const WidgetTOCapture(),
          ),
          const SizedBox(height: 26),
          if (capturedImage != null)
            Column(
              children: [
                const Text("Captured Image"),
                Image.memory(capturedImage!),
              ],
            ),
        ],
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => captureImage(),
        tooltip: 'Capture',
        child: const Icon(Icons.camera),
      ),
    );
  }


}

class WidgetTOCapture extends StatelessWidget {
  const WidgetTOCapture({super.key});

  static const boxShadow = BoxShadow(
    offset: Offset(6, 6),
    blurRadius: 15,
    color: Colors.purple,
  );


  @override
  Widget build(BuildContext context) {
    Widget sampleTextWidget = const Center(
      child: Text(
        "Sample Text",
        style: TextStyle(fontSize: 30, shadows: [
          boxShadow,
        ]),
      ),
    );
    Widget sampleWidget = Center(
      child: Container(
        height: 100,
        width: 100,
        decoration: const BoxDecoration(color: Colors.blue, boxShadow: [
          boxShadow,
        ]),
      ),
    );
    return Material(
      color: Colors.grey.withOpacity(.2),
      child: Padding(
        padding: const EdgeInsets.symmetric(vertical: 20),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            sampleTextWidget,
            const SizedBox(width: 20),
            sampleWidget,
          ],
        ),
      ),
    );
  }
}

```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

![Screenshot_1693462302](https://github.com/flutter/flutter/assets/24232207/4e54fe3c-4172-421f-ada3-96e31c8a32ad)



</details>


### Logs

<details><summary>Logs</summary>

Logs -> [LInk](https://controlc.com/113fcd75)
```console


```
https://pastebin.com/ wasn't accepting text bigger than 512KB, so upload to controlc.
</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
shofiul@Sheikhs-MacBook-Pro bug % flutter doctor -v
[✓] Flutter (Channel stable, 3.13.2, on macOS 13.5.1 22G90 darwin-arm64, locale en-US)
    • Flutter version 3.13.2 on channel stable at /Users/shofiul/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ff5b5b5fa6 (7 days ago), 2023-08-24 08:12:28 -0500
    • Engine revision b20183e040
    • Dart version 3.1.0
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/shofiul/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/shofiul/Library/Android/sdk
    • Java binary at: /Users/shofiul/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-2/222.4459.24.2221.10121639/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/shofiul/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-2/222.4459.24.2221.10121639/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /Users/shofiul/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-2/222.4459.24.2221.10121639/Android Studio.app
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.1)
    • IntelliJ at /Users/shofiul/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 75.1.4
    • Dart plugin version 232.9559.10

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2)
    • IntelliJ at /Users/shofiul/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/232.8660.185/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.1)
    • IntelliJ at /Users/shofiul/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/232.9559.62/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.81.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.70.0

[✓] VS Code (version 1.82.0-insider)
    • VS Code at /Applications/Visual Studio Code - Insiders.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 14 (API 34) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS 13.5.1 22G90 darwin-arm64
    • Chrome (web)                • chrome        • web-javascript • Google Chrome 116.0.5845.110

[✓] Network resources
    • All expected network resources are available.

• No issues found!
shofiul@Sheikhs-MacBook-Pro bug % 


```

</details>