| Class Imlib2::Polygon |
|
| Methods |
| Public Class methods |
| new(int argc, VALUE *argv, VALUE klass) |
Return a new Imlib2::Polygon
Examples:
poly = Imlib2::Polygon.new points = [[10, 10], [20, 30], [15, 8], [6, 3], [12, 2]] poly = Imlib2::Polygon.new *points
| Public Instance methods |
| initialize(int argc, VALUE *argv, VALUE self) |
Constructor for Imlib2::Polygon
Accepts the same arguments as Imlib2::Polygon.new.
| add_point(int argc, VALUE *argv, VALUE self) |
Add a point to the polygon
Example:
poly.add_point 123, 456
| bounds(VALUE self) |
Return the bounding rectangle of the given polygon.
Example:
bounds = poly.bounds
%q(x y w h).each_index { |i, v| puts v << ' = ' << bounds[i] }
| get_bounds(VALUE self) |
Return the bounding rectangle of the given polygon.
Example:
bounds = poly.bounds
%q(x y w h).each_index { |i, v| puts v << ' = ' << bounds[i] }
| contains?(int argc, char *argv, VALUE self) |
Does the given point lie within the polygon?
Example:
if poly.contains? 12, 5
puts 'yes'
else
puts 'no'
end
| contains_point?(int argc, char *argv, VALUE self) |
Does the given point lie within the polygon?
Example:
if poly.contains? 12, 5
puts 'yes'
else
puts 'no'
end