Class: Painter::Image

Inherits:
Operation show all
Defined in:
lib/painter/image.rb

Instance Method Summary collapse

Methods inherited from Operation

#_angle, #_color, #angle, #color, #initialize, pretty_accessor

Constructor Details

This class inherits a constructor from Painter::Operation

Instance Method Details

#drawObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/painter/image.rb', line 13

def draw
  Painter.open(@_source, @_format) do |source_image|
    CGD2::gdImageCopyResampled(@image.image_pointer,
      source_image.image_pointer,
      @_toTopLeft.x, @_toTopLeft.y,
      @_fromTopLeft.x, @_fromTopLeft.y,
      (@_toWidth || @_width), (@_toHeight || @_height),
      @_width, @_height)
  end
end

#fromTopLeft(x, y) ⇒ Object



5
6
7
# File 'lib/painter/image.rb', line 5

def fromTopLeft(x,y)
  @_fromTopLeft = Point.new(x,y)
end

#toTopLeft(x, y) ⇒ Object



9
10
11
# File 'lib/painter/image.rb', line 9

def toTopLeft(x,y)
  @_toTopLeft = Point.new(x,y)
end