checking-image-bounds-transform
Installation
SKILL.md
WPF Image Bounds Checking (With Transforms)
A pattern for checking if mouse coordinates are within the image area and clamping coordinates to image bounds when Pan, Zoom, Rotate transforms are applied.
1. Problem Scenario
Requirements
- Measurement tools, annotation tools in image viewers should only work within the image area
- Need accurate boundary detection even when image is zoomed, panned, or rotated
Complexity
Imagecontrol position varies based onStretch="None",HorizontalAlignment="Center"settings- When
RenderTransformapplies Pan, Zoom, Rotate, calculating actual image position becomes complex