Re: [Gimp-developer] SF-TOGGLE type?

2008-12-17 Thread Pablo Yaggi
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 saulgo...@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.2) to
 TinyScheme (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 rob.antonis...@gmail.com:
  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 pya...@alsurdelsur.com 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 ? )
 
  ___
  Gimp-developer mailing list
  Gimp-developer@lists.XCF.Berkeley.EDU
  https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

 ___
 Gimp-developer mailing list
 Gimp-developer@lists.XCF.Berkeley.EDU
 https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] SF-TOGGLE type?

2008-12-17 Thread saulgoode
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.2) to  
TinyScheme (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 rob.antonis...@gmail.com:

 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 pya...@alsurdelsur.com 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 ? )

 ___
 Gimp-developer mailing list
 Gimp-developer@lists.XCF.Berkeley.EDU
 https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer




___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer