Gimptalk - Premier Gimp Community: GIMP Path (vector) Scripts - Beta 0.5 release - Gimptalk - Premier Gimp Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

GIMP Path (vector) Scripts - Beta 0.5 release

#1 User is offline   LIMN 

  • Member
  • PipPip
  • Group: Members
  • Posts: 108
  • Joined: 21-August 07

Posted 23 March 2008 - 10:12 AM

Here is a beta 0.6 release of my paths
http://www.mediafire.com/?jzmre45q1oi
Bugfixes for this version
Spiral error fixed in version

Tutorial number 1 ready!
http://lightningismy...torial-80785093
More Tips, Tricks and handy ways of using them will be posted soon!

-----

Why beta? They are probably a bit buggy (although it worked fine for me), should take some time to fix. Another reason is that the pack isn't complete yet, there should be 3 more scripts.

-----
Scripts Review:

actions 1 to 3 will depend on existing paths
actions 4 to 9 will create new paths


1. Split to strokes
Location - paths dialog, right click on a path
What does it do - Take an active path and create a new path from each of it's strokes (doesn't delete the source)

2. Selection - Stroke sum
Location - paths dialog, right click on a path
What does it do - make a selection from the sum of the selection of the strokes, not from the difference like the normal way
Posted Image

3. Polygonize
Location - paths dialog, right click on a path
What does it do - remove all curves from a path to make a polygon using it's anchors
Posted Image

4. Polygon
Location - Image window, Shape menu
What does it do - draw a polygon with the specified amount of sides (all lines will have equal length and all angles will be the same) and with a specified radius
has some filling/stroking options
Posted Image

5. Polygon Star
Location - Image window, Shape menu
What does it do - draw a polygonal star with the specified amount of sides (all lines will have equal length and all angles will be the same), with a specified radius for the inner part and a specified radius for the outer part
has some filling/stroking options
Posted Image

6. Golden Spiral
Location - Image window, Shape menu
What does it do - draw the golden spiral (A spiral with the golden ratio)

7. Spiral
Location - Image window, Shape menu
What does it do - draw a spiral

8. Ellipse
Location - Image window, Shape menu
What does it do - draw an elliptical path with the desired width/height

9. Duplicate and rotate path
Location - Image window, Shape menu
What does it do - duplicate the active path a specified number of times and rotates it to create a circle
Posted Image
0

#2 User is offline   PhotoComix 

  • GT Senior Moderator
  • Group: Senior Moderators
  • Posts: 11,256
  • Joined: 13-June 05

Posted 23 March 2008 - 11:39 AM

seems cool i'm going to try them
0

#3 User is offline   LIMN 

  • Member
  • PipPip
  • Group: Members
  • Posts: 108
  • Joined: 21-August 07

Posted 23 March 2008 - 04:45 PM

Tutorial number 1 ready!
http://lightningismy...torial-80785093
0

#4 User is offline   curly haired boy 

  • GT Moderator
  • Group: Moderators
  • Posts: 3,911
  • Joined: 29-December 05

Posted 23 March 2008 - 07:49 PM

does this work for 2.2?
0

#5 User is offline   LIMN 

  • Member
  • PipPip
  • Group: Members
  • Posts: 108
  • Joined: 21-August 07

Posted 23 March 2008 - 08:36 PM

I don't think so curly - these were written and tested on 2.4...

I can try translating them back to GIMP 2.2 since my brother's computer has 2.2.
It should be ready in the next sevral days
0

#6 User is offline   ccbarr 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 1,692
  • Joined: 23-February 06

Posted 23 March 2008 - 09:23 PM

I received an error for the Spiral script:

Posted Image

I'm using Gimp 2.4.5 on GNU/Linux

Otherwise, all of the other scripts are working fine so far and I'm really loving these!

:h:
0

#7 User is offline   curly haired boy 

  • GT Moderator
  • Group: Moderators
  • Posts: 3,911
  • Joined: 29-December 05

Posted 23 March 2008 - 09:32 PM

if you could, i'd really appreciate it. :)
0

#8 User is offline   LIMN 

  • Member
  • PipPip
  • Group: Members
  • Posts: 108
  • Joined: 21-August 07

Posted 24 March 2008 - 06:06 AM

See the problem in the spiral - here is a bug fix. paste as the contents of the spiral.scm file or just download the new zip from here: http://www.mediafire.com/?jzmre45q1oi
erase the old files and put these in the link above instead

;Draw a spiral
;For the latest version, email me at 



;(add-point-at-end) will add a point at the end of a stroke of a given path
;It will recieve a float-array of 3 points (X and Y - total 6) as Control Anchor Control
;a new stroke will be created and the old one will be delted
;the way to find out the ID of the new stroke is to get the latest stroke of the object

(define (add-point-at-end vectors stroke-id point)

     (let* (

	(point_count (cadr(gimp-vectors-stroke-get-points vectors stroke-id)))
	(points (caddr(gimp-vectors-stroke-get-points vectors stroke-id)))
	(new-points (cons-array (+ 6 point_count) 'double))
	(count 0) (count2 0)
     )
	

	(while (< count point_count)
	(begin

		(aset new-points count (aref points count))

		(set! count (+ 1 count))

	))

	(while (< count2 6)
	(begin
		(aset new-points count (aref point count2))

		(set! count (+ 1 count))
		(set! count2 (+ 1 count2))

	))

	(gimp-vectors-stroke-new-from-points vectors 0 (+ point_count 6) new-points (cadddr(gimp-vectors-stroke-get-points vectors stroke-id)))
	(gimp-vectors-remove-stroke vectors stroke-id)

))

(define (script-fu-spiral2 img segments width)

     (let* (

	(vectors (car(gimp-vectors-new img "Golden Spiral")))
	(x (/ (car(gimp-image-width img)) 2))
	(y (/ (car(gimp-image-height img)) 2))
	(stroke-id 0)
	(start (cons-array 12 'byte))

	(pointx 0)
	(pointy 0)

	(control1x 0) ;parts of the point
	(control1y 0)
	(anchorx 0)
	(anchory 0)
	(point (cons-array 6 'byte))

	(countme width) 

	(count 0)
	(vector_length 8)	;will be used for aref - always the loction of the last anchor X
	
     )

	

	;undo group
	;(gimp-image-undo-group-start img)

	(gimp-image-add-vectors img vectors -1)

	(aset start 0 0)(aset start 1 0)(aset start 2 0)(aset start 3 0)(aset start 4 0)(aset start 5 0)
	(aset start 6 0)(aset start 7 width)(aset start 8 width)(aset start 9 width)(aset start 10 width)(aset start 11 width)

	(set! stroke-id (car(gimp-vectors-stroke-new-from-points vectors 0 12 start FALSE)))

	(gimp-vectors-stroke-translate vectors stroke-id x y)


	(while (< count segments)
	(begin

	(set! countme (+ countme width))

	;I'll need this since the add-point-at-end action (later on the loop) creates a new stroke

	(set! stroke-id (aref (cadr(gimp-vectors-get-strokes vectors)) 0))	;During all the script, this will have only one stroke	

	(gimp-vectors-stroke-rotate vectors stroke-id x y 90)

	;Here I'll get the X and Y of the last points in the stroke

	(set! pointx (aref (caddr(gimp-vectors-stroke-get-points vectors stroke-id)) vector_length) )
	(set! pointy (aref (caddr(gimp-vectors-stroke-get-points vectors stroke-id)) (+ vector_length 1) ) )

	(set! anchorx (+ countme pointx))
	(set! anchory (+ countme pointy))

	(set! control1x pointx)
	(set! control1y anchory)

	(aset point 0 control1x)
	(aset point 1 control1y)
	(aset point 2 anchorx)
	(aset point 3 anchory)
	(aset point 4 anchorx)
	(aset point 5 anchory)

	(add-point-at-end vectors stroke-id point)

	(set! count (+ 1 count))
	(set! vector_length (+ 6 vector_length))

	))

	;end of undo group
	;(gimp-image-undo-group-end img)

	;Refresh View
	(gimp-displays-flush)
))

(script-fu-register
	"script-fu-spiral2"
		"/Shapes/Spiral..."
		"Draw a new spiral"
		"LightningIsMyName (LIMN)"
		"LightningIsMyName (LIMN)"
		"March 2008"
		""
		SF-IMAGE		"Image"	0
		SF-VALUE		"Number of Segments"	"25"
		SF-VALUE		"width"	"25"

)

0

#9 User is offline   ccbarr 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 1,692
  • Joined: 23-February 06

Posted 30 March 2008 - 01:02 AM

Made use of your ellipse and the copy and rotate paths scripts to develop the animation in this link:

http://www.gimptalk....or-30057-1.html

Thank you.

:h:
0

#10 User is offline   LIMN 

  • Member
  • PipPip
  • Group: Members
  • Posts: 108
  • Joined: 21-August 07

Posted 30 March 2008 - 04:13 AM

Nice result ccbar!

Important note:
Final Stable release (1.0) and version for gimp 2.2 will be available during the following week featuring some fractal generating scripts.
0

#11 User is offline   curly haired boy 

  • GT Moderator
  • Group: Moderators
  • Posts: 3,911
  • Joined: 29-December 05

Posted 30 March 2008 - 02:51 PM

sounds good. thanks!
0

#12 User is offline   PhotoComix 

  • GT Senior Moderator
  • Group: Senior Moderators
  • Posts: 11,256
  • Joined: 13-June 05

Posted 31 March 2008 - 01:12 AM

i have some dumb psychological resistance to think in term of numeric xy values (as for chose the center, or width of polygon) when i'm drawing

i mean i can do but i will like even more for new path be automatically centered and based on a simple selection
(ie first user create a circular or squared selection where he like..., then script use the center of selection as the center of the path ,, while the side, or the ray if selection is circular determine the width)

Alexia Death wrote something similar is in the last FX-Foundry pack, but there the shapes are inside but not inscribed in the selection
(and anyway if i'm not wrong in Alexia scripts the polygon are just draw no paths..having as path like in your script is much more handy , even more thank to script 1-2-3-9 that allow to edit quickly the path )

but anyway i like the script and is no so hard visualize a grid or guides to determine the best xy value to be typed to get the center in the right place...is more a psychological resistance then a real issue,

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Is not so hard type the Cartesian coordinates to be used for the path..
.but to make a example is no even so hard type something in a terminal, still if there is something with a GUI that may do the same work i...cought..strictly avoid command line even if result may be quicker.

Similarity is that i clearly see where is a selection, and so my mind has a clear image of the shapes that may be inscribed in that selection, and how they will fit with whatever else is or i plan to add to the the image
while i need a bit more effort to visualize the possible final results if dealing with numeric xy values
0

#13 User is offline   LIMN 

  • Member
  • PipPip
  • Group: Members
  • Posts: 108
  • Joined: 21-August 07

Posted 31 March 2008 - 06:50 AM

it can me modified to take the center of the active selection - shouldn't be to hard to figure how to do this.

I can add this option but it will be done only after my big test tomorrow (why do people put a test on april 1?! that's the silliest date! oh well :D)
0

#14 User is offline   PhotoComix 

  • GT Senior Moderator
  • Group: Senior Moderators
  • Posts: 11,256
  • Joined: 13-June 05

Posted 31 March 2008 - 03:28 PM

Quote

it can me modified to take the center of the active selection - shouldn't be to hard to figure how to do this.


what it may be complex can be get the polygon exactly inscribed in the selection, (take the width of selection as ...uff i forget right word now...well as "width" of polygon, meaning for "width" the double of the distance from the polygon center to 1 of its corner that should be equal to the ray of the circular selection...or to the diagonal in case of square selection )

But that Should be complex only for free, rectangular or elliptic selections, in case of square or circular selection should be no problem...just may be needed a warning in case other kind of selection is active,instead then squared or circular

well is possible that may allow a more intuitive and fun use (well at least for me :l:..but i think others may have similar mental setting )
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic