Class: RPiet::Image::URLImage

Inherits:
Image
  • Object
show all
Defined in:
lib/rpiet/image/url_image.rb

Instance Attribute Summary

Attributes inherited from Image

#codel_size

Instance Method Summary collapse

Methods inherited from Image

#ascii, #color_for, #pixel, #size

Constructor Details

#initialize(file, codel_size = 1) ⇒ URLImage

Returns a new instance of URLImage.



9
10
11
12
# File 'lib/rpiet/image/url_image.rb', line 9

def initialize(file, codel_size=1)
  super(codel_size)
  @raw = javax.imageio.ImageIO.read(java.net.URL.new(file))
end

Instance Method Details

#raw_heightObject



23
24
25
# File 'lib/rpiet/image/url_image.rb', line 23

def raw_height
  @raw.height
end

#raw_pixel(x, y) ⇒ Object



14
15
16
17
# File 'lib/rpiet/image/url_image.rb', line 14

def raw_pixel(x, y)
  rgb = @raw.getRGB(x, y)
  [(rgb >> 16 ) & 0xff, (rgb >> 8) & 0xff, rgb & 0xff]
end

#raw_widthObject



19
20
21
# File 'lib/rpiet/image/url_image.rb', line 19

def raw_width
  @raw.width
end