Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

INT8ARRAY ?

0 views
Skip to first unread message

Johannes Schoon

unread,
Dec 15, 1999, 3:00:00 AM12/15/99
to
Hi all!

I would like to use gimp-curves-explicit in a very simple script-fu.
My problem is that I don't know what an INT8ARRAY looks like in scheme.
(One of the input parameters to gimp-curves-explicit is such an array.)

Yours

Johannes Schoeoen

"master of research under the event horizon"
(No matter how much work you throw in, nothing ever comes out.)
dept. of Naval Architecture and Ocean Engineering
Chalmers University of Technology, Gothenburg, Sweden

Sven Neumann

unread,
Dec 15, 1999, 3:00:00 AM12/15/99
to
Johannes Schoon <sch...@na.chalmers.se> wrote:

: I would like to use gimp-curves-explicit in a very simple script-fu.


: My problem is that I don't know what an INT8ARRAY looks like in scheme.
: (One of the input parameters to gimp-curves-explicit is such an array.)

Just a quick guess: It's a scheme list? In other words, try:

'(x1 y1 x2 y2 x3 y3 x4 y4)


Salut, Sven

Simon Budig

unread,
Dec 15, 1999, 3:00:00 AM12/15/99
to

Hmm - AFAIK not. At least you can adress elements of an array via
(aref (cadr (gimp-list-images)) 1)

I dont know how to create a new array. Maybe "(bytes-append x1 x2 ...)"
is the solution?
=> (bytes-append "A" "B" "C")
#3"414243"

looks quite good...

(SIOD reference is at http://people.delphi.com/gjc/siod.html)

Bye,
Simon

--
Simon...@unix-ag.org http://www.home.unix-ag.org/simon/

Sven Neumann

unread,
Dec 15, 1999, 3:00:00 AM12/15/99
to
Simon Budig <Simon...@unix-ag.org> wrote:

:> Just a quick guess: It's a scheme list? In other words, try:

:> '(x1 y1 x2 y2 x3 y3 x4 y4)

: Hmm - AFAIK not. At least you can adress elements of an array via
: (aref (cadr (gimp-list-images)) 1)

: I dont know how to create a new array. Maybe "(bytes-append x1 x2 ...)"
: is the solution?
: => (bytes-append "A" "B" "C")
: #3"414243"

: looks quite good...

Yep, I looked into the script-fu sources and Simons suggestion should indeed
work as expected.


Salut, Sven

Johannes Schoon

unread,
Dec 15, 1999, 3:00:00 AM12/15/99
to
Johannes Schoon wrote:

> I would like to use gimp-curves-explicit in a very simple script-fu.
> My problem is that I don't know what an INT8ARRAY looks like in scheme.
> (One of the input parameters to gimp-curves-explicit is such an array.)

I still don't know what an INT8ARRAY is, but I made gimp-curves-explicit
to work like this:

(let* (
(string (string-append
"ffffffffffffffffffffffffffffffffffffffffffffffffff"
"ffffffffffffffff0000000000000000000000000000000000"
"0000000000000000ffffffffffffffffffffffffffffffffff"
"ffffffffffffffffffffffffffffffffffffffffffffffffff"
"ffffffffffffffff0000000000000000000000000000000000"
"0000000000000000ffffffffffffffffffffffffffffffffff"
"ffffffffffffffffffffffffffffffffffffffffffffffffff"
"ffffffffffffffffffffffffffffffffffffffffffffffffff"
"ffffffffffffffffffffffffffffffffffffffffffffffffff"
"ffffffffffffffffffffffffffffffffffffffffffffffffff"
"ffffffffffff"))

(the_int8_array (hexstr->bytes string)) )


(gimp-convert-grayscale img)
(gimp-curves-explicit img drawable 0 256 the_int8_array)


It produces a picture where two narrow regions of the greyscale are turned

black and the rest is white. OK, I'm sure one could have done this by
creating an extra layer, using threshold slightly differently on the two
layers, then combining the two layers with suitable transparencies.

That, however, is far to clever for me, so this will have to do instead
:-)

Sven Neumann

unread,
Dec 16, 1999, 3:00:00 AM12/16/99
to
Johannes Schoon <sch...@na.chalmers.se> wrote:
: Johannes Schoon wrote:

:> I would like to use gimp-curves-explicit in a very simple script-fu.
:> My problem is that I don't know what an INT8ARRAY looks like in scheme.
:> (One of the input parameters to gimp-curves-explicit is such an array.)

: I still don't know what an INT8ARRAY is, but I made gimp-curves-explicit
: to work like this:

Oh, I didn't realize that this is your problem... Probably hacking C all day
makes you think everyone would now what an int8array is. Well, it's a
datastructure representing a list of integers, where each integer has a
length of 8 bit. An 8 bit (unsigned) integer is more or less the same as a
character (at least for a computer), so you can also access this array as a
string, which is what you did...


Salut, Sven

0 new messages