Add comprehensive tests for image processing and mask functionalities

- Introduced tests for color image handling, ensuring source preservation and premultiplied alpha usage.
- Implemented tests for brush stroke operations, validating segment boundaries and brush anti-aliasing.
- Added tests for frame anti-aliasing, confirming correct rendering behavior with various alpha values and depth settings.
- Created tests for frame projection, ensuring accurate overlap calculations and half-plane clipping.
- Developed tests for image premultiplied retention, verifying behavior during loading and packing processes.
- Added undo functionality tests for mask operations, ensuring single transaction behavior during edits.
This commit is contained in:
2026-09-05 21:33:11 +08:00
parent bbaa4bff46
commit 1994d38ccd
111 changed files with 7691 additions and 2341 deletions

View File

@@ -17,6 +17,9 @@ DEFAULT_BACKGROUND_MODEL_KEY = "BEN2_BASE"
DEFAULT_MAX_CUTOUT_MESH_RESOLUTION = 1024
MIN_CUTOUT_MESH_RESOLUTION = 4
MAX_CUTOUT_MESH_RESOLUTION = 1024
DEFAULT_MAX_FRAME_RESOLUTION = 2048
MIN_FRAME_RESOLUTION = 64
MAX_FRAME_RESOLUTION = 8192
ADDON_PACKAGE = __package__
DEFAULT_STORAGE_ROOT = Path.home() / ".anyimage"
@@ -73,6 +76,18 @@ def configured_max_cutout_mesh_resolution(context=None):
)
def configured_max_frame_resolution(context=None):
preferences = addon_preferences(context)
value = int(
getattr(
preferences,
"max_frame_resolution",
DEFAULT_MAX_FRAME_RESOLUTION,
)
)
return min(max(value, MIN_FRAME_RESOLUTION), MAX_FRAME_RESOLUTION)
def configured_max_ai_input_size(context=None):
preferences = addon_preferences(context)
value = int(getattr(preferences, "max_ai_input_size", DEFAULT_MAX_AI_INPUT_SIZE))
@@ -139,6 +154,15 @@ class AnyImagePreferences(bpy.types.AddonPreferences):
step=64,
subtype="PIXEL",
)
max_frame_resolution: bpy.props.IntProperty(
name="Maximum Frame Resolution",
description="Maximum output resolution along the longest Frame edge",
default=DEFAULT_MAX_FRAME_RESOLUTION,
min=MIN_FRAME_RESOLUTION,
max=MAX_FRAME_RESOLUTION,
step=128,
subtype="PIXEL",
)
balloon_profile_algorithm: bpy.props.EnumProperty(
name="Balloon Profile",
description="Algorithm used to generate o_balloon for every Cutout shape",
@@ -220,6 +244,9 @@ class AnyImagePreferences(bpy.types.AddonPreferences):
)
tools = self._draw_box(layout, "Tools")
tools.label(text="Frame Tool")
tools.prop(self, "max_frame_resolution")
tools.separator(type="LINE")
tools.label(text="Depth & Normal")
tools.prop(self, "geometry_resolution_level")
tools.separator(type="LINE")