jruby/docs BETA
org.eclipse.swt.graphics 36
E AutoscalingMode
C Color
C Cursor
C Device
C DeviceData
I Drawable
C Font
C FontData
C FontMetrics
C GC
C GCData
C GlyphMetrics
C Image
C ImageData
I ImageDataAtSizeProvider
I ImageDataProvider
I ImageFileNameProvider
I ImageGcDrawer
C ImageLoader
C ImageLoaderEvent
I ImageLoaderListener
C LineAttributes
C PaletteData
C Path
C PathData
C Pattern
C Point
C RGB
C RGBA
C Rectangle
C Region
C Resource
E RoundingMode
C TextLayout
C TextStyle
C Transform
Region — members 27+
F handle() long
C new()
C new(device)
C add(point_array)
C add(rect)
C add(x, y, width, height)
C add(region)
M bounds() Rectangle
M cocoa_new(device, handle) Region
M contains(x, y) boolean
M contains(pt) boolean
M disposed?() boolean
M empty?() boolean
M equals(object) boolean
M hash_code() int
C intersect(rect)
C intersect(x, y, width, height)
C intersect(region)
M intersects(x, y, width, height) boolean
M intersects(rect) boolean
C subtract(point_array)
C subtract(rect)
C subtract(x, y, width, height)
C subtract(region)
M to_string() String
C translate(x, y)
C translate(pt)
from Resource
M device() Device
C dispose()

org.eclipse.swt.graphics.Region

class final extends Resource 27 members

Instances of this class represent areas of an x-y coordinate system that are aggregates of the areas covered by a number of polygons.

Application code must explicitly invoke the Region.dispose() method to release the operating system resources managed by each instance when those instances are no longer required.

Fields

fieldtypenote
handle long the OS resource for the region (Warning: This field is platform dependent)

IMPORTANT: This field is not part of the SWT public API. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms and should never be accessed from application code.

Constructors

new

new ( )
Java: <init>()

Constructs a new empty region.

You must dispose the region when it is no longer required.

Throws

SWTError
  • ERROR_NO_HANDLES if a handle could not be obtained for region creation

new

new ( Device device )
Java: <init>(org.eclipse.swt.graphics.Device device)

Constructs a new empty region.

You must dispose the region when it is no longer required.

nametypedescription
deviceorg.eclipse.swt.graphics.Devicethe device on which to allocate the region

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if device is null and there is no current device
SWTError
  • ERROR_NO_HANDLES if a handle could not be obtained for region creation

Class Methods

cocoa_new

Region cocoa_new ( Device device, long handle )
Java: cocoa_new(org.eclipse.swt.graphics.Device device, long handle)

Invokes platform specific functionality to allocate a new region.

IMPORTANT: This method is not part of the public API for Region. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms, and should never be called from application code.

nametypedescription
deviceorg.eclipse.swt.graphics.Devicethe device on which to allocate the region
handlelongthe handle for the region

Returns: a new region object containing the specified device and handle

Instance Methods

add

add ( int[] point_array )
Java: add(int[] pointArray)

Adds the given polygon to the collection of polygons the receiver maintains to describe its area.

nametypedescription
point_arrayint[]points that describe the polygon to merge with the receiver

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if the argument is null
SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

add

add ( Rectangle rect )
Java: add(org.eclipse.swt.graphics.Rectangle rect)

Adds the given rectangle to the collection of polygons the receiver maintains to describe its area.

nametypedescription
rectorg.eclipse.swt.graphics.Rectanglethe rectangle to merge with the receiver

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if the argument is null
  • ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative
SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

add

add ( int x, int y, int width, int height )
Java: add(int x, int y, int width, int height)

Adds the given rectangle to the collection of polygons the receiver maintains to describe its area.

nametypedescription
xintthe x coordinate of the rectangle
yintthe y coordinate of the rectangle
widthintthe width coordinate of the rectangle
heightintthe height coordinate of the rectangle

Throws

IllegalArgumentException
  • ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative
SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

add

add ( Region region )
Java: add(org.eclipse.swt.graphics.Region region)

Adds all of the polygons which make up the area covered by the argument to the collection of polygons the receiver maintains to describe its area.

nametypedescription
regionorg.eclipse.swt.graphics.Regionthe region to merge

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if the argument is null
  • ERROR_INVALID_ARGUMENT - if the argument has been disposed
SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

bounds

Rectangle bounds ( )
Java: getBounds() · also: get_bounds

Returns a rectangle which represents the rectangular union of the collection of polygons the receiver maintains to describe its area.

Returns: a bounding rectangle for the region

Throws

SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

contains

boolean contains ( int x, int y )
Java: contains(int x, int y)

Returns true if the point specified by the arguments is inside the area specified by the receiver, and false otherwise.

nametypedescription
xintthe x coordinate of the point to test for containment
yintthe y coordinate of the point to test for containment

Returns: true if the region contains the point and false otherwise

Throws

SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

contains

boolean contains ( Point pt )
Java: contains(org.eclipse.swt.graphics.Point pt)

Returns true if the given point is inside the area specified by the receiver, and false otherwise.

nametypedescription
ptorg.eclipse.swt.graphics.Pointthe point to test for containment

Returns: true if the region contains the point and false otherwise

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if the argument is null
SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

disposed?

boolean disposed? ( )
Java: isDisposed() · also: is_disposed

Returns true if the region has been disposed, and false otherwise.

This method gets the dispose state for the region. When a region has been disposed, it is an error to invoke any other method (except #dispose()) using the region.

Returns: true when the region is disposed, and false otherwise

empty?

boolean empty? ( )
Java: isEmpty() · also: is_empty

Returns true if the receiver does not cover any area in the (x, y) coordinate plane, and false if the receiver does cover some area in the plane.

Returns: true if the receiver is empty, and false otherwise

Throws

SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

equals

boolean equals ( Object object )
Java: equals(Object object)

Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.

nametypedescription
objectObjectthe object to compare with this object

Returns: true if the object is the same as this object and false otherwise

hash_code

int hash_code ( )
Java: hashCode()

Returns an integer hash code for the receiver. Any two objects that return true when passed to equals must return the same value for this method.

Returns: the receiver's hash

intersect

intersect ( Rectangle rect )
Java: intersect(org.eclipse.swt.graphics.Rectangle rect)

Intersects the given rectangle to the collection of polygons the receiver maintains to describe its area.

nametypedescription
rectorg.eclipse.swt.graphics.Rectanglethe rectangle to intersect with the receiver

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if the argument is null
  • ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative
SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

intersect

intersect ( int x, int y, int width, int height )
Java: intersect(int x, int y, int width, int height)

Intersects the given rectangle to the collection of polygons the receiver maintains to describe its area.

nametypedescription
xintthe x coordinate of the rectangle
yintthe y coordinate of the rectangle
widthintthe width coordinate of the rectangle
heightintthe height coordinate of the rectangle

Throws

IllegalArgumentException
  • ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative
SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

intersect

intersect ( Region region )
Java: intersect(org.eclipse.swt.graphics.Region region)

Intersects all of the polygons which make up the area covered by the argument to the collection of polygons the receiver maintains to describe its area.

nametypedescription
regionorg.eclipse.swt.graphics.Regionthe region to intersect

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if the argument is null
  • ERROR_INVALID_ARGUMENT - if the argument has been disposed
SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

intersects

boolean intersects ( int x, int y, int width, int height )
Java: intersects(int x, int y, int width, int height)

Returns true if the rectangle described by the arguments intersects with any of the polygons the receiver maintains to describe its area, and false otherwise.

nametypedescription
xintthe x coordinate of the origin of the rectangle
yintthe y coordinate of the origin of the rectangle
widthintthe width of the rectangle
heightintthe height of the rectangle

Returns: true if the rectangle intersects with the receiver, and false otherwise

Throws

SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

intersects

boolean intersects ( Rectangle rect )
Java: intersects(org.eclipse.swt.graphics.Rectangle rect)

Returns true if the given rectangle intersects with any of the polygons the receiver maintains to describe its area and false otherwise.

nametypedescription
rectorg.eclipse.swt.graphics.Rectanglethe rectangle to test for intersection

Returns: true if the rectangle intersects with the receiver, and false otherwise

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if the argument is null
SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

subtract

subtract ( int[] point_array )
Java: subtract(int[] pointArray)

Subtracts the given polygon from the collection of polygons the receiver maintains to describe its area.

nametypedescription
point_arrayint[]points that describe the polygon to merge with the receiver

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if the argument is null
SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

subtract

subtract ( Rectangle rect )
Java: subtract(org.eclipse.swt.graphics.Rectangle rect)

Subtracts the given rectangle from the collection of polygons the receiver maintains to describe its area.

nametypedescription
rectorg.eclipse.swt.graphics.Rectanglethe rectangle to subtract from the receiver

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if the argument is null
  • ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative
SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

subtract

subtract ( int x, int y, int width, int height )
Java: subtract(int x, int y, int width, int height)

Subtracts the given rectangle from the collection of polygons the receiver maintains to describe its area.

nametypedescription
xintthe x coordinate of the rectangle
yintthe y coordinate of the rectangle
widthintthe width coordinate of the rectangle
heightintthe height coordinate of the rectangle

Throws

IllegalArgumentException
  • ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative
SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

subtract

subtract ( Region region )
Java: subtract(org.eclipse.swt.graphics.Region region)

Subtracts all of the polygons which make up the area covered by the argument from the collection of polygons the receiver maintains to describe its area.

nametypedescription
regionorg.eclipse.swt.graphics.Regionthe region to subtract

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if the argument is null
  • ERROR_INVALID_ARGUMENT - if the argument has been disposed
SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

to_string

String to_string ( )
Java: toString()

Returns a string containing a concise, human-readable description of the receiver.

Returns: a string representation of the receiver

translate

translate ( int x, int y )
Java: translate(int x, int y)

Translate all of the polygons the receiver maintains to describe its area by the specified point.

nametypedescription
xintthe x coordinate of the point to translate
yintthe y coordinate of the point to translate

Throws

SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

translate

translate ( Point pt )
Java: translate(org.eclipse.swt.graphics.Point pt)

Translate all of the polygons the receiver maintains to describe its area by the specified point.

nametypedescription
ptorg.eclipse.swt.graphics.Pointthe point to translate

Throws

IllegalArgumentException
  • ERROR_NULL_ARGUMENT - if the argument is null
SWTException
  • ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed

Inherited

from Resource

device

Device device ( )
Java: getDevice() · also: get_device

Returns the Device where this resource was created.

Returns: Device the device of the receiver

dispose

dispose ( )
Java: dispose()

Disposes of the operating system resources associated with this resource. Applications must dispose of all resources which they allocate. This method does nothing if the resource is already disposed.