midora Posted March 21, 2021 Share Posted March 21, 2021 Some may remember there was a plugin feature request to create a callout of the current selection. Because plugins can only write inside of the selection this is not possible. My basic idea was to ask the user to invert the selection first and use the hole content for the callout because read from the hole is allowed. But I.m fighting with the basics and can not just fine tune and finish it. <<<Callout1.png>>> The image shows the inverted selection and some coloring inside of the hole which should not happen. The green rectangle shows the the bounds of the inverted PdnRegion. So the calculation of the inverted selection seems to be correct. The red ellipse is the scaled inverted region (via matrix transformation. The I call Clear on the inverted PdnRegion and there are stripes in the hole (different pattern depending on the scale factor. var invertedSelectionBounds = optInvertedSelection.GetBounds(); var invertedSelectionCenterX = invertedSelectionBounds.X + invertedSelectionBounds.Width / 2; var invertedSelectionCenterY = invertedSelectionBounds.Y + invertedSelectionBounds.Height / 2; var dstRegion = optInvertedSelection.Clone(); var matrix = new Matrix(); matrix.Translate(+invertedSelectionCenterX, +invertedSelectionCenterY); matrix.Scale(optZoomFactor, optZoomFactor); matrix.Translate(-invertedSelectionCenterX, -invertedSelectionCenterY); dstRegion.Transform(matrix); dst.Clear(dstRegion, optBorderColor); There is a second issue if the scale forces the inverted selection to intersect with the surface border then the plugin crashes. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.