Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a LayerStyle for drawing background blur effects. #441

Merged
merged 5 commits into from
Jan 24, 2025

Conversation

Hparty
Copy link
Collaborator

@Hparty Hparty commented Jan 23, 2025

支持backgroundBlurStyle

@domchen domchen changed the title Support backgroundBlurStyle. Add a LayerStyle for drawing background blur effects. Jan 23, 2025
src/layers/Layer.cpp Outdated Show resolved Hide resolved
src/layers/Layer.cpp Outdated Show resolved Hide resolved
src/layers/Layer.cpp Outdated Show resolved Hide resolved
Comment on lines 857 to 867
for (const auto& layerStyle : _layerStyles) {
if (layerStyle->extraSourceType() == LayerStyleExtraSourceType::Contour) {
needContour = true;
} else if (!forBackground &&
layerStyle->extraSourceType() == LayerStyleExtraSourceType::Background) {
// in background mode, we should not collect background image.
needBackground = true;
}
if (needContour && (forBackground || needBackground)) {
break;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

拆开写吧

Comment on lines 914 to 920
if (layerStyle->extraSourceType() == LayerStyleExtraSourceType::Contour && contour != nullptr) {
layerStyle->drawWithExtraSource(canvas, source->content, source->contentScale, contour,
contourOffset, alpha);
} else if (layerStyle->extraSourceType() == LayerStyleExtraSourceType::Background &&
background != nullptr) {
layerStyle->drawWithExtraSource(canvas, source->content, source->contentScale, background,
backgroundOffset, alpha);
Copy link
Collaborator

Choose a reason for hiding this comment

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

如果require不满足就不执行LayerStyle的draw

@domchen domchen merged commit 3dbeed5 into main Jan 24, 2025
8 checks passed
@domchen domchen deleted the feature/partyhuang_backgroundblur branch January 24, 2025 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants