[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-gtk2-dancr-rbcatut

Zurück zum Archiv-Index

ruby-****@sourc***** ruby-****@sourc*****
2013年 3月 23日 (土) 08:13:26 JST


-------------------------
REMOTE_ADDR = 70.49.48.128
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-dancr-rbcatut
-------------------------
@@ -64,9 +64,51 @@
     This means, providing we use the Gtk/Cairo library version, supporting these backends, we can draw on windows on OSX, Windows, Linux/BSDs as well as that we can use this library to create PNG or JPG image files, PDF files, PostScript files and SVG files. 
 
 {{br}}
+{{br}}
 (12.3.0.1 /continued/){{br}}
 
+The fact that in Ruby, Gtk/Cairo library does not provide functionality to create((*cairo context*))that could exist independently without being tied to an active Gtk Window, requires us to always run programs requiring Cairo functionality within Gtk main-loop. This makes it difficult to replicate the tutorial example code, that do not require Gtk Window and main loop. The best way to emulate the program examples from these tutorials is to provide some((*"Ruby Gtk/Cairo Framework"*))which will hide the presence of Gtk main loop and its infrastructure away as much as possible. The trouble is, in order to do that you have to use cairo library, of which at this point our students are still rather ignorant.
+
+Though, once you will learn the basics of cairo library this((*Ruby Gtk/Cairo Framework*))will become a rather important programming device for all Ruby Gtk programmers, I should ask you not to worry about its inner workings at this point, and postpone your desire to understand it all before you get through a few program examples, that explain features used to build this framework. All you need to know at this point is to require the 'hiki2-gtk-w-cairo.rb' file and include 'GtkHiki' module it defines, and add the wrapper code as shown in the following minimal ruby cairo program:
+
+# (12.3.0.1.1)
+:Programmer's Note:
+
+    (12.3.0.1.1)
+    Note, we are switching the module file here. See "Student's Note" (12.3.0.1.1.1) below! The new
+    module file 'hiki2-gtk-w-cairo.rb' is listed and explained at the end of this chapter in section (12.3.XXXX) "Hiki Gtk With Cairo Module File". It can be copied from there. 
+
+
+# (12.3.0.1.1.1)
+    :Student's Note:
+
+        (12.3.0.1.1.1)
+        For use with cairo program examples we are introducing new ((*HikiGtk*)) module ((*'hiki2-gtk-w-cairo.rb'*)). Note, the module filename has changed, while the module name (HikiGtk) stays the same! 
+
+        You should copy 'hiki2-gtk-w-cairo.rb' file into your program directory (folder), or into another directory of your choice. In any event you should make sure the directory in which the module file resides, is be included in Ruby's load path, just as was required earlier, and as originally explained in section:  12.3.1.1 [((<Time To Start Using Object-Oriented Programming Paradigm|tut-gtk2-dnd-intro#Time To Start Using Object-Oriented Programming Paradigm>))].
+
+
+
+((*minimal-rb-cr.rb*))
+
+ #!/usr/bin/env ruby
+
+ $: << '~/work/HikiLib'
+ require 'hiki2-gtk-w-cairo.rb'
+ include HikiGtk
+
+ window=CairoWindow.new("Minimal Cairo Program") 
+ window.show_all
+ Gtk.main
+
+As you can see, if you run this program it displays an empty grey cairo drawing area.
+
+
+
+
+
 
+{{br}}
 {{br}}
 
 == Cairo's Drawing Model




ruby-gnome2-cvs メーリングリストの案内
Zurück zum Archiv-Index