[Gimp-developer] Endianness bug in tiff plugin

2004-07-11 Thread Brion Vibber
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
When loading a CMYK TIFF (and perhaps other funky kinds of TIFF), the
tiff plugin uses a fallback mode that fills a buffer using
TIFFReadRGBAImage(). This is a uint32 array, and the byte layout of the
pixels ends up wrong on a big-endian host such as my PowerBook.
I've posted a test case and patch on bugzilla:
http://bugzilla.gnome.org/show_bug.cgi?id=147328
Patch is also attached here; it works on my Mac and doesn't seem to
break things on my Linux PC. (HACKING suggests both posting here and
bugzilla; I apologize if I'm being overly rude in this.)
The bug affects at least 2.0.x release versions and current CVS.
- -- brion vibber (brion @ pobox.com)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFA8OXSwRnhpk1wk44RAjtEAJ9zCO+R0NIZuF2nq82kThnKQVWkuQCg04zo
nU46gRCBgkWy7FBsFDGc7L4=
=61/D
-END PGP SIGNATURE-
Index: tiff.c
===
RCS file: /cvs/gnome/gimp/plug-ins/common/tiff.c,v
retrieving revision 1.100
diff -u -r1.100 tiff.c
--- tiff.c  5 Jun 2004 10:27:47 -   1.100
+++ tiff.c  11 Jul 2004 06:22:09 -
@@ -981,6 +981,12 @@
 
   for (row = 0; row  imageLength; ++row)
 {
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+  /* Make sure our channels are in the right order */
+  uint32 i;
+  for (i = 0; i  imageWidth; i++)
+buffer[i + row * imageWidth] = GUINT32_TO_LE (buffer[i + row * imageWidth]);
+#endif
   gimp_pixel_rgn_set_rect ((channel[0].pixel_rgn),
channel[0].pixels + row * imageWidth * 4,
0, imageLength -row -1, imageWidth, 1);
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer


[Gimp-developer] tiff save dialog cosmetic fix

2004-07-11 Thread Brion Vibber
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
While I was playing with the tiff plugin, I fixed it to disable the
'Save color values from transparent pixels' box when saving an image
with no alpha channel, as the png plugin does. The option has no effect
without alpha.
Patch attached.
- -- brion vibber (brion @ pobox.com)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFA8PX7wRnhpk1wk44RAmzeAKCYtsM7Bvuv8HIAqLIgL90yuta1hgCfdw/x
cbyYmGinGoJEAiA7myJuwkk=
=FVV4
-END PGP SIGNATURE-
--- gimp/plug-ins/common/tiff.c-cmyk2004-07-10 23:21:01.0 -0700
+++ gimp/plug-ins/common/tiff.c 2004-07-11 01:06:45.0 -0700
@@ -142,7 +142,7 @@
  gint32   drawable,
  gint32   orig_image);
 
-static gboolean  save_dialog(void);
+static gboolean  save_dialog(gboolean alpha);
 
 static void  comment_entry_callback (GtkWidget   *widget,
  gpointer data);
@@ -354,7 +354,7 @@
   gimp_parasite_free (parasite);
 
   /*  First acquire information with a dialog  */
-  if (! save_dialog ())
+  if (! save_dialog (gimp_drawable_has_alpha (drawable)))
 status = GIMP_PDB_CANCEL;
   break;
 
@@ -2082,7 +2082,7 @@
 }
 
 static gboolean
-save_dialog (void)
+save_dialog (gboolean alpha)
 {
   GtkWidget *dlg;
   GtkWidget *vbox;
@@ -2126,7 +2126,8 @@
   toggle = gtk_check_button_new_with_mnemonic
 ( _(Save _color values from transparent pixels));
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
-tsvals.save_transp_pixels);
+alpha  tsvals.save_transp_pixels);
+  gtk_widget_set_sensitive (toggle, alpha);
   gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
   gtk_widget_show (toggle);
 
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer


[Gimp-developer] New feature inquiry.

2004-07-11 Thread Fredrik Alstromer
Hi all!
I've had this idea going around my head for a while, and I was just 
going to ask if someone already had this idea (most probably), and if 
any work has been done or planned regarding this. I haven't been 
monitoring this list for very long, so this might be an old and already 
discarded idea. If that's the case, I apologize, and will withdraw to 
the rock from under which I came.. :)

The idea has been inspired by photoshop's effect layers, and the basic 
concept would be plugins that registers a new layer type. When sampled, 
the plugin is more or less simply executed, and the results are cached 
until any layer below the programmable layer has been modified. Layer 
modes and opacity are applied as if it was a normal layer, along with 
any layer mask.

Im not really familiar with the gimp source, and have mostly been doing 
script-fu stuff up until now. Perhaps this could be accomplished using a 
plugin? Or maybe it needs to be done in the core gimp source.

Does any one have any ideas or suggestions, as to why this might or 
might not work? Or possibly better solutions?

Thanks for your time.
--
Fredrik Alstromer.
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer


Re: [Gimp-developer] New feature inquiry.

2004-07-11 Thread Simon Budig
Fredrik Alstromer ([EMAIL PROTECTED]) wrote:
 The idea has been inspired by photoshop's effect layers, and the basic 
 concept would be plugins that registers a new layer type. When sampled, 
 the plugin is more or less simply executed, and the results are cached 
 until any layer below the programmable layer has been modified. Layer 
 modes and opacity are applied as if it was a normal layer, along with 
 any layer mask.

Ideas similiar to this are floating around for quite a while now.
In the meantime there is a pretty clear proposal on how to implement
this. You may want to research about GEGL for more information.

I am not familiar with GEGL but I think dynamically adding new effect
layers was on the list of stuff that should be possible.

 Im not really familiar with the gimp source, and have mostly been doing 
 script-fu stuff up until now. Perhaps this could be accomplished using a 
 plugin? Or maybe it needs to be done in the core gimp source.

It definitely needs a new infrastructure - and there are lots of other
reasons to exchange the current infrastructure. GEGL is supposed to
solve the other problems as well.

Bye,
Simon

-- 
  [EMAIL PROTECTED]  http://simon.budig.de/
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer