Post Reply 

Please help with function return

Aug 26, 2013, 13:00
Post: #1
Please help with function return
First of all excuse me for my english.
So... the question. (Script-fu).
I wanna get x/y coordinates of path points.
Function gimp-vector-stroke-get-points
returns something like that (for two point path):
(0 12 #(1463.0 1402,5.0 1463.0 1402,5.0 1463.0 1402,5.0 1303,5.0 1600,5.0 1303,5.0 1600,5.0 1303,5.0 1600,5.0) 0)
where 0 is type of stroke, 12 is number of floats (???) and then x/y coordinates in pixels (where ending 0 is type of the point).
Thus x1=1463.0 y=1405,5.0
What is that data type?
How can i get x/y coodinates as numbers, i.e. x=1463 and y=1405.
Thanks for your answers.
Find all posts by this user
Quote this message in a reply
Aug 26, 2013, 14:36
Post: #2
RE: Please help with function return
(Aug 26, 2013 13:46)ofnuts Wrote:  I don't to Scheme, but the Python interface returns a plain array of floats(*), where each sequence of 6 numbers is:

- x coordinate of the backward handle
- y coordinate of the backward handle
- x coordinate of the anchor
- y coordinate of the anchor
- x coordinate of the forward handle
- y coordinate of the forward handle

So for a stroke defined by two points, you get and array of twelve floats. When there is no control handle, the control handle coordinates are the same as those of the anchor.

I have written a number of Python scripts dealing with paths (and IMHO, you should better be using Python). See there:

http://gimp-path-tools.sourceforge.net/
http://sourceforge.net/projects/gimp-pat...s/scripts/


(*) looking at the doc, so does the script-fu interface
Thank you for answer, i'll see... but i'v just have ready script and i'd like just to improve it to easyway tu use, so may be somebody else helps me.
Find all posts by this user
Quote this message in a reply
Aug 26, 2013, 14:40
Post: #3
RE: Please help with function return
Thank you for your help. I'll see it.
But i just allready have working script (but another way) and would like to improve it for better use.
So may be somebody else helps me.
Find all posts by this user
Quote this message in a reply
Aug 28, 2013, 06:02 (This post was last modified: Aug 28, 2013 06:07 by UncleSemen.)
Post: #4
RE: Please help with function return
Thanks to all for the help.
This is the actual contents of the variable.
May be something depends on OS, Gimp version, using Scheme (as i do) or Python or something else...
The problem allready solved. That data type is NUMBER or REAL and good result can be achived by using (abs) or (round) functions. Once more thanks. Theme is closed.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Script-Fu Error] set! function is interpreted as an illegal function image_artist 1 712 Sep 11, 2014 20:54
Last Post: image_artist
  Script-Fu and Drawable error - plug-in-lighting function peliopoulos 1 1,221 Sep 8, 2013 01:05
Last Post: peliopoulos
  Script Fu List of Function alzyee 0 1,110 Aug 30, 2013 15:02
Last Post: alzyee
  returned no return values error drone 2 1,879 May 26, 2012 14:02
Last Post: drone

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS