Sha256: 9b44e93d4260fae41799b7b36e33f874ce1c58bb73fd1c592adce6c577c790b3

Contents?: true

Size: 920 Bytes

Versions: 2

Compression:

Stored size: 920 Bytes

Contents

#!/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_rgba(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")

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cairo-1.5.0 samples/.#blur.rb.1.1
cairo-1.5.1 samples/.#blur.rb.1.1