public class

SizeF

extends Object
java.lang.Object
   ↳ sofia.graphics.SizeF

Class Overview

A class used elsewhere in Sofia that holds two float coordinates representing the width and height of an object.

Summary

Fields
public float height The height.
public float width The width.
Public Constructors
SizeF()
Creates a SizeF with a width and height of zero.
SizeF(float width, float height)
Creates a SizeF with the specified width and height.
SizeF(SizeF size)
Creates a SizeF with values copied from the specified size.
Public Methods
boolean equals(Object other)
boolean equals(float otherWidth, float otherHeight)
Gets a value indicating whether the receiver has the specified width and height.
int hashCode()
float length()
Gets the Euclidean distance from (0, 0) to the point indicated by the width and height of the receiver.
void set(float newWidth, float newHeight)
Sets the width and height of the size.
void set(SizeF size)
Sets the size's width and height to those from the specified size.
String toString()
Gets a human-readable string representation of the size.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public float height

The height.

public float width

The width.

Public Constructors

public SizeF ()

Creates a SizeF with a width and height of zero.

public SizeF (float width, float height)

Creates a SizeF with the specified width and height.

Parameters
width the width
height the height

public SizeF (SizeF size)

Creates a SizeF with values copied from the specified size.

Parameters
size the size

Public Methods

public boolean equals (Object other)

public boolean equals (float otherWidth, float otherHeight)

Gets a value indicating whether the receiver has the specified width and height.

Parameters
otherWidth the width to compare the receiver with
otherHeight the height to compare the receiver with
Returns
  • true if the receiver has the specified width and height, otherwise false

public int hashCode ()

public float length ()

Gets the Euclidean distance from (0, 0) to the point indicated by the width and height of the receiver.

Returns
  • the Euclidean distance from (0, 0) to (width, height)

public void set (float newWidth, float newHeight)

Sets the width and height of the size.

Parameters
newWidth the new width
newHeight the new height

public void set (SizeF size)

Sets the size's width and height to those from the specified size.

Parameters
size the size

public String toString ()

Gets a human-readable string representation of the size.

Returns
  • a human-readable string representation of the size