Jump to content

Surface width and height values distinction question


evanolds
 Share

Recommended Posts

In the OnRender method in Effect, are the following values always the same:

EnvironmentParameters.SourceSurface.Width

DstArgs.Surface.Width

SrcArgs.Surface.Width

?

Also, in the Effect class (the non-template one) are the following values always the same:

srcArgs.Width

srcArgs.Surface.Width

EnvironmentParameters.SourceSurface.Width

?

The same question goes for the height values, but I assume the answer is the same. If there is any context in which these values would differ, can you please explain when and why?

The reason I ask is I want to process the image in such a way that modifying a given pixel may be dependent on another pixel elsewhere in the image. If there is a contract saying only use pixels within the bounds of the source surface, but that surface doesn't necessarily represent the working image in its entirety, then I'd want pixels that, in theory, lie outside of this surface.

I guess what I'm really asking is, do we ever get a surface delivered to our effect which is not the entire image? I don't know if you (Rick) do currently or plan to in future versions split large images up into multiple surfaces for visibility culling or other reasons, but I just want to make sure that it's safe to develop code under the assumption that the above values are always equivalent.

There are no warranties whatsoever on my plug-ins. Use them at your own risk. You may redistribute them if you'd like, but I'd prefer you just link to the download on my site. Please do not modify and redistribute.

Link to comment
Share on other sites

The width/height values will always be the same.

When/if Paint.NET shifts to a tiled memory manager, there will be a new interface for effect plugins to use. Legacy effects would work through an adapter layer that will hide this detail, essentially by grabbing one big tile for the whole image. In this situation, legacy effects will require more memory to use but they will still work.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

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.

 Share

×
×
  • Create New...