On Wednesday 24 August 2005 15:48, michael chang wrote:
> On 8/23/05, woc <[EMAIL PROTECTED]> wrote:
> > I do not want to write a .c plugin, because portability is more
> > important to me than speed.
> Gimp itself is written in some variant of C, isn't it?

Right. ANSI C 89' with some extensions that are common enough to rely on.

> The only "portability" issue here is that you'd need to compile it on
> all target OS's.  No big deal -- that's how GIMP is made anyways.  Use
> MinGW for Windows, and Linux uses the GCC and related tools.  Easy
> enough.


> Script-Fu only has the "advantage" of not requiring compilation before
> execution, but it doesn't handle Raw IO or pixel-based image creation
> IIRC (for good reason, too, proally).

You can theoretically draw on an image using a 1*1 pixels brush. But this 
would be very slow.

> Perl probably has similar limitations, to a certain extent.  Perl
> handles text best -- binary data, it's best at simply passing... I
> believe the term is ad verbatim or something.

While Perl has many facilities for handling text very well, it does not have 
any limitations with handling binary data. It can easily segment such data, 
convert it from ASCII to binary, generate it, etc. Perl strings can contain 
\0 characters, and thus can represent binary data. Several functions in the 
perlfunc man page can be used to manipulate binary data (like pack() and 
unpack()), and often text-oriented functions that are operated on binary data 
will also work. A similar functionality should be available for programming 
languages that are similar to Perl.

The main problem with using Perl for this job is that processing thousands or 
millions of Pixels in Perl may be considerably slower than in C, due to the 
fact executing expressions, conditionals and loops in Perl has much more 
speed overhead over their C counterparts. Thus, it is recommended to write an 
image loader in C.

But handling binary data alone is not the problem here. It is not harder in 
Perl than in C, albeit may be (like many other tasks) slower.


        Shlomi Fish

Shlomi Fish      [EMAIL PROTECTED]
Homepage:        http://www.shlomifish.org/

Tcl is LISP on drugs. Using strings instead of S-expressions for closures
is Evil with one of those gigantic E's you can find at the beginning of 
Gimp-developer mailing list

Reply via email to