GNOME Bugzilla – Bug 142587
Solid Noise has no preview
Last modified: 2004-06-05 10:54:21 UTC
Run the plug-in and look for a preview. [A patch is going to be attached.]
Created attachment 27738 [details] [review] A suggested patch. This time I even expect the patch to be frowned at -- it uses a plain GdkPixbuf in a GtkImage as a preview as I don't what the Right method of doing previews is now (I'm willing to rewrite it, but not to anything with `Old' in name...)
We can always revert the `Old' back to `FixMe' ;) But more seriously: GdkPixbuf and GtkImage are probaby the right objects to use. The general plug-in preview widget is probably not going to happen for 2.2, so adding previews to existing plug-ins is from a users standpoint of view a good thing. Haven't looked at your patch yet, but does the preview also work correctly for images with an alpha channel? Second question: is there any chance of putting your work in a real widget? There have been a few efforts to do so in the past, but I think they tried to solve to many things (like zooming) at once. Would be nice to have a simple preview that might only work for 50 % of the plug-ins, but at least it would be usable and easy to replace with something more advanced later.
Solid Noise always renders a new fully opaque drawable so I can't see how an alpha channel could sneak in. This also means the preview implementation is _very_ minimal, there's probably nothing to reuse elsewhere there. Regarding a new Gimp preview widget, it's IMHO more a political problem now than a coding one, and thus I'd be doomed to fail (a rough functional equivalent of GimpOldPreview based on GdkPixbuf[s] is so easy to do that it would be definitely done long ago if it was really the problem), sorry.
Oops, sorry. You're right, solid noise only renders. I was confusing it with the spread plug-in. So displaying alpha is not an issue. I don't think that there's a political problem, unless I'm missing something. Only problem I've seen in the past is that people (including myself) tried to create a preview widget that worked for all plug-ins. My advise would be to start with a simple (no zooming, scrolling, etc.) preview widget that works for a few plug-ins and then continue from there. In other words: taking very small steps.
Well, if I find time to add previews to a few more plug-ins (a thing floating in a indiferent position in my TODO), I can try to extract what I want from a preview to a widget then. But don't hold your breath, there's really `if' not `when'...
I don't think that GdkPixbuf and GtkImage are suited for a preview widget. If we want to avoid GtkPreview, then the widget to use is either GtkDrawingArea or preferably a custom widget that does all the drawing. Let me know if you need help with this. For example it would be simple to give you a basic widget that renders a buffer to the screen, optionally over a checkerboard pattern.
OK, back to reality. Is the attached patch acceptable for 2.2? It doesn't try to implement new preview widget, it simply uses GtkImage as the preview widget because it's functionality is sufficient [here].
I don't see any advantage in using a GdkPixbuf and it strikes me wrong to introduce yet another way of drawing previews. That will make it more difficult to port to a preview widget when one is introduced. In general the patch is probably OK (except that it doesn't conform with the new dialog layout but that's easy to change).
The advantage of the approach is that it doesn't depend on what the current Gimp preview widget is and how is it called today... I just copied it from my other plug-ins where I've been using this tactics with success since GtkPreview was deprecated... and as I said I'm willing to rewrite once there is something definitive to rewrite it to. The dialog layout is a shame, but I don't have clear idea how a HIGification should actually look (don't have resources to follow gimp CVS). Well, the question was yes or no, the answer was but, and the discussion already took more labour than the code, which is itself trivial. I'm putting this to sleep, I'm happy I have Solid Noise with a preview, and I'm sorry for wasting your time. Maybe in some better time...
Oh, come on. There are several patches that add plug-in previews waiting for inclusion into CVS. They will all make it into CVS before the 2.2 feature freeze. But before they are applied it would make sense to settle on a single preview widget. I have already suggested how a simple widget and expressed my interest to hack it myself if noone else wants to do it. You really have no reason to be pissed.
That should read "I have already suggested how a simple widget could look like", meaning what functionality and API it should have.
I'm really not pissed. It just seems I'm currently not the right man for the job of adding previews to plug-ins as I don't follow Gimp developmen very closely. You could probably add the preview twice in the same time that takes/would take correcting mine and discussing with me.
I have now brought up the issue on gimp-developer. Give us a few days to come to a conclusion here.
I had to do quite some cleanups but didn't change the way the preview is drawn. Applied to CVS HEAD: 2004-06-05 Sven Neumann <sven@gimp.org> * plug-ins/common/snoise.c: applied a modifed patch from Yeti that adds a preview to the Solid Noise plug-in (bug #142587).