Sha256: 59bfa5d086e54d44511e49c2519a57e9fa9b75410140c91372c8205073b510f9

Contents?: true

Size: 930 Bytes

Versions: 210

Compression:

Stored size: 930 Bytes

Contents

# Copyright (c) 2005 Ruby-GNOME2 Project Team
# This program is licenced under the same licence as Ruby-GNOME2.
#
# $Id: cairo-gradient.rb,v 1.2 2005/10/12 15:23:49 ktou Exp $
=begin
= cairo/Gradient

This demo shows how to use GDK and cairo to gradient.
From http://cairographics.org/samples/gradient.html.
=end
require 'common'

module Demo
  class CairoGradient < CairoWindow
    def initialize
      super('cairo gradient')
    end

    def draw(cr)
      pat = Cairo::LinearPattern.new(0.0, 0.0,  0.0, 1.0)
      pat.add_color_stop_rgb(1, 0, 0, 0)
      pat.add_color_stop_rgb(0, 1, 0, 0)
      cr.rectangle(0, 0, 1, 1)
      cr.set_source(pat)
      cr.fill
      
      pat = Cairo::RadialPattern.new(0.45, 0.4, 0.1, 0.4, 0.4, 0.5)
      pat.add_color_stop_rgba(0, 1, 1, 1, 0.8)
      pat.add_color_stop_rgba(1, 0, 0, 0)
      cr.set_source(pat)
      cr.arc(0.5, 0.5, 0.3, 0, 2 * Math::PI)
      cr.fill
    end
  end
end

Version data entries

210 entries across 210 versions & 2 rubygems

Version Path
gtk2-0.90.6 sample/gtk-demo/cairo-gradient.rb
gtk2-0.90.6-x86-mingw32 sample/gtk-demo/cairo-gradient.rb
gtk2-0.90.5 sample/gtk-demo/cairo-gradient.rb
gtk2-0.90.5-x86-mingw32 sample/gtk-demo/cairo-gradient.rb
gtk2-0.90.4 sample/gtk-demo/cairo-gradient.rb
gtk2-0.90.4-x86-mingw32 sample/gtk-demo/cairo-gradient.rb
gtk2-0.90.3 sample/gtk-demo/cairo-gradient.rb
gtk2-0.90.3-x86-mingw32 sample/gtk-demo/cairo-gradient.rb
gtk2-0.90.2 sample/gtk-demo/cairo-gradient.rb
gtk2-0.90.2-x86-mingw32 sample/gtk-demo/cairo-gradient.rb