Skip to content

Add blendMode parameter to RawImage and RenderImage#185938

Open
ishaquehassan wants to merge 1 commit into
flutter:masterfrom
ishaquehassan:feat/145614-rawimage-blendmode
Open

Add blendMode parameter to RawImage and RenderImage#185938
ishaquehassan wants to merge 1 commit into
flutter:masterfrom
ishaquehassan:feat/145614-rawimage-blendmode

Conversation

@ishaquehassan

Copy link
Copy Markdown
Contributor

RawImage and its RenderImage render object both delegate their painting to paintImage, which already accepts a blendMode parameter that controls the Paint.blendMode used when compositing the image onto the canvas. Neither widget exposed this parameter though, so the blend mode was always stuck on the default BlendMode.srcOver. That made it awkward to use RawImage for effects like crossfading where BlendMode.plus is the natural fit, even though the underlying painting code fully supports it.

This PR threads a new blendMode parameter through RawImage, RenderImage, and the paintImage call. The default value is BlendMode.srcOver, matching the existing paintImage default, so behavior is unchanged for every existing caller. The implementation follows the same pattern used by filterQuality and other non-nullable enum properties on RenderImage (constructor argument, private field with getter/setter that calls markNeedsPaint, forwarded in paint, and reported via debugFillProperties).

Tests cover both the default value and a custom value being forwarded through to RenderImage from RawImage, plus the same on RenderImage directly.

Fixes #145614

Pre-launch Checklist

Forwards the blendMode through to paintImage, defaulting to BlendMode.srcOver
to preserve existing behavior. Allows callers to use blend modes such as
BlendMode.plus for image effects like crossfading without reaching for a
custom render object.

Fixes flutter#145614
@github-actions github-actions Bot added the framework flutter/packages/flutter repository. See also f: labels. label May 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a blendMode property to RenderImage and RawImage, defaulting to BlendMode.srcOver. The property is integrated into the rendering pipeline via paintImage and included in diagnostic output. New tests verify the default value and property forwarding between the widget and render object. I have no feedback to provide.

@justinmc justinmc self-requested a review May 5, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RawImage should accept blendMode and pass it to paintImage

1 participant