From 1e15fb4783d2d23863b7a3a2e63dc1c5291901f4 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Wed, 9 Sep 2026 14:02:58 +0800 Subject: [PATCH] feat: support monitor zoom fit best --- src/LICENSES.toml | 5 + .../nostd_icons/action_icons.py | 96 +++++++++++++++++++ .../std_icons/components.py | 14 +++ 3 files changed, 115 insertions(+) diff --git a/src/LICENSES.toml b/src/LICENSES.toml index d79539d..7b08d82 100644 --- a/src/LICENSES.toml +++ b/src/LICENSES.toml @@ -44,6 +44,11 @@ license = "LGPL-2.1-only" authors = ["KDE Oxygen Icon Theme Team", "yyc12345"] source = 'https://invent.kde.org/frameworks/oxygen-icons' +[[licenses]] +file = 'image-png-checkerboard.svg' +license = "CC-BY-SA-4.0" +authors = ["yyc12345"] + [[licenses]] file = 'dialog-infomation.svg' license = "LGPL-2.1-only" diff --git a/tool/src/aurora_iconset_builder/nostd_icons/action_icons.py b/tool/src/aurora_iconset_builder/nostd_icons/action_icons.py index 1326b2e..2d66572 100644 --- a/tool/src/aurora_iconset_builder/nostd_icons/action_icons.py +++ b/tool/src/aurora_iconset_builder/nostd_icons/action_icons.py @@ -37,6 +37,19 @@ def register(ctx: AuroraContext) -> None: ), build_image_zoom_original_icon, ) + ctx.register( + "nostd/action/monitor-zoom-fit-best", + ( + TempArtSource("component", "triangle-left.png"), + TempArtSource("component", "triangle-down.png"), + TempArtSource("component", "triangle-right.png"), + TempArtSource("component", "triangle-up.png"), + TempArtSource("component", "monitor.png"), + NewArtSource(), + FdArtSink(FdContext.Actions, "monitor-zoom-fit-best"), + ), + build_monitor_zoom_fit_best_icon, + ) def build_image_properties_icon( @@ -145,3 +158,86 @@ def build_image_zoom_original_icon( # save it fd_sink.push(env, icon) + +def build_monitor_zoom_fit_best_icon( + env: AuroraEnvironment, + tri_left_src: TempArtSource, + tri_down_src: TempArtSource, + tri_right_src: TempArtSource, + tri_up_src: TempArtSource, + inner_src: TempArtSource, + new_art: NewArtSource, + fd_sink: FdArtSink, +) -> None: + # load triangle assets + TRI_SIZE = (200, 200) + tri_left = default_art_resize(tri_left_src.pull(env), *TRI_SIZE) + tri_down = default_art_resize(tri_down_src.pull(env), *TRI_SIZE) + tri_right = default_art_resize(tri_right_src.pull(env), *TRI_SIZE) + tri_up = default_art_resize(tri_up_src.pull(env), *TRI_SIZE) + + # load inner image + inner = inner_src.pull(env) + resized_inner = default_art_resize(inner, 620, 620) + + # composite this icon + icon = new_art.pull() + + align_paste( + icon, + resized_inner, + art_anchor_to_offset(icon, HorizontalAnchor.Center, VerticalAnchor.Center), + art_anchor_to_offset( + resized_inner, HorizontalAnchor.Center, VerticalAnchor.Center + ), + ) + + tri_rect = Rectangle.from_margin_rect(VART_HW, VART_HW, 100, 0, 100, 0) + align_alpha_composite( + icon, + tri_right, + anchor_to_offset( + tri_rect.width, + tri_rect.height, + HorizontalAnchor.Left, + VerticalAnchor.Center, + ) + + tri_rect.pos1, + art_anchor_to_offset(tri_right, HorizontalAnchor.Left, VerticalAnchor.Center), + ) + align_alpha_composite( + icon, + tri_left, + anchor_to_offset( + tri_rect.width, + tri_rect.height, + HorizontalAnchor.Right, + VerticalAnchor.Center, + ) + + tri_rect.pos1, + art_anchor_to_offset(tri_left, HorizontalAnchor.Right, VerticalAnchor.Center), + ) + align_alpha_composite( + icon, + tri_down, + anchor_to_offset( + tri_rect.width, tri_rect.height, HorizontalAnchor.Center, VerticalAnchor.Top + ) + + tri_rect.pos1, + art_anchor_to_offset(tri_down, HorizontalAnchor.Center, VerticalAnchor.Top), + ) + align_alpha_composite( + icon, + tri_up, + anchor_to_offset( + tri_rect.width, + tri_rect.height, + HorizontalAnchor.Center, + VerticalAnchor.Bottom, + ) + + tri_rect.pos1, + art_anchor_to_offset(tri_up, HorizontalAnchor.Center, VerticalAnchor.Bottom), + ) + + # save it + fd_sink.push(env, icon) diff --git a/tool/src/aurora_iconset_builder/std_icons/components.py b/tool/src/aurora_iconset_builder/std_icons/components.py index 6f75418..1d569b9 100644 --- a/tool/src/aurora_iconset_builder/std_icons/components.py +++ b/tool/src/aurora_iconset_builder/std_icons/components.py @@ -51,6 +51,14 @@ def register(ctx: AuroraContext) -> None: ), build_magnifying_glass_icon, ) + ctx.register( + "component/monitor", + ( + SvgSource("component", "monitor.svg"), + TempArtSink("component", "monitor.png"), + ), + build_generic_background, + ) def build_generic_background( @@ -122,3 +130,9 @@ def build_magnifying_glass_icon( env: AuroraEnvironment, src: BlenderSource, sink: TempArtSink ) -> None: src.pull_to_temp(env, sink) + + +def build_monitor_icon( + env: AuroraEnvironment, src: SvgSource, sink: TempArtSink +) -> None: + src.pull_to_temp(env, sink)