Re: dynamic mixing of primitives and background picture - semi-gui cropping utility



Thanks for the input.

Any pointer on how to do the "in app" drawing? 

Also, is there a way to make the window scroll automatically to the 
appropriate corner of the image when the keys 1-4 are pressed. 
It'd be nice to have that when viewing the full-size picture.

Guillaume

On Wednesday 11 November 2009 02:41:57 muppet wrote:
You forgot "use strict"!


Instead of hard-coded numeric key values, you should use the keysyms
hash.

use Gtk2::Gdk::Keysyms;

...

    if ($key_val == $Gtk2::Gdk::Keysyms{GDK_Up}) {

etc

(Or mess around with an accelerator table.  For what you have, the key
value processing is probably nice and user-friendly, as it requires no
modifier keys.)


Instead of connecting to delete-event to quit the main loop, do that
in the destroy signal on the window.  Then you can add "q" as a
hotkey, and just call $window->destroy and the right thing will happen.



In auto_crop(), should check $color for an empty value; i loaded up a
jpeg that didn't have a border, and imagemagic returned no border for
it, causing a bunch of uninitialized value warnings.

Oh, actually my imagemagick is too old to support the special info:
name.  You might want to do a version check on convert before doing
that stuff.


If you want to learn about gdk, you can try to do the drawing all in
the app instead of bouncing back and forth with imagemagick.  You
could also take the slow route and draw on the pixels in perl, but
that's a bit icky.


--
It's all very complicated and would take a scientist to explain it.
   -- MST3K




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]