feat: support monitor zoom fit best

This commit is contained in:
2026-09-09 14:02:58 +08:00
parent 42a2b08abf
commit 1e15fb4783
3 changed files with 115 additions and 0 deletions
+5
View File
@@ -44,6 +44,11 @@ license = "LGPL-2.1-only"
authors = ["KDE Oxygen Icon Theme Team", "yyc12345"] authors = ["KDE Oxygen Icon Theme Team", "yyc12345"]
source = 'https://invent.kde.org/frameworks/oxygen-icons' source = 'https://invent.kde.org/frameworks/oxygen-icons'
[[licenses]]
file = 'image-png-checkerboard.svg'
license = "CC-BY-SA-4.0"
authors = ["yyc12345"]
[[licenses]] [[licenses]]
file = 'dialog-infomation.svg' file = 'dialog-infomation.svg'
license = "LGPL-2.1-only" license = "LGPL-2.1-only"
@@ -37,6 +37,19 @@ def register(ctx: AuroraContext) -> None:
), ),
build_image_zoom_original_icon, 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( def build_image_properties_icon(
@@ -145,3 +158,86 @@ def build_image_zoom_original_icon(
# save it # save it
fd_sink.push(env, icon) 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)
@@ -51,6 +51,14 @@ def register(ctx: AuroraContext) -> None:
), ),
build_magnifying_glass_icon, build_magnifying_glass_icon,
) )
ctx.register(
"component/monitor",
(
SvgSource("component", "monitor.svg"),
TempArtSink("component", "monitor.png"),
),
build_generic_background,
)
def build_generic_background( def build_generic_background(
@@ -122,3 +130,9 @@ def build_magnifying_glass_icon(
env: AuroraEnvironment, src: BlenderSource, sink: TempArtSink env: AuroraEnvironment, src: BlenderSource, sink: TempArtSink
) -> None: ) -> None:
src.pull_to_temp(env, sink) src.pull_to_temp(env, sink)
def build_monitor_icon(
env: AuroraEnvironment, src: SvgSource, sink: TempArtSink
) -> None:
src.pull_to_temp(env, sink)