Top Inners Fields Constructors Methods
com.jogamp.newt

public abstract Class Display

extends Object
Class Inheritance
Known Direct Subclasses
jogamp.newt.DisplayImpl
Imports
java.io.IOException, java.lang.ref.WeakReference, java.util.ArrayList, .Collection, .Iterator, com.jogamp.nativewindow.AbstractGraphicsDevice, .NativeWindowException, com.jogamp.nativewindow.util.PixelRectangle, .PixelFormat, .PointImmutable, jogamp.newt.Debug, com.jogamp.common.util.IOUtil, com.jogamp.newt.util.EDTUtil

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
Display.PointerIcon

Native PointerIcon handle.

Field Summary

Modifier and TypeField and Description
public static final boolean
protected static final boolean
protected static final ArrayList<WeakReference<Display>>
protected static int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected static void
addDisplay2List(final Display display)

public abstract int

Returns:

number of references post operation
addReference
()

The 1st call will initiate native creation, since we follow the lazy creation pattern.

public abstract void
createNative()

Manual trigger the native creation, if it is not done yet.

public abstract Display.PointerIcon
createPointerIcon(final IOUtil.ClassResources
single PNG resource for the PointerIcon. Only the first entry of IOUtil.ClassResources#resourcePaths is used.
pngResource
,
final int
pointer hotspot x-coord, origin is upper-left corner
hotX
,
final int
pointer hotspot y-coord, origin is upper-left corner
hotY
)

Returns the newly created PointerIcon or null if not implemented on platform.

public abstract Display.PointerIcon
createPointerIcon(final PixelRectangle pixelrect, final int
pointer hotspot x-coord, origin is upper-left corner
hotX
,
final int
pointer hotspot y-coord, origin is upper-left corner
hotY
)

Returns the newly created PointerIcon or null if not implemented on platform.

public abstract void
destroy()

Manually trigger the destruction, incl.

public abstract void
public static void
dumpDisplayList(final String prefix)

public boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

return true if obj is of type Display and both FQN getFQName() equals
public static int
public static Collection<Display>
getAllDisplays()

Returns the global display collection

private static Display
getDisplayOfImpl(final String type, final String name, final int fromIndex, final int incr, final boolean shared)

public abstract EDTUtil
public static Display
getFirstDisplayOf(final String type, final String name, final int
start index, then increasing until found or end of list
fromIndex
,
final boolean
if true, only shared instances are found, otherwise also exclusive
shared
)

public abstract String

Returns:

The fully qualified Display name, which is a key of getType() + getName() + getId().
getFQName
()

public abstract AbstractGraphicsDevice
getGraphicsDevice()

Return the AbstractGraphicsDevice used for depending resources lifecycle, i.e. Screen and Window, as well as the event dispatching (EDT).

public abstract long
getHandle()

Return the handle of the AbstractGraphicsDevice as returned by getGraphicsDevice().

public abstract int

Returns:

this display internal serial id
getId
()

public static Display
getLastDisplayOf(final String type, final String name, final int
start index, then decreasing until found or end of list. -1 is interpreted as size - 1.
fromIndex
,
final boolean
if true, only shared instances are found, otherwise also exclusive
shared
)

public abstract String

Returns:

This display connection name as defined at creation time. The display connection name is a technical platform specific detail, see AbstractGraphicsDevice#getConnection().
getName
()

public abstract boolean
getNativePointerIconForceDirectNIO()

Returns the native platform's direct NIO buffer requirement pointer-icon pixel data.

public abstract PixelFormat
getNativePointerIconPixelFormat()

Returns the native platform's PixelFormat for pointer-icon pixel data.

public abstract int

Returns:

number of references
getReferenceCount
()

public static String
public abstract String
public abstract int
hashCode()

Overrides java.lang.Object.hashCode.

return precomputed hashCode from FQN getFQName()
public static int
public abstract boolean

Returns:

true if EDT is running and not subject to be stopped, otherwise false.
isEDTRunning
()

public abstract boolean
isExclusive()

Return true if this instance is exclusive, i.e. will not be shared.

public abstract boolean

Returns:

true if the native display handle is valid and ready to operate, otherwise false.
isNativeValid
()

public abstract int

Returns:

number of references post operation
removeReference
()

The last call may destroy this instance, if getDestroyWhenUnused() returns true.

public abstract EDTUtil
setEDTUtil(EDTUtil usrEDTUtil)

Sets a new EDTUtil and returns the previous one.

public static String
toHexString(final int hex)

public static String
toHexString(final long hex)

public abstract boolean

Returns:

true if EDT has been stopped (destroyed but running), otherwise false.
validateEDTStopped
()

Validate EDT running state.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

DEBUGback to summary
public static final boolean DEBUG
DEBUG_POINTER_ICONback to summary
protected static final boolean DEBUG_POINTER_ICON
displayListback to summary
protected static final ArrayList<WeakReference<Display>> displayList
displaysActiveback to summary
protected static int displaysActive

Constructor Detail

Displayback to summary
public Display()

Method Detail

addDisplay2Listback to summary
protected static void addDisplay2List(final Display display)
addReferenceback to summary
public abstract int addReference() throws NativeWindowException

The 1st call will initiate native creation, since we follow the lazy creation pattern.

Returns:int

number of references post operation

Exceptions
NativeWindowException:
if the native creation failed.
See Also
removeReference()
createNativeback to summary
public abstract void createNative() throws NativeWindowException

Manual trigger the native creation, if it is not done yet.
This is useful to be able to request the com.jogamp.nativewindow.AbstractGraphicsDevice, via getGraphicsDevice().
Otherwise the abstract device won't be available before the dependent components (Screen and Window) are realized.

This method is usually invoke by addReference()

Exceptions
NativeWindowException:
if the native creation failed.
createPointerIconback to summary
public abstract Display.PointerIcon createPointerIcon(final IOUtil.ClassResources pngResource, final int hotX, final int hotY) throws IllegalArgumentException, IllegalStateException, IOException

Returns the newly created PointerIcon or null if not implemented on platform.

See PointerIcon for lifecycle semantics.

Parameters
pngResource:IOUtil.ClassResources

single PNG resource for the PointerIcon. Only the first entry of IOUtil.ClassResources#resourcePaths is used.

hotX:int

pointer hotspot x-coord, origin is upper-left corner

hotY:int

pointer hotspot y-coord, origin is upper-left corner

Exceptions
IllegalArgumentException:
if pngResource is null or invalid
IllegalStateException:
if this Display instance is not valid yet.
IOException:
if the pngResource could not be resolved or via the PNG parser processing the input stream.
See Also
PointerIcon, Window#setPointerIcon(PointerIcon)
createPointerIconback to summary
public abstract Display.PointerIcon createPointerIcon(final PixelRectangle pixelrect, final int hotX, final int hotY) throws IllegalArgumentException, IllegalStateException

Returns the newly created PointerIcon or null if not implemented on platform.

See PointerIcon for lifecycle semantics.

In case getNativePointerIconPixelFormat() or getNativePointerIconForceDirectNIO() is not matched by the given pixelrect, the pixelrect is converted into the required PixelFormat and NIO type.

Parameters
pixelrect:PixelRectangle

PixelRectangle source for the PointerIcon

hotX:int

pointer hotspot x-coord, origin is upper-left corner

hotY:int

pointer hotspot y-coord, origin is upper-left corner

Exceptions
IllegalArgumentException:
if pixelrect is null.
IllegalStateException:
if this Display instance is not valid yet.
See Also
PointerIcon, Window#setPointerIcon(PointerIcon), getNativePointerIconPixelFormat(), getNativePointerIconForceDirectNIO()
destroyback to summary
public abstract void destroy()

Manually trigger the destruction, incl. native destruction.

This method is usually invoke by removeReference()

dispatchMessagesback to summary
public abstract void dispatchMessages()
dumpDisplayListback to summary
public static void dumpDisplayList(final String prefix)
equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

return true if obj is of type Display and both FQN getFQName() equals

Parameters
obj:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getActiveDisplayNumberback to summary
public static int getActiveDisplayNumber()
getAllDisplaysback to summary
public static Collection<Display> getAllDisplays()

Returns the global display collection

getDisplayOfImplback to summary
private static Display getDisplayOfImpl(final String type, final String name, final int fromIndex, final int incr, final boolean shared)
getEDTUtilback to summary
public abstract EDTUtil getEDTUtil()
getFirstDisplayOfback to summary
public static Display getFirstDisplayOf(final String type, final String name, final int fromIndex, final boolean shared)
Parameters
fromIndex:int

start index, then increasing until found or end of list

shared:boolean

if true, only shared instances are found, otherwise also exclusive

getFQNameback to summary
public abstract String getFQName()
Returns:String

The fully qualified Display name, which is a key of getType() + getName() + getId().

getGraphicsDeviceback to summary
public abstract AbstractGraphicsDevice getGraphicsDevice()

Return the AbstractGraphicsDevice used for depending resources lifecycle, i.e. Screen and Window, as well as the event dispatching (EDT).

getHandleback to summary
public abstract long getHandle()

Return the handle of the AbstractGraphicsDevice as returned by getGraphicsDevice().

getIdback to summary
public abstract int getId()
Returns:int

this display internal serial id

getLastDisplayOfback to summary
public static Display getLastDisplayOf(final String type, final String name, final int fromIndex, final boolean shared)
Parameters
fromIndex:int

start index, then decreasing until found or end of list. -1 is interpreted as size - 1.

shared:boolean

if true, only shared instances are found, otherwise also exclusive

getNameback to summary
public abstract String getName()
Returns:String

This display connection name as defined at creation time. The display connection name is a technical platform specific detail, see AbstractGraphicsDevice#getConnection().

See Also
AbstractGraphicsDevice#getConnection()
getNativePointerIconForceDirectNIOback to summary
public abstract boolean getNativePointerIconForceDirectNIO()

Returns the native platform's direct NIO buffer requirement pointer-icon pixel data.

Using this value will avoid conversion within createPointerIcon(PixelRectangle, int, int).

getNativePointerIconPixelFormatback to summary
public abstract PixelFormat getNativePointerIconPixelFormat()

Returns the native platform's PixelFormat for pointer-icon pixel data.

Using this value will avoid conversion within createPointerIcon(PixelRectangle, int, int).

Known native pixel formats are:

getReferenceCountback to summary
public abstract int getReferenceCount()
Returns:int

number of references

getThreadNameback to summary
public static String getThreadName()
getTypeback to summary
public abstract String getType()
Returns:String

the native display type, ie com.jogamp.nativewindow.NativeWindowFactory#getNativeWindowType(boolean)

hashCodeback to summary
public abstract int hashCode()

Overrides java.lang.Object.hashCode.

return precomputed hashCode from FQN getFQName()

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object

Annotations
@Override
hashCodeNullSafeback to summary
public static int hashCodeNullSafe(final Object o)
isEDTRunningback to summary
public abstract boolean isEDTRunning()
Returns:boolean

true if EDT is running and not subject to be stopped, otherwise false.

isExclusiveback to summary
public abstract boolean isExclusive()

Return true if this instance is exclusive, i.e. will not be shared.

isNativeValidback to summary
public abstract boolean isNativeValid()
Returns:boolean

true if the native display handle is valid and ready to operate, otherwise false.

See Also
destroy()
removeReferenceback to summary
public abstract int removeReference()

The last call may destroy this instance, if getDestroyWhenUnused() returns true.

Returns:int

number of references post operation

See Also
addReference(), getDestroyWhenUnused(), setDestroyWhenUnused(boolean)
setEDTUtilback to summary
public abstract EDTUtil setEDTUtil(EDTUtil usrEDTUtil)

Sets a new EDTUtil and returns the previous one.

If usrEDTUtil is null, the device's default EDTUtil is created and used.

If a previous one exists and it differs from usrEDTUtil, it's being stopped, wait-until-idle.

If usrEDTUtil is not null and equals the previous one, no change is being made.

toHexStringback to summary
public static String toHexString(final int hex)
toHexStringback to summary
public static String toHexString(final long hex)
validateEDTStoppedback to summary
public abstract boolean validateEDTStopped()

Validate EDT running state.
Stop the running EDT in case this display is destroyed already.

Returns:boolean

true if EDT has been stopped (destroyed but running), otherwise false.

com.jogamp.newt back to summary

public Interface Display.PointerIcon

extends PixelRectangle
Known Direct Implementers
jogamp.newt.PointerIconImpl

Native PointerIcon handle.

Instances can be created via Display's createPointerIcon(pngResource, ..) or createPointerIcon(pixelrect, ..).

Instance is destroy()'ed automatically if it's associated Display is destroyed.

Instance can be re-validated after destruction via validate().

PointerIcon must not be destroyed while in use!

PointerIcon may be destroyed manually after use, i.e. when no Window uses them anymore. However, this is not required.

PointerIcons can be used via Window#setPointerIcon(PointerIcon).

Method Summary

Modifier and TypeMethod and Description
public void
destroy()

Destroys this instance.

public Display

Returns:

the associated Display
getDisplay
()

public PointImmutable
getHotspot()

Returns the hotspot.

public int
getStride()

Redeclares com.jogamp.nativewindow.util.PixelRectangle.getStride.

Always neatly packed, i.e. width * bytes_per_pixel.
public int
hashCode()

Redeclares com.jogamp.nativewindow.util.PixelRectangle.hashCode.

Computes a hash code over:
  • display
  • pixelformat
  • size
  • stride
  • isGLOriented
  • pixels
  • hotspot
public boolean
isGLOriented()

Redeclares com.jogamp.nativewindow.util.PixelRectangle.isGLOriented.

Always false, i.e. origin is TOP-LEFT.
public boolean
isValid()

Returns true if valid, otherwise false.

public boolean
validate()

Returns true if instance isValid() or validation was successful, otherwise false.

Inherited from com.jogamp.nativewindow.util.PixelRectangle:
getPixelformatgetPixelsgetSizetoString

Method Detail

destroyback to summary
public void destroy()

Destroys this instance.

Will be called automatically if it's associated Display is destroyed.

getDisplayback to summary
public Display getDisplay()
Returns:Display

the associated Display

getHotspotback to summary
public PointImmutable getHotspot()

Returns the hotspot.

getStrideback to summary
public int getStride()

Redeclares com.jogamp.nativewindow.util.PixelRectangle.getStride.

Doc from com.jogamp.nativewindow.util.PixelRectangle.getStride.

Always neatly packed, i.e. width * bytes_per_pixel.

Returns stride in byte-size, i.e. byte count from one line to the next.

Must be >= getPixelformat().bytesPerPixel() * getSize().getWidth().

Annotations
@Override
hashCodeback to summary
public int hashCode()

Redeclares com.jogamp.nativewindow.util.PixelRectangle.hashCode.

Doc from com.jogamp.nativewindow.util.PixelRectangle.hashCode.

Computes a hash code over:

  • display
  • pixelformat
  • size
  • stride
  • isGLOriented
  • pixels
  • hotspot
Dismissing the native handle!

The hashCode shall be computed only once with first call and stored for later retrieval to enhance performance.

Computes a hash code over:

  • pixelformat
  • size
  • stride
  • isGLOriented
  • pixels

The hashCode shall be computed only once with first call and stored for later retrieval to enhance performance.

Annotations
@Override
isGLOrientedback to summary
public boolean isGLOriented()

Redeclares com.jogamp.nativewindow.util.PixelRectangle.isGLOriented.

Doc from com.jogamp.nativewindow.util.PixelRectangle.isGLOriented.

Always false, i.e. origin is TOP-LEFT.

Returns true if the memory is laid out in OpenGL's coordinate system, origin at bottom left. Otherwise returns false, i.e. origin at top left.

isValidback to summary
public boolean isValid()

Returns true if valid, otherwise false.

A PointerIcon instance becomes invalid if it's associated Display is destroyed.

validateback to summary
public boolean validate()

Returns true if instance isValid() or validation was successful, otherwise false.

Validation, i.e. recreation, is required if instance became invalid, see isValid().