@hfyjq/crannia 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +45 -0
- package/README.md +3 -3
- package/THIRD-PARTY-FRONTEND.md +5266 -0
- package/THIRD-PARTY-PYTHON.md +153 -0
- package/THIRD-PARTY.md +316 -0
- package/apps/desktop/quotes.txt +56 -0
- package/bus/__init__.py +0 -0
- package/bus/core.py +671 -0
- package/bus/loaders/__init__.py +0 -0
- package/bus/loaders/channel_loader.py +64 -0
- package/bus/loaders/provider_loader.py +338 -0
- package/bus/loaders/skill_loader.py +769 -0
- package/bus/loaders/skill_md.py +676 -0
- package/bus/mcp_disabled.py +190 -0
- package/bus/quarantine.py +468 -0
- package/bus/registry.py +2284 -0
- package/bus/skill_state.py +124 -0
- package/channels/__init__.py +0 -0
- package/channels/base.py +275 -0
- package/channels/capabilities.py +77 -0
- package/channels/cli_channel/__init__.py +0 -0
- package/channels/cli_channel/handler.py +299 -0
- package/channels/cli_channel/manifest.yaml +5 -0
- package/channels/converter.py +54 -0
- package/channels/dingtalk_channel/handler.py +690 -0
- package/channels/dingtalk_channel/manifest.yaml +12 -0
- package/channels/dingtalk_channel/media.py +299 -0
- package/channels/feishu_channel/handler.py +947 -0
- package/channels/feishu_channel/manifest.yaml +12 -0
- package/channels/feishu_channel/media.py +183 -0
- package/channels/message.py +300 -0
- package/channels/qq_bot_channel/__init__.py +1 -0
- package/channels/qq_bot_channel/handler.py +881 -0
- package/channels/qq_bot_channel/manifest.yaml +4 -0
- package/channels/telegram_channel/__init__.py +1 -0
- package/channels/telegram_channel/handler.py +813 -0
- package/channels/telegram_channel/manifest.yaml +4 -0
- package/channels/telegram_channel/media.py +231 -0
- package/channels/textfmt.py +58 -0
- package/channels/wechat_channel/__init__.py +1 -0
- package/channels/wechat_channel/auth.py +272 -0
- package/channels/wechat_channel/converter.py +148 -0
- package/channels/wechat_channel/handler.py +971 -0
- package/channels/wechat_channel/manifest.yaml +5 -0
- package/channels/wechat_channel/media.py +178 -0
- package/config.yaml +172 -0
- package/core/__init__.py +0 -0
- package/core/activity.py +706 -0
- package/core/agent_loop.py +7188 -0
- package/core/allowlist.py +279 -0
- package/core/approval.py +989 -0
- package/core/approval_timeout.py +228 -0
- package/core/artifacts.py +559 -0
- package/core/ask_user.py +238 -0
- package/core/async_loop.py +264 -0
- package/core/attachment_gc.py +235 -0
- package/core/auto_review.py +1513 -0
- package/core/browser/__init__.py +10 -0
- package/core/browser/cdp.py +198 -0
- package/core/browser/discover.py +97 -0
- package/core/browser/session.py +595 -0
- package/core/browser/tools.py +191 -0
- package/core/cancellation.py +244 -0
- package/core/capabilities.py +105 -0
- package/core/channel_configs.py +402 -0
- package/core/channel_health.py +66 -0
- package/core/channel_turns.py +759 -0
- package/core/chunker.py +119 -0
- package/core/code_intel.py +1205 -0
- package/core/command_policy.py +912 -0
- package/core/compaction_tool.py +54 -0
- package/core/computer/__init__.py +21 -0
- package/core/computer/annotate.py +164 -0
- package/core/computer/capture.py +202 -0
- package/core/computer/guard.py +209 -0
- package/core/computer/input.py +500 -0
- package/core/computer/session.py +381 -0
- package/core/computer/tools.py +928 -0
- package/core/computer/uia.py +508 -0
- package/core/computer/watch.py +270 -0
- package/core/computer/win32.py +954 -0
- package/core/content_sanitizer.py +340 -0
- package/core/context_pressure.py +173 -0
- package/core/context_report.py +236 -0
- package/core/cron/__init__.py +8 -0
- package/core/cron/expr.py +411 -0
- package/core/cron/runner.py +786 -0
- package/core/cron/store.py +434 -0
- package/core/cron/tools.py +271 -0
- package/core/daily_log.py +109 -0
- package/core/dedup.py +310 -0
- package/core/delivery_outbox.py +121 -0
- package/core/egress_gate.py +183 -0
- package/core/egress_preapproved.py +338 -0
- package/core/events.py +885 -0
- package/core/extension.py +461 -0
- package/core/externals.py +144 -0
- package/core/file_history.py +960 -0
- package/core/file_tools.py +1656 -0
- package/core/framework_preset.py +133 -0
- package/core/github_config.py +96 -0
- package/core/group_digest.py +140 -0
- package/core/group_dispatch.py +362 -0
- package/core/group_minutes.py +349 -0
- package/core/group_reply.py +526 -0
- package/core/groups.py +513 -0
- package/core/history_tools.py +390 -0
- package/core/hooks.py +653 -0
- package/core/i18n.py +329 -0
- package/core/ice/__init__.py +122 -0
- package/core/ice/boundary.py +252 -0
- package/core/ice/canary.py +143 -0
- package/core/ice/detect.py +123 -0
- package/core/ice/guard.py +185 -0
- package/core/ice/handles.py +226 -0
- package/core/ice/net_heuristics.py +198 -0
- package/core/ice/pseudonym.py +215 -0
- package/core/ice/reveal.py +229 -0
- package/core/ice/rules/builtin.toml +68 -0
- package/core/ice/rules.py +268 -0
- package/core/ice/store.py +191 -0
- package/core/ice/types.py +97 -0
- package/core/im_routing.py +389 -0
- package/core/image_input.py +1815 -0
- package/core/inbound.py +193 -0
- package/core/incidents.py +291 -0
- package/core/jobs.py +767 -0
- package/core/last_good.py +150 -0
- package/core/leaf_md.py +312 -0
- package/core/llm_errors.py +227 -0
- package/core/llm_retry.py +230 -0
- package/core/loop_health.py +221 -0
- package/core/mail_config.py +150 -0
- package/core/memory/__init__.py +0 -0
- package/core/memory/compressor.py +1214 -0
- package/core/memory/manager.py +1831 -0
- package/core/memory/output_trim.py +98 -0
- package/core/memory/session_memory.py +367 -0
- package/core/memory/short_term.py +1423 -0
- package/core/memory_extract.py +491 -0
- package/core/memory_organize.py +667 -0
- package/core/memory_store.py +860 -0
- package/core/memory_transfer.py +410 -0
- package/core/message_history.py +234 -0
- package/core/model_capabilities.py +138 -0
- package/core/model_configs.py +1308 -0
- package/core/modes.py +361 -0
- package/core/net_proxy.py +614 -0
- package/core/outbound.py +199 -0
- package/core/partial_read.py +65 -0
- package/core/paths.py +478 -0
- package/core/pdf_text_repair.py +545 -0
- package/core/persistent_shell.py +294 -0
- package/core/pipeline/__init__.py +18 -0
- package/core/pipeline/scheduler.py +1700 -0
- package/core/pipeline/stage.py +233 -0
- package/core/pipeline/stages/__init__.py +1 -0
- package/core/pipeline/stages/agent_loop.py +1055 -0
- package/core/pipeline/stages/group_reply.py +598 -0
- package/core/pipeline/stages/post_process.py +141 -0
- package/core/pipeline/stages/pre_process.py +3420 -0
- package/core/plan.py +688 -0
- package/core/plugin_packages.py +166 -0
- package/core/program_discipline.py +192 -0
- package/core/promote.py +166 -0
- package/core/prompt_assembler.py +680 -0
- package/core/recycle.py +295 -0
- package/core/request_snapshot.py +215 -0
- package/core/response_language.py +170 -0
- package/core/retention.py +203 -0
- package/core/retriever.py +97 -0
- package/core/rg.py +255 -0
- package/core/security.py +1544 -0
- package/core/services.py +188 -0
- package/core/session_date.py +98 -0
- package/core/session_key.py +81 -0
- package/core/session_model.py +230 -0
- package/core/session_pool.py +441 -0
- package/core/session_recap.py +181 -0
- package/core/session_workspace.py +362 -0
- package/core/settings_baseline.py +134 -0
- package/core/settings_transfer.py +497 -0
- package/core/shell.py +1783 -0
- package/core/side_call.py +130 -0
- package/core/skill_doctor.py +766 -0
- package/core/skill_factory.py +391 -0
- package/core/skill_guidance.py +346 -0
- package/core/skill_index.py +404 -0
- package/core/skill_load_report.py +47 -0
- package/core/skill_settings.py +257 -0
- package/core/skill_sources.py +313 -0
- package/core/state_registry.py +1217 -0
- package/core/steer.py +97 -0
- package/core/subagent.py +498 -0
- package/core/subagent_defs.py +200 -0
- package/core/subagent_model.py +114 -0
- package/core/summarizer.py +344 -0
- package/core/task_events.py +95 -0
- package/core/task_tool.py +148 -0
- package/core/tasks_notify.py +339 -0
- package/core/tiers.py +660 -0
- package/core/todos.py +230 -0
- package/core/token_calibrator.py +173 -0
- package/core/tokenizer.py +77 -0
- package/core/tool_names.py +61 -0
- package/core/tool_output_kind.py +185 -0
- package/core/tool_permission.py +398 -0
- package/core/tool_program.py +317 -0
- package/core/tool_program_child.py +78 -0
- package/core/touched_files.py +141 -0
- package/core/trace.py +170 -0
- package/core/unlock.py +138 -0
- package/core/updater.py +1463 -0
- package/core/version.py +14 -0
- package/core/walk_scope.py +207 -0
- package/core/window_estimate.py +298 -0
- package/core/workflow.py +282 -0
- package/core/workspace.py +3189 -0
- package/core/worktree.py +115 -0
- package/crannia_tray.py +278 -0
- package/creators/models.json +394 -0
- package/licenses/GPL-3.0.txt +619 -0
- package/licenses/LGPL-2.1.txt +502 -0
- package/licenses/LGPL-3.0.txt +165 -0
- package/licenses/MIT-chat-on-wechat.txt +19 -0
- package/licenses/MIT-deepseek-harness.txt +21 -0
- package/licenses/MPL-2.0.txt +373 -0
- package/licenses/Molio-LICENSE.txt +44 -0
- package/locales/en.json +1757 -0
- package/main.py +154 -0
- package/mcpx/__init__.py +14 -0
- package/mcpx/bridge.py +156 -0
- package/mcpx/client.py +546 -0
- package/mcpx/manager.py +522 -0
- package/mcpx/servers/__init__.py +22 -0
- package/mcpx/servers/web_search.py +655 -0
- package/package.json +33 -5
- package/providers/__init__.py +0 -0
- package/providers/anthropic/__init__.py +1 -0
- package/providers/anthropic/client.py +772 -0
- package/providers/anthropic/manifest.yaml +16 -0
- package/providers/azure/__init__.py +1 -0
- package/providers/azure/client.py +2 -0
- package/providers/azure/manifest.yaml +16 -0
- package/providers/base.py +1080 -0
- package/providers/cost_table.json +3779 -0
- package/providers/deepseek/__init__.py +1 -0
- package/providers/deepseek/client.py +20 -0
- package/providers/deepseek/manifest.yaml +16 -0
- package/providers/factory.py +136 -0
- package/providers/gemini/__init__.py +1 -0
- package/providers/gemini/client.py +2 -0
- package/providers/gemini/manifest.yaml +16 -0
- package/providers/grok/__init__.py +1 -0
- package/providers/grok/client.py +2 -0
- package/providers/grok/manifest.yaml +16 -0
- package/providers/hunyuan/__init__.py +1 -0
- package/providers/hunyuan/client.py +2 -0
- package/providers/hunyuan/manifest.yaml +16 -0
- package/providers/key_rotation.py +114 -0
- package/providers/lmstudio/__init__.py +1 -0
- package/providers/lmstudio/client.py +2 -0
- package/providers/lmstudio/manifest.yaml +14 -0
- package/providers/metadata.py +80 -0
- package/providers/minimax/__init__.py +1 -0
- package/providers/minimax/client.py +2 -0
- package/providers/minimax/manifest.yaml +16 -0
- package/providers/model_capabilities.json +6665 -0
- package/providers/moonshot/__init__.py +1 -0
- package/providers/moonshot/client.py +12 -0
- package/providers/moonshot/manifest.yaml +16 -0
- package/providers/ollama/__init__.py +1 -0
- package/providers/ollama/client.py +2 -0
- package/providers/ollama/manifest.yaml +16 -0
- package/providers/openai/__init__.py +1 -0
- package/providers/openai/client.py +13 -0
- package/providers/openai/manifest.yaml +16 -0
- package/providers/openai_compat.py +1010 -0
- package/providers/openrouter/__init__.py +1 -0
- package/providers/openrouter/client.py +2 -0
- package/providers/openrouter/manifest.yaml +16 -0
- package/providers/qwen/__init__.py +1 -0
- package/providers/qwen/client.py +2 -0
- package/providers/qwen/manifest.yaml +16 -0
- package/providers/rate_limiter.py +144 -0
- package/providers/siliconflow/__init__.py +1 -0
- package/providers/siliconflow/client.py +2 -0
- package/providers/siliconflow/manifest.yaml +16 -0
- package/providers/validation.py +171 -0
- package/providers/volcengine/__init__.py +1 -0
- package/providers/volcengine/client.py +2 -0
- package/providers/volcengine/manifest.yaml +16 -0
- package/providers/window_table.json +8909 -0
- package/providers/zhipu/__init__.py +1 -0
- package/providers/zhipu/client.py +2 -0
- package/providers/zhipu/manifest.yaml +16 -0
- package/requirements.txt +51 -0
- package/sbom.json +4296 -0
- package/skills/__init__.py +0 -0
- package/skills/entertainment/SKILL.md +35 -0
- package/skills/entertainment/__init__.py +1 -0
- package/skills/entertainment/handler.py +91 -0
- package/skills/entertainment/manifest.yaml +26 -0
- package/skills/file_parser/GUIDANCE.md +10 -0
- package/skills/file_parser/SKILL.md +62 -0
- package/skills/file_parser/__init__.py +0 -0
- package/skills/file_parser/handler.py +2553 -0
- package/skills/file_parser/manifest.yaml +646 -0
- package/skills/github/SKILL.md +32 -0
- package/skills/github/__init__.py +1 -0
- package/skills/github/handler.py +338 -0
- package/skills/github/manifest.yaml +205 -0
- package/skills/mail_parser/SKILL.md +68 -0
- package/skills/mail_parser/__init__.py +1 -0
- package/skills/mail_parser/handler.py +806 -0
- package/skills/mail_parser/manifest.yaml +315 -0
- package/skills/media_gen/GUIDANCE.md +19 -0
- package/skills/media_gen/SKILL.md +43 -0
- package/skills/media_gen/__init__.py +1 -0
- package/skills/media_gen/handler.py +430 -0
- package/skills/media_gen/manifest.yaml +88 -0
- package/skills/office_parser/GUIDANCE.md +20 -0
- package/skills/office_parser/SKILL.md +82 -0
- package/skills/office_parser/__init__.py +0 -0
- package/skills/office_parser/_excel_io.py +420 -0
- package/skills/office_parser/cell_validation.py +127 -0
- package/skills/office_parser/excel_query.py +566 -0
- package/skills/office_parser/excel_tools.py +2267 -0
- package/skills/office_parser/excel_transform.py +936 -0
- package/skills/office_parser/handler.py +3219 -0
- package/skills/office_parser/layout_spec.py +243 -0
- package/skills/office_parser/manifest.yaml +3060 -0
- package/skills/office_parser/ppt_tools.py +697 -0
- package/skills/office_parser/pptx_export/__init__.py +20 -0
- package/skills/office_parser/pptx_export/console_encoding.py +27 -0
- package/skills/office_parser/pptx_export/resource_paths.py +88 -0
- package/skills/office_parser/pptx_export/svg_finalize/__init__.py +12 -0
- package/skills/office_parser/pptx_export/svg_finalize/align_embed_images.py +575 -0
- package/skills/office_parser/pptx_export/svg_finalize/crop_images.py +366 -0
- package/skills/office_parser/pptx_export/svg_finalize/embed_icons.py +498 -0
- package/skills/office_parser/pptx_export/svg_finalize/embed_images.py +288 -0
- package/skills/office_parser/pptx_export/svg_finalize/fix_image_aspect.py +388 -0
- package/skills/office_parser/pptx_export/svg_finalize/flatten_tspan.py +818 -0
- package/skills/office_parser/pptx_export/svg_finalize/svg_rect_to_path.py +345 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/__init__.py +14 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/drawingml/__init__.py +1 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/drawingml/context.py +186 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/drawingml/converter.py +781 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/drawingml/elements.py +2490 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/drawingml/paths.py +429 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/drawingml/styles.py +656 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/drawingml/utils.py +770 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/__init__.py +1 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/builder.py +1267 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/dimensions.py +155 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/discovery.py +101 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/media.py +141 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/narration.py +236 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/notes.py +257 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/pptx_package/slide_xml.py +136 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/tspan_flattener.py +44 -0
- package/skills/office_parser/pptx_export/svg_to_pptx/use_expander.py +129 -0
- package/skills/office_parser/references/LICENSE-Office-Word-MCP-Server.txt +21 -0
- package/skills/office_parser/references/LICENSE-excel-mcp-server.txt +21 -0
- package/skills/office_parser/references/layout_library.md +816 -0
- package/skills/office_parser/references/ppt-master/LICENSE +21 -0
- package/skills/office_parser/references/ppt-master/SKILL.md +765 -0
- package/skills/office_parser/references/ppt-master/SOURCE.md +102 -0
- package/skills/office_parser/references/ppt-master/references/executor-base.md +474 -0
- package/skills/office_parser/references/ppt-master/references/shared-standards.md +1002 -0
- package/skills/office_parser/references/ppt-master/references/strategist.md +880 -0
- package/skills/office_parser/references/ppt-master/references/template-designer.md +402 -0
- package/skills/office_parser/references/ppt-master/references/visual-review.md +240 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/_index.md +106 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/blueprint.md +37 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/brutalist.md +38 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/chalkboard.md +36 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/dark-tech.md +37 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/data-journalism.md +36 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/editorial.md +38 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/glassmorphism.md +36 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/ink-notes.md +37 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/ink-wash.md +36 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/memphis.md +37 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/paper-cut.md +36 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/photo-editorial.md +38 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/pixel-art.md +36 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/sketch-notes.md +36 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/soft-rounded.md +37 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/swiss-minimal.md +38 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/vintage-poster.md +36 -0
- package/skills/office_parser/references/ppt-master/references/visual-styles/zine.md +37 -0
- package/skills/office_parser/references/ppt-master/workflows/beautify-pptx.md +278 -0
- package/skills/office_parser/references/ppt-master/workflows/customize-animations.md +287 -0
- package/skills/office_parser/references/ppt-master/workflows/native-enhance-pptx.md +323 -0
- package/skills/office_parser/references/ppt-master/workflows/template-fill-pptx.md +364 -0
- package/skills/office_parser/references/ppt-master/workflows/visual-review.md +190 -0
- package/skills/office_parser/references/spec_lock.md +235 -0
- package/skills/office_parser/session.py +274 -0
- package/skills/office_parser/soffice.py +68 -0
- package/skills/office_parser/word_tools.py +2909 -0
- package/skills/ppt-master/SKILL.md +47 -0
- package/vendor/ripgrep/COPYING.txt +3 -0
- package/vendor/ripgrep/LICENSE-MIT.txt +21 -0
- package/vendor/ripgrep/NOTICE-vscode-ripgrep.txt +13 -0
- package/vendor/ripgrep/README.md +51 -0
- package/vendor/ripgrep/UNLICENSE.txt +24 -0
- package/vendor/ripgrep/package-source.json +19 -0
- package/vendor/ripgrep/win32-x64/rg.exe +0 -0
- package/web/__init__.py +0 -0
- package/web/__main__.py +62 -0
- package/web/server.py +8436 -0
- package/web/static/audio/safety-mode.mp3 +0 -0
- package/web/static/img/channel-dingtalk.png +0 -0
- package/web/static/img/channel-feishu.png +0 -0
- package/web/static/img/channel-qq.svg +1 -0
- package/web/static/img/channel-telegram.svg +1 -0
- package/web/static/img/channel-wechat.svg +1 -0
- package/web/static/img/logo.svg +12 -0
- package/web/static/img/provider-anthropic.svg +1 -0
- package/web/static/img/provider-azure.svg +1 -0
- package/web/static/img/provider-deepseek.svg +1 -0
- package/web/static/img/provider-gemini.svg +1 -0
- package/web/static/img/provider-grok.svg +1 -0
- package/web/static/img/provider-hunyuan.svg +1 -0
- package/web/static/img/provider-lmstudio.svg +1 -0
- package/web/static/img/provider-minimax.svg +1 -0
- package/web/static/img/provider-moonshot.svg +1 -0
- package/web/static/img/provider-ollama.svg +1 -0
- package/web/static/img/provider-openai.svg +1 -0
- package/web/static/img/provider-openrouter.svg +1 -0
- package/web/static/img/provider-qwen.svg +1 -0
- package/web/static/img/provider-siliconflow.svg +1 -0
- package/web/static/img/provider-volcengine.svg +1 -0
- package/web/static/img/provider-zhipu.svg +1 -0
- package/web/static/style.css +2029 -0
- package/web/templates/base.html +985 -0
- package/web/templates/chat.html +2462 -0
- package/web/templates/dashboard.html +821 -0
- package/web/templates/logs.html +49 -0
- package/web/templates/models.html +46 -0
- package/web/templates/security.html +2760 -0
- package/web/templates/skills.html +891 -0
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
"""SVG path parsing, normalization, and DrawingML path command generation."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import math
|
|
6
|
+
import re
|
|
7
|
+
from dataclasses import dataclass, field
|
|
8
|
+
|
|
9
|
+
from .utils import px_to_emu
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class PathCommand:
|
|
14
|
+
"""A single SVG path command with its arguments."""
|
|
15
|
+
cmd: str # M, L, C, Z, etc. (uppercase = absolute)
|
|
16
|
+
args: list[float] = field(default_factory=list)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# Argument counts per SVG path command
|
|
20
|
+
_ARG_COUNTS = {
|
|
21
|
+
'M': 2, 'm': 2, 'L': 2, 'l': 2,
|
|
22
|
+
'H': 1, 'h': 1, 'V': 1, 'v': 1,
|
|
23
|
+
'C': 6, 'c': 6, 'S': 4, 's': 4,
|
|
24
|
+
'Q': 4, 'q': 4, 'T': 2, 't': 2,
|
|
25
|
+
'A': 7, 'a': 7, 'Z': 0, 'z': 0,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def parse_svg_path(d: str) -> list[PathCommand]:
|
|
30
|
+
"""Parse SVG path d attribute into a list of PathCommands."""
|
|
31
|
+
if not d:
|
|
32
|
+
return []
|
|
33
|
+
|
|
34
|
+
commands: list[PathCommand] = []
|
|
35
|
+
tokens = re.findall(
|
|
36
|
+
r'[MmLlHhVvCcSsQqTtAaZz]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?', d
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
current_cmd: str | None = None
|
|
40
|
+
current_args: list[float] = []
|
|
41
|
+
|
|
42
|
+
def flush() -> None:
|
|
43
|
+
nonlocal current_cmd, current_args
|
|
44
|
+
if current_cmd is None:
|
|
45
|
+
return
|
|
46
|
+
|
|
47
|
+
n = _ARG_COUNTS.get(current_cmd, 0)
|
|
48
|
+
if n == 0:
|
|
49
|
+
commands.append(PathCommand(current_cmd, []))
|
|
50
|
+
elif n > 0 and len(current_args) >= n:
|
|
51
|
+
i = 0
|
|
52
|
+
while i + n <= len(current_args):
|
|
53
|
+
commands.append(PathCommand(current_cmd, current_args[i:i + n]))
|
|
54
|
+
# After first M, implicit commands become L
|
|
55
|
+
if current_cmd == 'M':
|
|
56
|
+
current_cmd = 'L'
|
|
57
|
+
elif current_cmd == 'm':
|
|
58
|
+
current_cmd = 'l'
|
|
59
|
+
i += n
|
|
60
|
+
current_args = []
|
|
61
|
+
|
|
62
|
+
for token in tokens:
|
|
63
|
+
if token in 'MmLlHhVvCcSsQqTtAaZz':
|
|
64
|
+
flush()
|
|
65
|
+
current_cmd = token
|
|
66
|
+
current_args = []
|
|
67
|
+
else:
|
|
68
|
+
try:
|
|
69
|
+
current_args.append(float(token))
|
|
70
|
+
except ValueError:
|
|
71
|
+
pass
|
|
72
|
+
|
|
73
|
+
flush()
|
|
74
|
+
return commands
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def svg_path_to_absolute(commands: list[PathCommand]) -> list[PathCommand]:
|
|
78
|
+
"""Convert all relative path commands to absolute."""
|
|
79
|
+
result: list[PathCommand] = []
|
|
80
|
+
cx, cy = 0.0, 0.0 # current point
|
|
81
|
+
sx, sy = 0.0, 0.0 # subpath start
|
|
82
|
+
|
|
83
|
+
for cmd in commands:
|
|
84
|
+
a = cmd.args
|
|
85
|
+
if cmd.cmd == 'M':
|
|
86
|
+
cx, cy = a[0], a[1]
|
|
87
|
+
sx, sy = cx, cy
|
|
88
|
+
result.append(PathCommand('M', [cx, cy]))
|
|
89
|
+
elif cmd.cmd == 'm':
|
|
90
|
+
cx += a[0]; cy += a[1]
|
|
91
|
+
sx, sy = cx, cy
|
|
92
|
+
result.append(PathCommand('M', [cx, cy]))
|
|
93
|
+
elif cmd.cmd == 'L':
|
|
94
|
+
cx, cy = a[0], a[1]
|
|
95
|
+
result.append(PathCommand('L', [cx, cy]))
|
|
96
|
+
elif cmd.cmd == 'l':
|
|
97
|
+
cx += a[0]; cy += a[1]
|
|
98
|
+
result.append(PathCommand('L', [cx, cy]))
|
|
99
|
+
elif cmd.cmd == 'H':
|
|
100
|
+
cx = a[0]
|
|
101
|
+
result.append(PathCommand('L', [cx, cy]))
|
|
102
|
+
elif cmd.cmd == 'h':
|
|
103
|
+
cx += a[0]
|
|
104
|
+
result.append(PathCommand('L', [cx, cy]))
|
|
105
|
+
elif cmd.cmd == 'V':
|
|
106
|
+
cy = a[0]
|
|
107
|
+
result.append(PathCommand('L', [cx, cy]))
|
|
108
|
+
elif cmd.cmd == 'v':
|
|
109
|
+
cy += a[0]
|
|
110
|
+
result.append(PathCommand('L', [cx, cy]))
|
|
111
|
+
elif cmd.cmd == 'C':
|
|
112
|
+
result.append(PathCommand('C', list(a)))
|
|
113
|
+
cx, cy = a[4], a[5]
|
|
114
|
+
elif cmd.cmd == 'c':
|
|
115
|
+
abs_args = [
|
|
116
|
+
cx + a[0], cy + a[1],
|
|
117
|
+
cx + a[2], cy + a[3],
|
|
118
|
+
cx + a[4], cy + a[5],
|
|
119
|
+
]
|
|
120
|
+
result.append(PathCommand('C', abs_args))
|
|
121
|
+
cx, cy = abs_args[4], abs_args[5]
|
|
122
|
+
elif cmd.cmd == 'S':
|
|
123
|
+
result.append(PathCommand('S', list(a)))
|
|
124
|
+
cx, cy = a[2], a[3]
|
|
125
|
+
elif cmd.cmd == 's':
|
|
126
|
+
abs_args = [cx + a[0], cy + a[1], cx + a[2], cy + a[3]]
|
|
127
|
+
result.append(PathCommand('S', abs_args))
|
|
128
|
+
cx, cy = abs_args[2], abs_args[3]
|
|
129
|
+
elif cmd.cmd == 'Q':
|
|
130
|
+
result.append(PathCommand('Q', list(a)))
|
|
131
|
+
cx, cy = a[2], a[3]
|
|
132
|
+
elif cmd.cmd == 'q':
|
|
133
|
+
abs_args = [cx + a[0], cy + a[1], cx + a[2], cy + a[3]]
|
|
134
|
+
result.append(PathCommand('Q', abs_args))
|
|
135
|
+
cx, cy = abs_args[2], abs_args[3]
|
|
136
|
+
elif cmd.cmd == 'T':
|
|
137
|
+
result.append(PathCommand('T', list(a)))
|
|
138
|
+
cx, cy = a[0], a[1]
|
|
139
|
+
elif cmd.cmd == 't':
|
|
140
|
+
abs_args = [cx + a[0], cy + a[1]]
|
|
141
|
+
result.append(PathCommand('T', abs_args))
|
|
142
|
+
cx, cy = abs_args[0], abs_args[1]
|
|
143
|
+
elif cmd.cmd == 'A':
|
|
144
|
+
result.append(PathCommand('A', list(a)))
|
|
145
|
+
cx, cy = a[5], a[6]
|
|
146
|
+
elif cmd.cmd == 'a':
|
|
147
|
+
abs_args = [a[0], a[1], a[2], a[3], a[4], cx + a[5], cy + a[6]]
|
|
148
|
+
result.append(PathCommand('A', abs_args))
|
|
149
|
+
cx, cy = abs_args[5], abs_args[6]
|
|
150
|
+
elif cmd.cmd in ('Z', 'z'):
|
|
151
|
+
result.append(PathCommand('Z', []))
|
|
152
|
+
cx, cy = sx, sy
|
|
153
|
+
|
|
154
|
+
return result
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def _reflect_control_point(
|
|
158
|
+
cp_x: float, cp_y: float,
|
|
159
|
+
cx: float, cy: float,
|
|
160
|
+
) -> tuple[float, float]:
|
|
161
|
+
"""Reflect a control point through the current point."""
|
|
162
|
+
return 2 * cx - cp_x, 2 * cy - cp_y
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def _quad_to_cubic(
|
|
166
|
+
qp_x: float, qp_y: float,
|
|
167
|
+
p0_x: float, p0_y: float,
|
|
168
|
+
p3_x: float, p3_y: float,
|
|
169
|
+
) -> list[float]:
|
|
170
|
+
"""Convert quadratic bezier control point to cubic bezier control points."""
|
|
171
|
+
cp1_x = p0_x + 2.0 / 3.0 * (qp_x - p0_x)
|
|
172
|
+
cp1_y = p0_y + 2.0 / 3.0 * (qp_y - p0_y)
|
|
173
|
+
cp2_x = p3_x + 2.0 / 3.0 * (qp_x - p3_x)
|
|
174
|
+
cp2_y = p3_y + 2.0 / 3.0 * (qp_y - p3_y)
|
|
175
|
+
return [cp1_x, cp1_y, cp2_x, cp2_y, p3_x, p3_y]
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def _arc_to_cubic_beziers(
|
|
179
|
+
cx_: float, cy_: float,
|
|
180
|
+
rx: float, ry: float,
|
|
181
|
+
phi: float,
|
|
182
|
+
large_arc: int, sweep: int,
|
|
183
|
+
x2: float, y2: float,
|
|
184
|
+
) -> list[PathCommand]:
|
|
185
|
+
"""Convert SVG arc (endpoint parameterization) to cubic bezier curves.
|
|
186
|
+
|
|
187
|
+
Uses the algorithm from the SVG spec (F.6.5) to convert endpoint to center
|
|
188
|
+
parameterization, then approximates each arc segment with cubic beziers.
|
|
189
|
+
"""
|
|
190
|
+
x1, y1 = cx_, cy_
|
|
191
|
+
|
|
192
|
+
if abs(x1 - x2) < 1e-10 and abs(y1 - y2) < 1e-10:
|
|
193
|
+
return []
|
|
194
|
+
|
|
195
|
+
rx = abs(rx)
|
|
196
|
+
ry = abs(ry)
|
|
197
|
+
if rx < 1e-10 or ry < 1e-10:
|
|
198
|
+
return [PathCommand('L', [x2, y2])]
|
|
199
|
+
|
|
200
|
+
phi_rad = math.radians(phi)
|
|
201
|
+
cos_phi = math.cos(phi_rad)
|
|
202
|
+
sin_phi = math.sin(phi_rad)
|
|
203
|
+
|
|
204
|
+
# Step 1: Compute (x1', y1')
|
|
205
|
+
dx = (x1 - x2) / 2.0
|
|
206
|
+
dy = (y1 - y2) / 2.0
|
|
207
|
+
x1p = cos_phi * dx + sin_phi * dy
|
|
208
|
+
y1p = -sin_phi * dx + cos_phi * dy
|
|
209
|
+
|
|
210
|
+
# Step 2: Compute (cx', cy')
|
|
211
|
+
x1p2 = x1p * x1p
|
|
212
|
+
y1p2 = y1p * y1p
|
|
213
|
+
rx2 = rx * rx
|
|
214
|
+
ry2 = ry * ry
|
|
215
|
+
|
|
216
|
+
# Ensure radii are large enough
|
|
217
|
+
lam = x1p2 / rx2 + y1p2 / ry2
|
|
218
|
+
if lam > 1:
|
|
219
|
+
lam_sqrt = math.sqrt(lam)
|
|
220
|
+
rx *= lam_sqrt
|
|
221
|
+
ry *= lam_sqrt
|
|
222
|
+
rx2 = rx * rx
|
|
223
|
+
ry2 = ry * ry
|
|
224
|
+
|
|
225
|
+
num = max(rx2 * ry2 - rx2 * y1p2 - ry2 * x1p2, 0)
|
|
226
|
+
den = rx2 * y1p2 + ry2 * x1p2
|
|
227
|
+
sq = math.sqrt(num / den) if den > 1e-10 else 0.0
|
|
228
|
+
|
|
229
|
+
if large_arc == sweep:
|
|
230
|
+
sq = -sq
|
|
231
|
+
|
|
232
|
+
cxp = sq * rx * y1p / ry
|
|
233
|
+
cyp = -sq * ry * x1p / rx
|
|
234
|
+
|
|
235
|
+
# Step 3: Compute (cx, cy)
|
|
236
|
+
arc_cx = cos_phi * cxp - sin_phi * cyp + (x1 + x2) / 2.0
|
|
237
|
+
arc_cy = sin_phi * cxp + cos_phi * cyp + (y1 + y2) / 2.0
|
|
238
|
+
|
|
239
|
+
# Step 4: Compute theta1 and dtheta
|
|
240
|
+
def angle_between(ux: float, uy: float, vx: float, vy: float) -> float:
|
|
241
|
+
n = math.sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy))
|
|
242
|
+
if n < 1e-10:
|
|
243
|
+
return 0
|
|
244
|
+
c = max(-1, min(1, (ux * vx + uy * vy) / n))
|
|
245
|
+
a = math.acos(c)
|
|
246
|
+
if ux * vy - uy * vx < 0:
|
|
247
|
+
a = -a
|
|
248
|
+
return a
|
|
249
|
+
|
|
250
|
+
theta1 = angle_between(1, 0, (x1p - cxp) / rx, (y1p - cyp) / ry)
|
|
251
|
+
dtheta = angle_between(
|
|
252
|
+
(x1p - cxp) / rx, (y1p - cyp) / ry,
|
|
253
|
+
(-x1p - cxp) / rx, (-y1p - cyp) / ry,
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
if sweep == 0 and dtheta > 0:
|
|
257
|
+
dtheta -= 2 * math.pi
|
|
258
|
+
elif sweep == 1 and dtheta < 0:
|
|
259
|
+
dtheta += 2 * math.pi
|
|
260
|
+
|
|
261
|
+
# Split arc into segments of at most 90 degrees
|
|
262
|
+
n_segs = max(1, int(math.ceil(abs(dtheta) / (math.pi / 2))))
|
|
263
|
+
d_per_seg = dtheta / n_segs
|
|
264
|
+
|
|
265
|
+
result: list[PathCommand] = []
|
|
266
|
+
alpha = 4.0 / 3.0 * math.tan(d_per_seg / 4.0)
|
|
267
|
+
|
|
268
|
+
for i in range(n_segs):
|
|
269
|
+
t1 = theta1 + i * d_per_seg
|
|
270
|
+
t2 = theta1 + (i + 1) * d_per_seg
|
|
271
|
+
|
|
272
|
+
cos_t1 = math.cos(t1)
|
|
273
|
+
sin_t1 = math.sin(t1)
|
|
274
|
+
cos_t2 = math.cos(t2)
|
|
275
|
+
sin_t2 = math.sin(t2)
|
|
276
|
+
|
|
277
|
+
ep1_x = cos_t1 - alpha * sin_t1
|
|
278
|
+
ep1_y = sin_t1 + alpha * cos_t1
|
|
279
|
+
ep2_x = cos_t2 + alpha * sin_t2
|
|
280
|
+
ep2_y = sin_t2 - alpha * cos_t2
|
|
281
|
+
ep_x = cos_t2
|
|
282
|
+
ep_y = sin_t2
|
|
283
|
+
|
|
284
|
+
def transform_pt(px: float, py: float) -> tuple[float, float]:
|
|
285
|
+
x = rx * px
|
|
286
|
+
y = ry * py
|
|
287
|
+
xr = cos_phi * x - sin_phi * y + arc_cx
|
|
288
|
+
yr = sin_phi * x + cos_phi * y + arc_cy
|
|
289
|
+
return xr, yr
|
|
290
|
+
|
|
291
|
+
cp1 = transform_pt(ep1_x, ep1_y)
|
|
292
|
+
cp2 = transform_pt(ep2_x, ep2_y)
|
|
293
|
+
ep = transform_pt(ep_x, ep_y)
|
|
294
|
+
|
|
295
|
+
result.append(PathCommand('C', [cp1[0], cp1[1], cp2[0], cp2[1], ep[0], ep[1]]))
|
|
296
|
+
|
|
297
|
+
return result
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
def normalize_path_commands(commands: list[PathCommand]) -> list[PathCommand]:
|
|
301
|
+
"""Normalize path commands to M/L/C/Z only.
|
|
302
|
+
|
|
303
|
+
Converts S -> C, Q -> C, T -> C, A -> C sequences.
|
|
304
|
+
"""
|
|
305
|
+
result: list[PathCommand] = []
|
|
306
|
+
cx, cy = 0.0, 0.0
|
|
307
|
+
last_cp_x, last_cp_y = 0.0, 0.0
|
|
308
|
+
last_cmd = ''
|
|
309
|
+
|
|
310
|
+
for cmd in commands:
|
|
311
|
+
a = cmd.args
|
|
312
|
+
|
|
313
|
+
if cmd.cmd == 'M':
|
|
314
|
+
cx, cy = a[0], a[1]
|
|
315
|
+
last_cp_x, last_cp_y = cx, cy
|
|
316
|
+
result.append(cmd)
|
|
317
|
+
elif cmd.cmd == 'L':
|
|
318
|
+
cx, cy = a[0], a[1]
|
|
319
|
+
last_cp_x, last_cp_y = cx, cy
|
|
320
|
+
result.append(cmd)
|
|
321
|
+
elif cmd.cmd == 'C':
|
|
322
|
+
last_cp_x, last_cp_y = a[2], a[3]
|
|
323
|
+
cx, cy = a[4], a[5]
|
|
324
|
+
result.append(cmd)
|
|
325
|
+
elif cmd.cmd == 'S':
|
|
326
|
+
if last_cmd in ('C', 'S'):
|
|
327
|
+
rcp_x, rcp_y = _reflect_control_point(last_cp_x, last_cp_y, cx, cy)
|
|
328
|
+
else:
|
|
329
|
+
rcp_x, rcp_y = cx, cy
|
|
330
|
+
last_cp_x, last_cp_y = a[0], a[1]
|
|
331
|
+
new_cx, new_cy = a[2], a[3]
|
|
332
|
+
result.append(PathCommand('C', [rcp_x, rcp_y, a[0], a[1], new_cx, new_cy]))
|
|
333
|
+
cx, cy = new_cx, new_cy
|
|
334
|
+
elif cmd.cmd == 'Q':
|
|
335
|
+
cubic = _quad_to_cubic(a[0], a[1], cx, cy, a[2], a[3])
|
|
336
|
+
last_cp_x, last_cp_y = a[0], a[1]
|
|
337
|
+
result.append(PathCommand('C', cubic))
|
|
338
|
+
cx, cy = a[2], a[3]
|
|
339
|
+
elif cmd.cmd == 'T':
|
|
340
|
+
if last_cmd in ('Q', 'T'):
|
|
341
|
+
qp_x, qp_y = _reflect_control_point(last_cp_x, last_cp_y, cx, cy)
|
|
342
|
+
else:
|
|
343
|
+
qp_x, qp_y = cx, cy
|
|
344
|
+
last_cp_x, last_cp_y = qp_x, qp_y
|
|
345
|
+
cubic = _quad_to_cubic(qp_x, qp_y, cx, cy, a[0], a[1])
|
|
346
|
+
result.append(PathCommand('C', cubic))
|
|
347
|
+
cx, cy = a[0], a[1]
|
|
348
|
+
elif cmd.cmd == 'A':
|
|
349
|
+
arc_beziers = _arc_to_cubic_beziers(
|
|
350
|
+
cx, cy, a[0], a[1], a[2], int(a[3]), int(a[4]), a[5], a[6],
|
|
351
|
+
)
|
|
352
|
+
for bc in arc_beziers:
|
|
353
|
+
result.append(bc)
|
|
354
|
+
cx, cy = a[5], a[6]
|
|
355
|
+
last_cp_x, last_cp_y = cx, cy
|
|
356
|
+
elif cmd.cmd == 'Z':
|
|
357
|
+
result.append(cmd)
|
|
358
|
+
else:
|
|
359
|
+
result.append(cmd)
|
|
360
|
+
|
|
361
|
+
last_cmd = cmd.cmd
|
|
362
|
+
|
|
363
|
+
return result
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
def path_commands_to_drawingml(
|
|
367
|
+
commands: list[PathCommand],
|
|
368
|
+
offset_x: float = 0,
|
|
369
|
+
offset_y: float = 0,
|
|
370
|
+
scale_x: float = 1.0,
|
|
371
|
+
scale_y: float = 1.0,
|
|
372
|
+
) -> tuple[str, float, float, float, float]:
|
|
373
|
+
"""Convert normalized path commands to DrawingML <a:path> inner XML.
|
|
374
|
+
|
|
375
|
+
Returns:
|
|
376
|
+
(path_xml, min_x, min_y, width, height) in scaled+offset coordinates.
|
|
377
|
+
"""
|
|
378
|
+
if not commands:
|
|
379
|
+
return '', 0, 0, 0, 0
|
|
380
|
+
|
|
381
|
+
# First pass: calculate bounding box
|
|
382
|
+
points: list[tuple[float, float]] = []
|
|
383
|
+
for cmd in commands:
|
|
384
|
+
if cmd.cmd in ('M', 'L'):
|
|
385
|
+
points.append((
|
|
386
|
+
cmd.args[0] * scale_x + offset_x,
|
|
387
|
+
cmd.args[1] * scale_y + offset_y,
|
|
388
|
+
))
|
|
389
|
+
elif cmd.cmd == 'C':
|
|
390
|
+
for i in range(0, 6, 2):
|
|
391
|
+
points.append((
|
|
392
|
+
cmd.args[i] * scale_x + offset_x,
|
|
393
|
+
cmd.args[i + 1] * scale_y + offset_y,
|
|
394
|
+
))
|
|
395
|
+
|
|
396
|
+
if not points:
|
|
397
|
+
return '', 0, 0, 0, 0
|
|
398
|
+
|
|
399
|
+
min_x = min(p[0] for p in points)
|
|
400
|
+
min_y = min(p[1] for p in points)
|
|
401
|
+
max_x = max(p[0] for p in points)
|
|
402
|
+
max_y = max(p[1] for p in points)
|
|
403
|
+
|
|
404
|
+
width = max(max_x - min_x, 1)
|
|
405
|
+
height = max(max_y - min_y, 1)
|
|
406
|
+
|
|
407
|
+
# Second pass: generate DrawingML path commands (EMU, relative to shape)
|
|
408
|
+
parts: list[str] = []
|
|
409
|
+
for cmd in commands:
|
|
410
|
+
if cmd.cmd == 'M':
|
|
411
|
+
x_emu = px_to_emu(cmd.args[0] * scale_x + offset_x - min_x)
|
|
412
|
+
y_emu = px_to_emu(cmd.args[1] * scale_y + offset_y - min_y)
|
|
413
|
+
parts.append(f'<a:moveTo><a:pt x="{x_emu}" y="{y_emu}"/></a:moveTo>')
|
|
414
|
+
elif cmd.cmd == 'L':
|
|
415
|
+
x_emu = px_to_emu(cmd.args[0] * scale_x + offset_x - min_x)
|
|
416
|
+
y_emu = px_to_emu(cmd.args[1] * scale_y + offset_y - min_y)
|
|
417
|
+
parts.append(f'<a:lnTo><a:pt x="{x_emu}" y="{y_emu}"/></a:lnTo>')
|
|
418
|
+
elif cmd.cmd == 'C':
|
|
419
|
+
pts = []
|
|
420
|
+
for i in range(0, 6, 2):
|
|
421
|
+
x_emu = px_to_emu(cmd.args[i] * scale_x + offset_x - min_x)
|
|
422
|
+
y_emu = px_to_emu(cmd.args[i + 1] * scale_y + offset_y - min_y)
|
|
423
|
+
pts.append(f'<a:pt x="{x_emu}" y="{y_emu}"/>')
|
|
424
|
+
parts.append(f'<a:cubicBezTo>{"".join(pts)}</a:cubicBezTo>')
|
|
425
|
+
elif cmd.cmd == 'Z':
|
|
426
|
+
parts.append('<a:close/>')
|
|
427
|
+
|
|
428
|
+
path_inner = '\n'.join(parts)
|
|
429
|
+
return path_inner, min_x, min_y, width, height
|