Class: Sikuli::Region

Inherits:
Object
  • Object
show all
Includes:
Clickable, Searchable, Typeable
Defined in:
lib/sikuli/region.rb

Direct Known Subclasses

Screen

Instance Method Summary collapse

Methods included from Searchable

#find, #find!, #find_all, #wait

Methods included from Typeable

#type

Methods included from Clickable

#click, #click_and_hold, #double_click, #drag_drop, #wheel_down, #wheel_up

Constructor Details

#initialize(*args) ⇒ Region

Public: creates a new Region object

args - Array representing x (left bound), y (top), width, height

     4 Fixnums left, top, width, height
     An instance of an org.sikuli.script::Region

Examples

  Region.new([10, 10, 200, 300])
  Region.new(10, 10, 200, 300)
  Region.new(another_region)

Returns the newly initialized object



28
29
30
# File 'lib/sikuli/region.rb', line 28

def initialize(*args)
  @java_obj = org.sikuli.script::Region.new(*args)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object

Public: provide access to all region methods provided by the SikuliScript API See sikuli.org/doc/java/edu/mit/csail/uid/Region.html



63
64
65
# File 'lib/sikuli/region.rb', line 63

def method_missing method_name, *args, &block
  @java_obj.send method_name, *args, &block
end

Instance Method Details

#heightObject

Public: the height in pixels of the Region



57
58
59
# File 'lib/sikuli/region.rb', line 57

def height
  @java_obj.h()
end

#highlight(seconds = 1) ⇒ Object

Public: highlight the region with a ~ 5 pixel red border

seconds - Fixnum length of time to show border

Returns nothing



37
38
39
# File 'lib/sikuli/region.rb', line 37

def highlight(seconds = 1)
  @java_obj.highlight(seconds)
end

#widthObject

Public: the width in pixels of the Region



52
53
54
# File 'lib/sikuli/region.rb', line 52

def width
  @java_obj.w()
end

#xObject

Public: the x component of the top, left corner of the Region



42
43
44
# File 'lib/sikuli/region.rb', line 42

def x
  @java_obj.x()
end

#yObject

Public: the y component of the top, left corner of the Region



47
48
49
# File 'lib/sikuli/region.rb', line 47

def y
  @java_obj.y()
end