moc426 Posted May 18, 2007 Share Posted May 18, 2007 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) ) Quote Link to comment Share on other sites More sharing options...
pyrochild Posted May 18, 2007 Share Posted May 18, 2007 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 Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
moc426 Posted May 18, 2007 Author Share Posted May 18, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.