Jump to content

Selection/non Selection Bottom


Recommended Posts

I want to draw on the last row ( 5 pixel height ) of an image or image selection.

Why does this always return true, when looping thru rect?

    for(int y = rect.Top; y < rect.Bottom; y++)
    {
        for (int x = rect.Left; x < rect.Right; x++)
        {

if ( y > (rect.Bottom - 5) )

Link to comment
Share on other sites

Paint.NET runs effects in multiple threads, and to do that it slices up the source surface into a whole bunch of thin strips. rect is only giving you the bounds of one of those strips. To find the size of the whole selection use the Rectangle returned by:

EnvironmentParameters.GetSelection(***).GetBoundsInt()

//*** needs to be the bounding rect of the whole source surface, but getting that value will vary depending on what overload of the Render() method is being called. For CodeLab, use src.Bounds

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

Hey bud, thanks for the information!

Paint.NET runs effects in multiple threads, and to do that it slices up the source surface into a whole bunch of thin strips. rect is only giving you the bounds of one of those strips. To find the size of the whole selection use the Rectangle returned by:

EnvironmentParameters.GetSelection(***).GetBoundsInt()

//*** needs to be the bounding rect of the whole source surface, but getting that value will vary depending on what overload of the Render() method is being called. For CodeLab, use src.Bounds

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...