![]() |
How to get the (x;y) coordinates of a layer ? [Script-Fu] - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: How to get the (x;y) coordinates of a layer ? [Script-Fu] (/Thread-How-to-get-the-x-y-coordinates-of-a-layer-Script-Fu) |
How to get the (x;y) coordinates of a layer ? [Script-Fu] - Nival - 07-22-2024 Hi again ... So ... another stupid question about which I can't find the answer anywhere ... (again loosing my hair .... the few still here ....). How can I get the position of a layer (or any drawable) in my image ?? I mean, its coordinates (no its "position" like Script-Fu defines it = the position in the tree). I know how to get its width, its heigth, its name, its position in the stack, its opacity, its merging mode, its parent, its children, its... everything ...but its damn coordinates ! ![]() Ok ... I know I've necessary missed something (again... ![]() ![]() RE: How to get the (x;y) coordinates of a layer ? [Script-Fu] - gasMask - 07-23-2024 Hi, I don't know Scheme, but I knew to look for 'offsets', and I found this in a version of Akkana Peck's 'arrow.scm' script. Code: (set! x_offset (car (gimp-drawable-get-offsets drawable))) RE: How to get the (x;y) coordinates of a layer ? [Script-Fu] - Ofnuts - 07-23-2024 (07-23-2024, 02:44 PM)gasMask Wrote: Hi, The call that is documented in the current versions is (gimp-drawable-offsets drawable). (gimp-drawable-get-offsets drawable) is probably deprecated. But, caution, there is also a (gimp-drawable-offset drawable wrap-around fill-type offset-x offset-y) (no final s) which is a different animal (it shifts the layer contents within the current layer boundaries). RE: How to get the (x;y) coordinates of a layer ? [Script-Fu] - gasMask - 07-23-2024 (07-23-2024, 03:49 PM)Ofnuts Wrote:(07-23-2024, 02:44 PM)gasMask Wrote: Hi, So my first experience Scheme is incorrect. I should have known to check the procedural browser. Thanks Ofnuts for pointing out my bad input. RE: How to get the (x;y) coordinates of a layer ? [Script-Fu] - Nival - 07-23-2024 Oh thanks both !! I tried by searching with "position" (not that...), "coordinates", "x" / "y", ... and checked all procedure with "get" in it .... Ok, the key-word is "offset" !! ![]() I see no "*-get-offsets" in the procedures reference ... even though "-layer-set-offsets" exists ....... ... but in fact I see a gimp-drawable-offsets notified as "returns the offsets for the drawable" !! Disturbing in some ways because this name is not consistent with the names used for the other procedures ... in addition there is a gimp-drawable-offset ... which "offset the drawable by the specified amounts in the X and Y directions" ... nonsensical, just with or without "s" ?? it should be "get" and "set" procedures .... but, finally ... if it works it will be ok ! ![]() Thanks again ! (Ok, I'm getting a little angry on my own ... I forgot that for width and height it's gimp-drawable-width / -height ... without "-get-" ... ![]() ![]() |