RSS/Atom feed Twitter
Site is read-only, email is disabled

SF-TOGGLE type?

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

SF-TOGGLE type? Rob Antonishen 17 Dec 16:01
  SF-TOGGLE type? saulgoode@flashingtwelve.brickfilms.com 17 Dec 18:44
   SF-TOGGLE type? Pablo Yaggi 17 Dec 18:56
Rob Antonishen
2008-12-17 16:01:50 UTC (about 16 years ago)

SF-TOGGLE type?

Should SF-TOGGLE be evaluated as a boolean or int in a scheme script?

I have been using (if (= inToggle TRUE) (do-true) (do-false)) where inToggle is a toggle (check box) parameter,

Because (if inToggle (do-true) (do-false)) always returns as true.

-Rob A.

On 12/17/08, Pablo Yaggi wrote:

Working with gimp 2.6 this segment of codes

(if (= (car (gimp-drawable-is-rgb image)) FALSE) (gimp-image-convert-rgb image) )

gives me this error

Error while executing script-fu-mirror-table:

Error: Procedure execution of gimp-image-convert-rgb failed on invalid input arguments: Image 'file:///home/pablo/glam.jpg' (1) is already of
type 'rgb'

Bests,
Pablo

(Martin told me my font was too small, is it right now ? )

saulgoode@flashingtwelve.brickfilms.com
2008-12-17 18:44:12 UTC (about 16 years ago)

SF-TOGGLE type?

You have been using TRUE and FALSE correctly. The problem with Pablo's script is that he passing the 'image' variable to 'gimp-drawable-is-rgb'. Presumably his script does not generate an error because he is executing his script on the first image he opened thus the imageID is "1" -- which happens to be the drawableID for GIMP's selection mask. Therefore, since the selection mask is a grayscale drawable, 'gimp-drawable-is-rgb' returns FALSE even though his image may be RGB.

To Pablo, if you wish to determine the mode of your image, I would recommend using 'gimp-image-base-type' and pass it the imageID. If you use 'gimp-drawable-is-foo' then be sure that the drawableID which you pass to it is the correct one.

As further background about these booleans, Script-fu's TRUE and FALSE values do not correspond to Scheme's #t and #f booleans. TRUE and FALSE are integer constants ("1" and "0" respectively). In point of fact, FALSE (the integer "0") will be treated as #t (boolean true) by any Script-fu testing it directly.

There WAS a change in the transition from SIOD (in GIMP 2.4), however, the change was that SIOD treated the empty list as boolean false; whereas in TinyScheme (and all other R5RS Schemes) everything except #f (boolean false) is considered to be #t (boolean true).

Quoting Rob Antonishen :

Should SF-TOGGLE be evaluated as a boolean or int in a scheme script?

I have been using (if (= inToggle TRUE) (do-true) (do-false)) where inToggle is a toggle (check box) parameter,

Because (if inToggle (do-true) (do-false)) always returns as true.

-Rob A.

On 12/17/08, Pablo Yaggi wrote:

Working with gimp 2.6 this segment of codes

(if (= (car (gimp-drawable-is-rgb image)) FALSE) (gimp-image-convert-rgb image) )

gives me this error

Error while executing script-fu-mirror-table:

Error: Procedure execution of gimp-image-convert-rgb failed on invalid input arguments: Image 'file:///home/pablo/glam.jpg' (1) is already of
type 'rgb'

Bests,
Pablo

(Martin told me my font was too small, is it right now ? )

Pablo Yaggi
2008-12-17 18:56:50 UTC (about 16 years ago)

SF-TOGGLE type?

Thank's a lot, I fixed it getting the active-layer for the image and passing it to -is-rgb.

On Wednesday 17 December 2008 15:44:12 saulgoode@flashingtwelve.brickfilms.com wrote:

You have been using TRUE and FALSE correctly. The problem with Pablo's script is that he passing the 'image' variable to 'gimp-drawable-is-rgb'. Presumably his script does not generate an error because he is executing his script on the first image he opened thus the imageID is "1" -- which happens to be the drawableID for GIMP's selection mask. Therefore, since the selection mask is a grayscale drawable, 'gimp-drawable-is-rgb' returns FALSE even though his image may be RGB.

To Pablo, if you wish to determine the mode of your image, I would recommend using 'gimp-image-base-type' and pass it the imageID. If you use 'gimp-drawable-is-foo' then be sure that the drawableID which you pass to it is the correct one.

As further background about these booleans, Script-fu's TRUE and FALSE values do not correspond to Scheme's #t and #f booleans. TRUE and FALSE are integer constants ("1" and "0" respectively). In point of fact, FALSE (the integer "0") will be treated as #t (boolean true) by any Script-fu testing it directly.

There WAS a change in the transition from SIOD (in GIMP 2.4), however, the change was that SIOD treated the empty list as boolean false; whereas in TinyScheme (and all other R5RS Schemes) everything except #f (boolean false) is considered to be #t (boolean true).

Quoting Rob Antonishen :

Should SF-TOGGLE be evaluated as a boolean or int in a scheme script?

I have been using (if (= inToggle TRUE) (do-true) (do-false)) where inToggle is a toggle (check box) parameter,

Because (if inToggle (do-true) (do-false)) always returns as true.

-Rob A.

On 12/17/08, Pablo Yaggi wrote:

Working with gimp 2.6 this segment of codes

(if (= (car (gimp-drawable-is-rgb image)) FALSE) (gimp-image-convert-rgb image) )

gives me this error

Error while executing script-fu-mirror-table:

Error: Procedure execution of gimp-image-convert-rgb failed on invalid input arguments: Image 'file:///home/pablo/glam.jpg' (1) is already of
type 'rgb'

Bests,
Pablo

(Martin told me my font was too small, is it right now ? )