Class: Wx::Point

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/wx/doc/gen/gdi_common.rb,
lib/wx/doc/gdi_common.rb

Overview

Note:

This class is untracked and should not be derived from nor instances extended!

A Point is a useful data structure for graphics operations.

It contains integer x and y members. See RealPoint for a floating point version. Note that the width and height stored inside a Point object may be negative and that Point functions do not perform any check against negative values (this is used to e.g. store the special -1 value in DEFAULT_POSITION instance).

Category: Data Structures Predefined objects/pointers: DEFAULT_POSITION

See Also:

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWx::Point #initialize(x, y) ⇒ Wx::Point #initialize(pt) ⇒ Wx::Point

Returns a new instance of Point.

Overloads:

  • #initializeWx::Point

    Constructs a point.

    Initializes the internal x and y coordinates to zero.

  • #initialize(x, y) ⇒ Wx::Point

    Initializes the point object with the given x and y coordinates.

    Parameters:

    • x (Integer)
    • y (Integer)
  • #initialize(pt) ⇒ Wx::Point

    Converts the given RealPoint (with floating point coordinates) to a Wx::Point instance.

    Notice that since v3.1.2 the behaviour of this constructor has changed to round the floating point values of pt components, if you want to truncate them instead, please use truncate.

    Parameters:



455
# File 'lib/wx/doc/gen/gdi_common.rb', line 455

def initialize(*args) end

Class Method Details

.round(pt) ⇒ Wx::Point

Creates a Wx::Point by rounding the coordinates of the given RealPoint.

This is equivalent to using the constructor taking RealPoint but is more explicit about the fact that rounding is performed.

Parameters:

Returns:



462
# File 'lib/wx/doc/gen/gdi_common.rb', line 462

def self.round(pt) end

.truncate(pt) ⇒ Wx::Point

Creates a Wx::Point by truncating the coordinates of the given RealPoint.

This is similar to round but instead of rounding the coordinates, they are simply truncated to integers.

Parameters:

Returns:



469
# File 'lib/wx/doc/gen/gdi_common.rb', line 469

def self.truncate(pt) end

Instance Method Details

#*(num) ⇒ Wx::Point

Return a new Wx::Point with the x and y values both multiplied by parameter +num+, which should be a Numeric

Parameters:

  • num (Numeric)

Returns:



115
# File 'lib/wx/doc/gdi_common.rb', line 115

def *(num) end

#+(arg) ⇒ Wx::Point

Return a new Wx::Point with the x and y values both increased by parameter +arg+. If +arg+ is another Wx::Point (or Wx::Size or 2-element array), increase x by the other’s x (or width) and y by the other’s y (or height); if +arg+ is a numeric value, increase both x and y by that value.

Parameters:

Returns:



131
# File 'lib/wx/doc/gdi_common.rb', line 131

def +(arg) end

#-(arg) ⇒ Wx::Point

Return a new Wx::Point with the x and y values both reduced by parameter +arg+. If +arg+ is another Wx::Point (or Wx::Size or 2-element array), reduce x by the other’s x (or width) and y by the other’s y (or height); if +arg+ is a numeric value, reduce x and y both by that value.

Parameters:

Returns:



123
# File 'lib/wx/doc/gdi_common.rb', line 123

def -(arg) end

#/(num) ⇒ Wx::Point

Return a new Wx::Point with the x and y parameters both divided by parameter +num+, which should be a Numeric

Parameters:

  • num (Numeric)

Returns:



109
# File 'lib/wx/doc/gdi_common.rb', line 109

def /(num) end

#<=>(other) ⇒ Boolean?

Compare point values (Wx::Point or point array). Returns -1,0 or 1 to indicate if this point is smaller, equal or greater than other (comparing x<em>y with other.x</em>other.y). Returns nil if incompatible.

Parameters:

Returns:

  • (Boolean, nil)


95
# File 'lib/wx/doc/gdi_common.rb', line 95

def <=>(other)end

#assign(pt) ⇒ self

Set this point to the given point’s x,y values

Parameters:

Returns:

  • (self)


145
# File 'lib/wx/doc/gdi_common.rb', line 145

def assign(pt) end

#eql?(other) ⇒ Boolean

Compare points.

Parameters:

Returns:

  • (Boolean)


100
# File 'lib/wx/doc/gdi_common.rb', line 100

def eql?(other)end

#hashObject

Returns hash for point



103
# File 'lib/wx/doc/gdi_common.rb', line 103

def hash; end

#is_fully_specifiedBoolean Also known as: fully_specified?

Returns true if neither of the point components is equal to DEFAULT_COORD.

This method is typically used before calling #set_defaults.

Returns:

  • (Boolean)


397
# File 'lib/wx/doc/gen/gdi_common.rb', line 397

def is_fully_specified; end

#set_defaults(pt) ⇒ void Also known as: defaults=

This method returns an undefined value.

Combine this object with another one replacing the uninitialized values.

It is typically used like this:

if !pos.is_fully_specified
    pos.set_defaults(get_default_position)
  end

Parameters:

See Also:



412
# File 'lib/wx/doc/gen/gdi_common.rb', line 412

def set_defaults(pt) end

#to_aryArray(Integer,Integer)

Returns point array ([x, y])

Returns:

  • (Array(Integer,Integer))

    point as array



88
# File 'lib/wx/doc/gdi_common.rb', line 88

def to_ary; end

#to_pointself

Returns self.

Returns:

  • (self)


140
# File 'lib/wx/doc/gdi_common.rb', line 140

def to_point; end

#to_real_pointWx::RealPoint Also known as: to_real

Converts point to Wx::RealPoint

Returns:

  • (Wx::RealPoint)

    Wx::RealPoint instance from point coordinates



135
# File 'lib/wx/doc/gdi_common.rb', line 135

def to_real_point; end

#xInteger

x member.

Returns:

  • (Integer)


419
# File 'lib/wx/doc/gen/gdi_common.rb', line 419

def x; end

#x=(val) ⇒ void

This method returns an undefined value.

x member.

Parameters:

  • val (Integer)


425
# File 'lib/wx/doc/gen/gdi_common.rb', line 425

def x=(val); end

#yInteger

y member.

Returns:

  • (Integer)


431
# File 'lib/wx/doc/gen/gdi_common.rb', line 431

def y; end

#y=(val) ⇒ void

This method returns an undefined value.

y member.

Parameters:

  • val (Integer)


437
# File 'lib/wx/doc/gen/gdi_common.rb', line 437

def y=(val); end