What I Had
I typically use a dual-head monitor setup, for the nice resolution of 3200x1200. However, I like to make my backgrounds change gracefully, or at least interestingly when I change aspect ratios and/or resolutions.
A standard practice of mine is to take an existing 4:3 aspect ratio background and mirror it to the other side.
<composite> <mirror dir="horizontal"> <img id="ti_l" src=".ti.jpg" /> </mirror> <pad left="$xroot.width/2" color="#00000000"> <recall srcid="ti_l" /> </pad> </composite>
This is great, creating a background that's mirrored about the seam in between my two monitors.
This code produces poor results at a standard aspect ratio... providing a background that's split in the center and shows the left half of each frame.
I had downloaded a free background from vladstudio called Emotion. Vladstudio has some incredible dual-monitor backgrounds ... go check them out. Anyway ... I quickly duplicated the above code and applied an artistic little hsv rotation on the mirror image.
Almost immediately, my work needed me to clear my desk and remove one of my monitors from the situation.
Again, I was faced with the ugly breakage in the center, and wanted a nice mirror to be still existing.
After a little bit of scribbling and thinking... I realized that i just needed to throw a crop tag on the 2nd image, and have it shift, somehow, based on the aspect ratio, or rather the relationship between the aspect ratio and the aspect ratio of the source image.
It turns out, i needed to crop the left side of the source image (before padding), to remove a section of the source image. Specifically, with a 8:3, 16:9 or 4:3 screen, i wanted to remove precisely the difference between the width of the source image, and half the width of the desktop.
<composite> <hsv affected_hue="blue" affected_radius="45" value_offset="-50" saturation_offset="-50"> <mirror dir="horizontal"> <img id="lad" src=".vlad.png" /> </mirror> </hsv> <pad left="$xroot.width/2" color="#00000000"> <crop srcx="$lad.width - ($xroot.width/2)" width="$xroot.width/2"> <recall srcid="lad" /> </crop> </pad> </composite>