How to properly handle situation when you need to rotate an image, drawImage() another image in that rectangle, then rotate the image back? #2726
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
I haven’t looked at your sample in detail but one thing immediately stands out. You don’t need to apply the translation like System.Drawing. We already rotate around the centre. |
Beta Was this translation helpful? Give feedback.
-
i've just create a samples repo PR with an sample for producing this effect with out all the repeated transforms SixLabors/Samples#33. The linked PR/sample use our clip api to build up the final complex polygon you want the blur (or any processing operation) applied to as a single operation, no need to have lots of parts of images that you need to manually need to draw. It wasn't 100% clear from your sample the final desired behaviour with layering multiple blur/unblur operations with multiple overlapping regions so there are 2 versions of the helper in the sample for the 2 behaviours I could think might be wanted. Basically the process is as such, you create a single complex polygon that covers all parts of the image you want blurred, then call Source imageResult imageDirect link to sample program code
|
Beta Was this translation helpful? Give feedback.
Sample has been updated with rotation support
relevant code you will need to generate each region of interest to combine is this.
https://github.com/SixLabors/Samples/blob/67ffd43bf3dae46a659fa4deb9eaa23af6ca7302/ImageSharp/BlurMultiplePartsOfImage/Program.cs#L25-L32