Class: Imlib2::Polygon

# Imlib2::Polygon (Class)

In: | imlib2.c
Parent: | Object

## Methods

add_point bounds contains? contains_point? get_bounds new new

## Public Class methods

new(...)

Constructor for Imlib2::Polygon

Accepts the same arguments as Imlib2::Polygon.new.

new(...)

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

add_point(...)

Add a point to the polygon

Example:

      poly.add_point 123, 456

bounds()

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?(...)

Does the given point lie within the polygon?

Example:

      if poly.contains? 12, 5
        puts 'yes'
      else
        puts 'no'
      end

contains_point?(...)

Does the given point lie within the polygon?

Example:

      if poly.contains? 12, 5
        puts 'yes'
      else
        puts 'no'
      end

get_bounds()

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] }

[Validate]