ruby-****@sourc*****
ruby-****@sourc*****
2013年 3月 20日 (水) 01:56:32 JST
------------------------- REMOTE_ADDR = 184.145.81.215 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-agtkw-draww ------------------------- @@ -62,7 +62,7 @@ The following example program (drawingareas.rb) implements a simple drawing program using the Gtk::DrawingArea widget. Points will be drawn on the screen when the user clicks a mouse button and when the pointer is dragged while the button is clicked. -The current content of the drawing area's Gdk::Window is cleared when the user presses the Delete key. {{image_right("dialog-warning.png")}} But if the "+" key is pressed, the program demonstrate Gdk::Drawable drawing methods. However, there is a problem with this last feature, namely it is lost as soon as the ((*expose_event*)) is emitted. While this is very simple program, it nonetheless shows how to interact with the Gtk::DrawingArea widget and use events with it. +The current content of the drawing area's Gdk::Window is cleared when the user presses the Delete key. {{image_right("dialog-warning.png")}} But if the "+" key is pressed, the program demonstrates how Gdk::Drawable drawing methods can be used to generate images of geometric shapes. However, there is a problem with this last feature, namely the generated geometric shapes are lost as soon as window is moved or resized, i.e. when the((*expose_event*))is emitted causing it to be refreshed (redrawn or repainted). While this is very simple program, it nonetheless shows how to interact with the Gtk::DrawingArea widget and use events with it. Creating a drawing area is a no brainier, however, preparing the new drawing area to catch events needs to be mentioned. You accomplish this with the Gtk::Widget#add_events instance methods, and you assemble the signals to be monitored for by or(ing) together Gdk::Event mask values (((<GdkEventMask|Gdk::Event#GdkEventMask>))). Another interesting thing is how to monitor for different key strokes. You are comparing Gdk::EventKey's keyval property to Gdk::Keyval constants (see: ((<GdkKeyvals|Gdk::Keyval#GdkKeyvals>))). @@ -198,7 +198,5 @@ When we draw our lines we add four additional points around the original (x,y) position, which has a line thickening effect. {{image_right("dialog-warning.png")}} All in all, this program shows some serious drawbacks in the way vector graphic is implemented in GTK+. I do believe that GTK+ flaws in this area and even more so in GTK+ Ruby implementation, are one of major disadvantages of GTK+ system in general and perhaps the main reason that GTK+ has never become what it deserves to be! - -It is true, that Cairo graphic is supposed to address and solve most of these vector graphic issues and major flaws that plague GTK+, but I also believe, that native GTK+ handling of vector graphics should be fixed regardless of how well Cairo graphics will be adopted and implemented.