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

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2013年 3月 25日 (月) 17:09:25 JST


-------------------------
REMOTE_ADDR = 70.49.48.128
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-dancr-rbcatut
-------------------------
@@ -276,6 +276,45 @@
         In traditional 'C' GTK Cairo implementations and in its cousins like 'gtkmm', cairo context is typically bound to different surfaces, however, currently in Ruby, other than active GTK Window surfaces are not available! (see section 12.3.0.1.1.)
 
 
+{{br}}
+
+=== Verbs
+(12.3.1.2){{br}}
+
+The reason you are using cairo in a program is to draw. Cairo internally draws with one fundamental drawing operation: the source and mask are freely placed somewhere over the destination. Then the layers are all pressed together and the paint from the source is transferred to the destination wherever the mask allows it. To that extent the following five drawing verbs, or operations, are all similar. They differ by how they construct the mask.
+
+:Stroke
+    {{image_right("123-04-stroke.png")}}
+    (12.3.1.2.1)
+
+    The ((<cairo_stroke()|URL:http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-stroke>)) operation takes a virtual pen along the path. It allows the source to transfer through the mask in a thin (or thick) line around the path, according to the pen's ((<line width|URL:http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-set-line-width>)), ((<dash style|URL:http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-set-dash>)), and ((<line caps|URL:http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-set-line-cap>)).
+
+    {{br}}{{image_right("1203-p04-00-stroke-s1.png")}}
+
+     #!/usr/bin/env ruby
+     $: << '~/work/HikiLib'
+     require 'hiki2-gtk-w-cairo.rb'
+     include HikiGtk
+
+     class StrokeDemo < CairoWindow
+       def draw(cr, da)
+         width, height = da.window.size
+         # Your code comes here:
+         # ---------------------
+         cr.scale(120, 120)
+         cr.line_width = 0.1
+         cr.set_source_rgb(0, 0, 0)
+         cr.rectangle(0.25, 0.25, 0.5, 0.5)
+         cr.stroke
+       end
+     end # // EndOf class StrokeDemo
+ 
+     window = StrokeDemo.new("Stroke Tut. Example")
+     window.show_all
+     Gtk.main
+
+
+
 
 
 # ------- AS PROMMISED Hiki Gtk With Cairo Module File -----------




ruby-gnome2-cvs メーリングリストの案内
Back to archive index