Class: RubySketch::Processing::Image
- Inherits:
-
Object
- Object
- RubySketch::Processing::Image
- Defined in:
- lib/rubysketch/processing.rb
Overview
Image object.
Instance Method Summary collapse
-
#copy(img = nil, sx, sy, sw, sh, dx, dy, dw, dh) ⇒ nil
Copies image.
-
#height ⇒ Numeric
Gets height of image.
-
#resize(width, height) ⇒ nil
Resizes image.
-
#save(filename) ⇒ Object
Saves image to file.
-
#width ⇒ Numeric
Gets width of image.
Instance Method Details
#copy(sx, sy, sw, sh, dx, dy, dw, dh) ⇒ nil #copy(img, sx, sy, sw, sh, dx, dy, dw, dh) ⇒ nil
Copies image.
626 627 628 629 630 631 |
# File 'lib/rubysketch/processing.rb', line 626 def copy(img = nil, sx, sy, sw, sh, dx, dy, dw, dh) img ||= self @image.paint do |painter| painter.image img.getInternal__, sx, sy, sw, sh, dx, dy, dw, dh end end |
#height ⇒ Numeric
Gets height of image.
591 592 593 |
# File 'lib/rubysketch/processing.rb', line 591 def height() @image.height end |
#resize(width, height) ⇒ nil
Resizes image.
602 603 604 605 606 607 |
# File 'lib/rubysketch/processing.rb', line 602 def resize(width, height) @image = Rays::Image.new(width, height).paint do |painter| painter.image @image, 0, 0, width, height end nil end |
#save(filename) ⇒ Object
Saves image to file.
637 638 639 |
# File 'lib/rubysketch/processing.rb', line 637 def save(filename) @image.save filename end |
#width ⇒ Numeric
Gets width of image.
583 584 585 |
# File 'lib/rubysketch/processing.rb', line 583 def width() @image.width end |