It is currently Sun Jul 21, 2024 6:25 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: problem with list
PostPosted: Sun Jul 13, 2014 12:31 pm  (#1) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4039
Location: Canada
I am trying to write a simple script to automate conbagui's paisley text tutorial.
I am stuck on this call to python-layer-fx-stroke
it said that instead of color i can use a list for a gradient stroke.
I have tried to put the '() inside instead of defining l first. and nothing seems to work.
it's giving me Error: ( : 1) Invalid type for argument 4 to python-layer-fx-stroke


        (define l '(stroke-gradient 7 0 0 0 (* (/ 450.0 1000) image-height) 90 100))
   (python-layer-fx-stroke 1 image layer
                           l
                           100 ;opacity
                           0 ;mode 0-normal
                           5  ;size
                           50  ;position
                           FALSE  ;merge with layer
   )


anyone used this function and successfully used list that defines gradient before? please help. Thanks in advance!

_________________
TinT


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: problem with list
PostPosted: Sun Jul 13, 2014 1:20 pm  (#2) 
Offline
GimpChat Member

Joined: May 23, 2012
Posts: 150
tin

i was reading saulgoode, roba, and mavhin's discussion on flatten-multifill

here is the link viewtopic.php?f=8&t=1221&start=80

they had to make a list all gradeint in directory

see if this helpful


Top
 Post subject: Re: problem with list
PostPosted: Sun Jul 13, 2014 2:47 pm  (#3) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
(define l '(stroke-gradient 7 0 0 0 (* (/ 450.0 1000) image-height) 90 100))

The above code defines l as the literal list supplied; in other words, no part of the list gets evaluated. image-height does not get resolved to a number (it remains a symbol), nor are the multiplication and division performed.

If you want those elements of the list to be evaluated then you should use (list <...>), and quote the symbol stroke-gradient so it does not get evaluated.

(define l (list 'stroke-gradient 7 0 0 0 (* (/ 450.0 1000) image-height) 90 100))

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: problem with list
PostPosted: Sun Jul 13, 2014 3:06 pm  (#4) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4039
Location: Canada
I tried
(define l (list 'stroke-gradient 7 0 0 0 (* (/ 450.0 1000) image-height) 90 100))

and i tried this as well since stroke-gradient is a variable that holds value "2Gold" and took out the math to see if it passes.
(define l (list stroke-gradient 7 0 0 0 450 90 100))

but it still gave me the same error.

here's the definition for the color field in this function:
The stroke color. This can also be a list or tuple to use gradients or patterns. For a gradient stroke, use a list or tuple of the form (gradient_name, gradient_type, repeat, reverse, center_x, center_y, angle, width). For a patterned stroke, use the form (pattern_name, scale, interpolation_type).

I am using gradient so it expects a list of 8 items, i have a list of 8 items and it's still complaining about Error: ( : 1) Invalid type for argument 4 to python-layer-fx-stroke

It must be something so simple but i am just not seeing it.

I am thinking maybe i'll use tuple instead of list but i don't know how to construct tuples either. :(

_________________
TinT


Top
 Post subject: Re: problem with list
PostPosted: Sun Jul 13, 2014 4:31 pm  (#5) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
The python-layer-fx-stroke function is registered with the fourth argument declared as a PDB_COLOR. A PDB color is a 32-bit integer (actually, 24-bit but the other eight bits are ignored).

It is not possible to pass a string or a list directly through the PDB -- at least not as a parameter that is specified to be a PDB_COLOR. Script-fu accepts color arguments comprising either a string containing a CSS color name or a list of the red, green and blue component values; however, in both cases the Script-fu interpreter converts the argument to the 24-bit integer that the PDB expects. (N.B., when a PDB_COLOR is returned to Script-fu, the 24-bit color received from the PDB is converted to a list of the three color component values.)

I try not to get too near to Python, but I suspect that the python-layer-fx-stroke function is implemented in such a manner that strings and lists can be passed to it when called directly from within a Python plug-in (and are treated specially to handle the case of gradients or patterns), but when invoked from Script-fu, Perl, C, or other languages depending upon the PDB interface, only the PDB_COLOR (24-bit integer) option is available.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: problem with list
PostPosted: Sun Jul 13, 2014 4:48 pm  (#6) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4039
Location: Canada
well that's not good.

_________________
TinT


Top
 Post subject: Re: problem with list
PostPosted: Sun Jul 13, 2014 5:05 pm  (#7) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
To get a gradient stroke, you could fill with gradient, shrink by stroke width, then clear.

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: problem with list
PostPosted: Sun Jul 13, 2014 5:44 pm  (#8) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4039
Location: Canada
I tried gradient fill with the same gradient, and tried gradient overlay as well with the same gradient but the result is different it's grayish or something like that but definitely not gold like step 6 of the paisley tutorial.

_________________
TinT


Top
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts How to find a list of enums?

5



* Login  



Powered by phpBB3 © phpBB Group