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

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2013年 4月 2日 (火) 16:10:46 JST


-------------------------
REMOTE_ADDR = 70.49.48.128
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-dancr-rbcatut-dwc
-------------------------
@@ -26,31 +26,61 @@
 
 
 
+
 == Drawing with Cairo
 (12.3.2){{br}}
 
+In order to create an image you desire, you have to prepare the ((<context|Cairo::Context>)) for each of the drawing verbs. To use ((<stroke|tut-gtk2-dancr-rbcatut-crdrmd#Stroke>)) or ((<fill|tut-gtk2-dancr-rbcatut-crdrmd#Fill>)) you first need a path. To use ((<show_text()|tut-gtk2-dancr-rbcatut-crdrmd#Show Text - Glyphs>)) you must position your text by its insertion point. To use ((<mask()|tut-gtk2-dancr-rbcatut-crdrmd#Mask>)) you need a second source pattern or surface. And to use any of the operations, including ((<paint|tut-gtk2-dancr-rbcatut-crdrmd#Paint>)), you need a primary source.
 
 
-# {{image_right("")}}
-# ((<|URL:http://...>))
 
-# dialog-warning.png
+{{br}}
+=== Preparing and Selecting a Source
+(12.3.2.1){{br}}
 
+There are three main kinds of sources in cairo: colors, gradients, and images. Colors are the simplest; they use a uniform hue and opacity for the entire source. You can select these without any preparation with ((<cairo_set_source_rgb()|URL:http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-set-source-rgb>)) and ((<cairo_set_source_rgba()|URL:http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-set-source-rgba>)). Using set_source_rgb(r, g, b) is equivalent to using set_source_rgba(r, g, b, 1.0), and it sets your source color to use full opacity.
 
 
-
-{{br}}
-
-=== Preparing and Selecting a Source
-(12.3.2.1){{br}}
 {{image_right("1203-p09-setsourcergba-in-C.png")}}
 
+# FILE:	1203-p09-80-03-00-01-ssrcrgb-noCUT-OFFS-nonGtkCr-dpl01.rb
+     
+     #!/usr/bin/env ruby
+     $: << '~/work/HikiLib'
+     require 'hiki2-gtk-w-cairo.rb'
+     include HikiGtk
+     
+     # Create cairo context for image surface
+     surface = Cairo::ImageSurface.new(120, 120)
+     cr = Cairo::Context.new(surface)
+     cr.scale(120, 120)
+     
+     # -- Your cairo code starts here -------------- -s-
+     cr.set_source_rgb(0, 0, 0)
+     cr.move_to(0, 0)
+     cr.line_to(1, 1)
+     cr.move_to(1, 0)
+     cr.line_to(0, 1)
+     cr.set_line_width(0.2)
+     cr.stroke
+     
+     cr.rectangle(0, 0, 0.5, 0.5)
+     cr.set_source_rgba(1, 0, 0, 0.80)
+     cr.fill
+     cr.rectangle(0, 0.5, 0.5, 0.5)
+     cr.set_source_rgba(0, 1, 0, 0.60)
+     cr.fill
+     cr.rectangle(0.5, 0, 0.5, 0.5)
+     cr.set_source_rgba(0, 0, 1, 0.40)
+     cr.fill
+     # -- Your cairo code ends here ---------------- -e-
+     
+     cr.target.write_to_png("setsourcergb-nonGtkCr-120:120x120.png")
+     puts "DEBUG: cr.target.class=#{cr.target.class}"	#=> Cairo::ImageSurface
 
-# {{image_right("")}}
-# ((<|URL:http://...>))
 
 
-
+{{br}}
 {{br}}
 
 === Creating a Path




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