Repository: flutter
Issue: 9-Patch Images Renders Incorrectly with ColorFilter on v3.27 Android
Labels: waiting for customer response,in triage

### Steps to reproduce

When using 9-patch images with a ColorFilter, a thin line appears at the slice positions. This appears with Flutter v3.27 with both Impeller and non-Impeller.

![image](https://github.com/user-attachments/assets/0672d328-3ccb-4e3d-a834-aac15f02982f)

1. Download the 9-patch demo image bg_chat_bubble_right.png.
2. Run the demo.

### Expected results

9 Patch images with ColorFilter should render correctly, without issues.

### Actual results

The 9-patch image with ColorFilter should be rendered correctly, without any visible lines or artifacts.

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: ListView.builder(
        itemCount: 10,
        itemBuilder: (context, index) {
          // Use only the "right" chat bubble for simplicity
          return const ChatBubble();
        },
      ),
    );
  }
}

class ChatBubble extends StatelessWidget {
  const ChatBubble({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.all(20),
      // Simplified decoration with only the 9-patch image
      decoration: BoxDecoration(
        image: DecorationImage(
          image: AssetImage('assets/images/bg_chat_bubble_right.png'),
          scale: 3,
          centerSlice: const Rect.fromLTWH(14, 12, 28, 8),
          colorFilter:
              const ColorFilter.mode(Color(0xFF545CEA), BlendMode.srcATop),
          fit: BoxFit.fill,
        ),
        borderRadius: const BorderRadius.all(Radius.circular(6)),
      ),
      child: CupertinoContextMenu.builder(
        actions: [
          CupertinoContextMenuAction(
            onPressed: () {
              Navigator.pop(context);
            },
            trailingIcon: CupertinoIcons.doc_on_clipboard_fill,
            child: const Text('Copy'),
          ),
        ],
        builder: (BuildContext context, Animation<double> animation) {
          return const Padding(
            padding: EdgeInsets.all(20),
            child: Text(
              'This is a chat bubble',
              style: TextStyle(color: Colors.black, fontSize: 16),
            ),
          );
        },
      ),
    );
  }
}

```

</details>

![bg_chat_bubble_right](https://github.com/user-attachments/assets/a3aeaf27-4a85-43a4-9bd9-5db991f40cee)



### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.27.1, on macOS 15.2 24C101 darwin-arm64, locale en-US)
    • Flutter version 3.27.1 on channel stable at /Users/ray/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 17025dd882 (3 weeks ago), 2024-12-17 03:23:09 +0900
    • Engine revision cb4b5fff73
    • Dart version 3.6.0
    • DevTools version 2.40.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/ray/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2)
    • Android Studio at /Applications/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
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] VS Code (version 1.96.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.102.0

[✓] Connected device (4 available)
    • A063 (mobile)                   • P112AC001544          • android-arm64  • Android 14 (API 34)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 15.2 24C101 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 15.2 24C101 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 131.0.6778.206

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>