Class: Cairo::ImageSurface

Inherits:
Object
  • Object
show all
Defined in:
lib/image_surface_extensions.rb

Instance Method Summary collapse

Instance Method Details

#get_pixel(x, y) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/image_surface_extensions.rb', line 6

def get_pixel(x, y)
  integer = get_values(x, y)
  a = integer >> 24 & 0xFF
  r = integer >> 16 & 0xFF
  g = integer >> 8  & 0xFF
  b = integer       & 0xFF
  Color::RGB.new([r, g, b, a].map {|v| v.to_f/255})
end