It is currently Sat Jul 06, 2024 7:55 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Function to move floating selection layer
PostPosted: Fri Aug 10, 2018 7:42 pm  (#1) 
Offline
GimpChat Member

Joined: Jul 26, 2018
Posts: 9
I need to move a floating selection layer so that it's center-aligned and flush to one of the four edges of the image.

What function should I be using for that? Any info on how the coordinate system applies would be helpful, too.

Thanks.


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Function to move floating selection layer
PostPosted: Fri Aug 10, 2018 9:21 pm  (#2) 
Offline
Administrator
User avatar

Joined: Aug 10, 2012
Posts: 13071
Location: Native to NYC living in Arizona, Gimp 2.8 & 2.10, Win 11 PC.
lordcayleth wrote:
I need to move a floating selection layer so that it's center-aligned and flush to one of the four edges of the image.

What function should I be using for that? Any info on how the coordinate system applies would be helpful, too.

Thanks.

I believe that click and drag,
while pressing
Image
Will move the selection.

* * *

Alternatively,
you can use the Move Tool.
:move
Within the Move Tool Options,
activate Selection,
by clicking on it.
Then left-click the canvas and drag.

Image

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image


Top
 Post subject: Re: Function to move floating selection layer
PostPosted: Sat Aug 11, 2018 4:25 am  (#3) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
Use pdb.gimp_layer_set_offsets(layer, offx, offy) (or layer.set_offset(x,y), if your prefer Python's object notation) to move a layer around. This applies to the top left corner of the layer, relative to the top left corner of the canvas. Positive values are down and to the right. Of course you will have to so some arithmetic to compute the adequate values, but this isn't rocket science.

_________________
Image


Top
 Post subject: Re: Function to move floating selection layer
PostPosted: Tue Aug 14, 2018 2:50 pm  (#4) 
Offline
GimpChat Member

Joined: Jul 26, 2018
Posts: 9
ofnuts wrote:
Use pdb.gimp_layer_set_offsets(layer, offx, offy) (or layer.set_offset(x,y), if your prefer Python's object notation) to move a layer around. This applies to the top left corner of the layer, relative to the top left corner of the canvas. Positive values are down and to the right. Of course you will have to so some arithmetic to compute the adequate values, but this isn't rocket science.


Thanks. That was just what I was looking for. :D

Now I've put it where I want it, and anchored it, but there's just one little glitch. After I've done so, the part where the floating selection was anchored displays as transparency in the main view window, although it looks right on the layers view. The newly anchored layer doesn't show up until I click on something. I tried some things in my script, like turning the visibility off or on, selecting everything.... making sure nothing is selected...

How do I get it to refresh the view screen before the script ends, so that everything looks the way it's supposed to before exiting the script?


Top
 Post subject: Re: Function to move floating selection layer
PostPosted: Wed Aug 15, 2018 3:07 am  (#5) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
lordcayleth wrote:
How do I get it to refresh the view screen before the script ends, so that everything looks the way it's supposed to before exiting the script?


That would be gimp-displays-flush


Top
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Floating layer problem

4

No new posts Attachment(s) Image Layer Disappears When I Move It

4

No new posts [SOLVED]Does GIMP [2.10] have a "zoom to layer" function?

9

No new posts Attachment(s) Apply Selection to Layer with LIVE PREVIEW

6

No new posts Selection pasting only transparency - single layer image [Solved]

3



* Login  



Powered by phpBB3 © phpBB Group