Jump to content

Reproducing steps in custom plugin


Recommended Posts

Hi. I'm trying to write my first plugin that reproduces the steps in this video:

 

I have everything set up in Visual Studio, the plugin loads fine and so far everything's good. But I'm not sure where to begin. My OnRender() sub is empty. I don't know where to look for documentation on the effect class.

Could somebody give me a push in the right direction or tell me what functions I need to call do to what. I would appreciate it a lot.

Link to comment
Share on other sites

There is already a chromatic (color) aberation plugin - here

http://forums.getpaint.net/index.php?/topic/19513-color-aberation-ymd100726/

 

Just thought I'd mention it ... I highly recommend writing your own plugins though! ;)

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

Sometimes it's not easy to find the functions you need. For what you want to do, you should know about src.GetBilinearSample(x, y), src.GetBilinearSampleClamped(x, y), and src.GetBilinearSampleWrapped(x, y).  "src" is the source surface. It could be a different surface, but src is the one you'll probably use. "x" and "y" are floating point numbers representing the image coordinates of the point you want to fetch. "Clamped" and "Wrapped" refer to how coordinates outside the image range are handled. For each color channel, you'll need to add float offsets (converted from input-variable doubles) to float versions of the image x and y coordinates (the for loop variables), then get the pixel, as a ColorBgra.

 

If you only want to allow integer shifts, then you can directly index into the src surface. This has the advantage of avoiding blurring caused by bilinear interpolation at non-integer shifts, but the disadvantage of allowing only integer shifts. Normally, there's little reason to use the slower GetBilinearSample calls if the coordinate arguments only take integer values.

Edited by MJW
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...