Skip to content

画布背景图片 - #83

Open
devin-ai-integration[bot] wants to merge 3 commits into
devin/1796488522-mcp-commandsfrom
devin/1796515998-image-background
Open

devin-ai-integration[bot] wants to merge 3 commits into
devin/1796488522-mcp-commandsfrom
devin/1796515998-image-background

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

画布背景在纯色、模糊之外新增「背景图片」:从素材库选一张图片(或直接导入),按比例放大盖满画布、居中裁切。叠在 #82 上。

type CanvasBackground =
  | { kind: 'color', color } | { kind: 'blur' }
  | { kind: 'image', image: { id, name, format, width, height } } // id 为素材库 id
  • 渲染:buildScene 生成 scene.backgroundImage = { sourceId, format, rect: coverRect(...) };loadFrameSources 额外取背景图(imageDecoder,动图取第一帧),drawBackdrop 先画背景图再画模糊背景。预览的背景 canvas 和 MP4 导出共用这条路径。
  • 保存:草稿 bg 字段可以是图片对象;assetIdsOf(lines, background) 把背景图算作工程引用的素材,自动保存和 .flycut 工程包都会带上它,素材清理也不会删掉它。恢复时图片丢失则退回黑色背景并提示素材丢失。
  • 剪映:canvas_image 画布,图片写入草稿的 materials/(和片段素材共用新的 addMaterialFile)。
  • MCP:set_canvas({ background: { kind: 'image', assetId } }),get_timeline / set_canvas 返回 { kind: 'image', assetId, name }。
  • 界面:画布菜单新增「背景图片」子菜单:导入图片、素材库图片列表(带缩略图)。

测试:单测覆盖校验、coverRect、草稿往返和 assetIdsOf;MCP e2e 覆盖设置背景图后预览像素、剪映草稿中的 canvas_image 及图片文件、导出 MP4 四角为背景图颜色、菜单选择和刷新后恢复。

Link to Devin session: https://app.devin.ai/sessions/a882af08b80c444280600c6cdc988c2e
Open in Devin Desktop: https://app.devin.ai/desktop/session/a882af08b80c444280600c6cdc988c2e?variant=devin
Requested by: @x007xyz


🟢 Devin fixed all 2 findings · Follow Devin's work

Devin Review

Co-Authored-By: zhangxiang chen <x007xyzabc@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@vercel

vercel Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
fly-cut Ready Ready Preview Dec 6, 2026 12:23am UTC

devin-ai-integration Bot and others added 2 commits December 6, 2026 00:22
Co-Authored-By: zhangxiang chen <x007xyzabc@gmail.com>
Co-Authored-By: zhangxiang chen <x007xyzabc@gmail.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Devin Review found 2 findings. Devin automatically fixed all 2 findings.

Fixed by Devin (2)
  • Cleanup deletes newly selected backgrounds — usedAssets now also counts the current canvas background image, so cleanup before autosave keeps it.
  • Project backup omits its background — exportProject captures the background once and uses it for both the draft JSON and the packed asset list.

View findings in Devin Review · Follow Devin's work

Devin Review

This branch was successfully deployed

1 active deployment
Preview — 569c9d80 Deployed Dec 6, 2026 by vercel[bot]
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.

1 participant