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-3.4.3 sample/gtk-demo/cairo-gradient.rb
gtk2-3.4.2 sample/gtk-demo/cairo-gradient.rb
gtk2-3.4.1 sample/gtk-demo/cairo-gradient.rb
gtk2-3.4.0 sample/gtk-demo/cairo-gradient.rb
gtk2-3.3.9 sample/gtk-demo/cairo-gradient.rb
gtk2-3.3.8 sample/gtk-demo/cairo-gradient.rb
gtk2-3.3.7 sample/gtk-demo/cairo-gradient.rb
gtk2-3.3.6 sample/gtk-demo/cairo-gradient.rb
gtk2-3.3.5 sample/gtk-demo/cairo-gradient.rb
gtk2-3.3.4 sample/gtk-demo/cairo-gradient.rb
gtk2-3.3.3 sample/gtk-demo/cairo-gradient.rb
gtk2-3.3.2 sample/gtk-demo/cairo-gradient.rb
gtk2-3.3.1 sample/gtk-demo/cairo-gradient.rb
gtk2-3.3.0 sample/gtk-demo/cairo-gradient.rb
gtk2-3.2.9-x64-mingw32 sample/gtk-demo/cairo-gradient.rb
gtk2-3.2.9-x86-mingw32 sample/gtk-demo/cairo-gradient.rb
gtk2-3.2.9 sample/gtk-demo/cairo-gradient.rb
gtk2-3.2.8-x64-mingw32 sample/gtk-demo/cairo-gradient.rb
gtk2-3.2.8-x86-mingw32 sample/gtk-demo/cairo-gradient.rb
gtk2-3.2.8 sample/gtk-demo/cairo-gradient.rb