Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
displacement plugin
#2
(Yesterday, 07:43 PM)vivi-d Wrote: Hello, I'm trying to create a plugin that will move the selection as if it's 'displacing' pixels as it moves. More specifically, if moving one pixel to the right, it will take all the pixels just to the right of the selection and place them on the left side of the selection. 

If I had a way to test if a certain pixel is inside the selection or not, I could hack something together. So far I haven't found a way to test pixels for whether they are selected or not.

What do you guys think?

You don't tell which version of Gimp nor which language, so here for Python in v2.10:

Code:
value = pdb.gimp_selection_value(image, x, y)

In other languages/versions, you get the selection first, then ask the selection for the value at (x,y). 

In all cases the value is not a boolean, it is a ratio between 0 and 1 (or 0 and 255). Working pixel by pixel is going to be slow.
Reply


Messages In This Thread
displacement plugin - by vivi-d - Yesterday, 07:43 PM
RE: displacement plugin - by Ofnuts - 7 hours ago

Forum Jump: