Add blendMode parameter to RawImage and RenderImage#185938
Open
ishaquehassan wants to merge 1 commit into
Open
Add blendMode parameter to RawImage and RenderImage#185938ishaquehassan wants to merge 1 commit into
ishaquehassan wants to merge 1 commit into
Conversation
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
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RawImageand itsRenderImagerender object both delegate their painting topaintImage, which already accepts ablendModeparameter that controls thePaint.blendModeused when compositing the image onto the canvas. Neither widget exposed this parameter though, so the blend mode was always stuck on the defaultBlendMode.srcOver. That made it awkward to useRawImagefor effects like crossfading whereBlendMode.plusis the natural fit, even though the underlying painting code fully supports it.This PR threads a new
blendModeparameter throughRawImage,RenderImage, and thepaintImagecall. The default value isBlendMode.srcOver, matching the existingpaintImagedefault, so behavior is unchanged for every existing caller. The implementation follows the same pattern used byfilterQualityand other non-nullable enum properties onRenderImage(constructor argument, private field with getter/setter that callsmarkNeedsPaint, forwarded inpaint, and reported viadebugFillProperties).Tests cover both the default value and a custom value being forwarded through to
RenderImagefromRawImage, plus the same onRenderImagedirectly.Fixes #145614
Pre-launch Checklist
///).