[cairo-commit] rcairo/samples blur.rb,NONE,1.1
Kouhei Sutou
commit at pdx.freedesktop.org
Sat Apr 14 23:15:31 PDT 2007
Committed by: kou
Update of /cvs/cairo/rcairo/samples
In directory kemper:/tmp/cvs-serv17824/samples
Added Files:
blur.rb
Log Message:
* src/lib/cairo/context.rb, src/lib/cairo/context/blur.rb: added
Cairo::Context#pseudo_blur.
* samples/blur.rb: added a sample script for Cairo::Context#pseudo_blur.
--- NEW FILE: blur.rb ---
#!/USO/bin/env ruby
require 'cairo'
margin = 10
rectangle_width = 300
rectangle_height = 100
width = rectangle_width + 2 * margin
height = (rectangle_height + 2 * margin) * 3
surface = Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, width, height)
context = Cairo::Context.new(surface)
context.set_source_rgb(1, 1, 1)
context.paint
context.set_source_rgb(0.3, 0.3, 0.3)
context.rectangle(margin, margin, rectangle_width, rectangle_height)
context.fill
context.pseudo_blur do
context.set_source_rgb(0.3, 0.3, 0.3)
context.rectangle(margin, rectangle_height + 2 * margin + margin / 2,
rectangle_width, rectangle_height)
context.fill
end
context.pseudo_blur(5) do
context.set_source_rgb(0.3, 0.3, 0.3)
context.rectangle(margin, (rectangle_height + 2 * margin) * 2 + margin / 2,
rectangle_width, rectangle_height)
context.fill
end
surface.write_to_png("blur.png")
More information about the cairo-commit
mailing list