Jump to content

How to invert a PdnRegion


Recommended Posts

I spent some time to figure out an easy way to invert a PdnRegion but failed.

Assuming there is a selection containing the whole image with a hole in it. How can I get the PdnRegion of the hole?

Tried Xor and Exclude but the results are strange. I checked the Bounds of the inverted region. Typically they show x/y=0/0 and width/height=right and bottom of the inverted region.

Any ideas?

 

midoras signature.gif

Link to comment
Share on other sites

I guess I looked to the wrong bounds method GetBoundsRectInt32(). The basic version GetBounds() returned the expected rectangle of the hole. No idea why GetBoundsRectInt32() returns 0/0 and the right/bottom values in the rectangle.

 

            propInvertedSelection = propSelection.Clone();
            propInvertedSelection.Xor(EnvironmentParameters.SourceSurface.Bounds);
            RectangleF invertedBounds = propInvertedSelection.GetBounds();

 

Now I just have to figure out how to use the PdnRegion as a standard Region without using the RegionScans.

midoras signature.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...