Re: [Gimp-developer] Gimp - prolog interface

2009-12-08 Thread Tor Lillqvist
 Thanks, I believe Python is the solution I was looking for.

But if you really wanted to use Prolog, surely Python is quite far
from that? Or is there some extension or whatever to Python that
allows one to write Prolog-like clauses, a Python-hosted Prolog in a
way?

(Apparently, yes, there are several, see for instance
http://code.activestate.com/recipes/303057/ ,
http://christophe.delord.free.fr/pylog/index.html and and
http://codespeak.net/pypy/extradoc/paper/prolog-in-python.pdf )

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


Re: [Gimp-developer] Gimp - prolog interface

2009-12-07 Thread Ryan Eisele
js,  

Thanks, I believe Python is the solution I was looking for.

- Ryan

--- On Thu, 12/3/09, Joao S. O. Bueno gwid...@mpc.com.br wrote:

From: Joao S. O. Bueno gwid...@mpc.com.br
Subject: Re: [Gimp-developer] Gimp - prolog interface
To: Ryan Eisele ryaneisele...@yahoo.com
Cc: gimp-developer@lists.xcf.berkeley.edu
Date: Thursday, December 3, 2009, 1:15 PM

Hi Ryan -

I strongly suggest you learn python instead, and us it for your
scripts, instead.

It attends eveeryone of yoru requisites:
- no dealing with pointers or memory allocation/deallocation
- gimp data structures are provided as high level objects
- the language syntax even allows for a funciotnal-like programing if
you prefer that.

(for example to interact through layers, you just do:
image = gimp.list_images()[0]
for layer in image.layers:
    #your code dealing with the layer object

When you get to the pixels you have then as a byte sequence, you then
convert to a bytearray (python 2.6)  - to get all the green bytes for
the pixels from such an array on a separate array, I could do:

green =[1::4]

Follow the tutorial in www.python.org docs, you could get proficient
in the language in less than 1 hour - then check the pythons cripts
that come with gimp for examples of the API use and pixel access.


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


Re: [Gimp-developer] Gimp - prolog interface

2009-12-03 Thread Torsten Neuer
Hi Ryan,

 I want to write some plug-ins in Prolog.
[...]
 
 I want to be able to deal with the input and output in the form of a Prolog
[...]
 Preferring to work in Prolog I need some help from a C programmer to write
  this plug-in.  I'd appreciate any help from someone who has written a
  plug-in before.

You want quite a lot and you will probably also need to do quite a lot of stuff 
you do not want. :-)

But your idea seems interesting (at least to me, although I'm not very fond of 
functional languages such as Prolog - I'm more the imperative type).

Some thoughts you should deal with in the first place:
- Are the plug-ins you want to do in Prolog to be compiled or interpreted ?
- Which would be the Prolog compiler / interpreter to use for that project ?

If the plug-ins are to be compiled, you would only need to write an 
interface library that provides the binding to the gimp / gtk+ libraries.
In this case, the plug-in template which you can find at the gimp developer's 
site will probably point you in the right direction (together with the 
documentation of the compiler, which should be able to interface to the C 
language, e.g. gprolog).

If it is going to stay in script form (i.e. will be interpreted), the thing 
would more or less go into the direction of python-fu / perl-fu (which also 
should give you an idea of what you need to do with the Prolog interpreter you 
want to use for the project; just have a look at the sources for these two 
plug-ins).


  Torsten


signature.asc
Description: This is a digitally signed message part.
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Gimp - prolog interface

2009-12-03 Thread Joao S. O. Bueno
Hi Ryan -

I strongly suggest you learn python instead, and us it for your
scripts, instead.

It attends eveeryone of yoru requisites:
- no dealing with pointers or memory allocation/deallocation
- gimp data structures are provided as high level objects
- the language syntax even allows for a funciotnal-like programing if
you prefer that.

(for example to interact through layers, you just do:
image = gimp.list_images()[0]
for layer in image.layers:
#your code dealing with the layer object

When you get to the pixels you have then as a byte sequence, you then
convert to a bytearray (python 2.6)  - to get all the green bytes for
the pixels from such an array on a separate array, I could do:

green =[1::4]

Follow the tutorial in www.python.org docs, you could get proficient
in the language in less than 1 hour - then check the pythons cripts
that come with gimp for examples of the API use and pixel access.


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