Top Description Fields Constructors Methods
jogamp.nativewindow

public Class WrappedSurface

extends ProxySurfaceImpl
implements ScalableSurface
Class Inheritance
All Implemented Interfaces
com.jogamp.nativewindow.ScalableSurface
Known Direct Subclasses
jogamp.nativewindow.WrappedWindow, jogamp.opengl.egl.EGLSurface
Imports
com.jogamp.nativewindow.AbstractGraphicsConfiguration, .AbstractGraphicsDevice, .ProxySurface, .ScalableSurface, .UpstreamSurfaceHook, .UpstreamSurfaceHookMutableSize

Generic Surface implementation which wraps an existing window handle.
See Also
ProxySurface

Field Summary

Modifier and TypeField and Description
private final float[]
private long

Constructor Summary

AccessConstructor and Description
public
WrappedSurface(final AbstractGraphicsConfiguration cfg, final long
the wrapped pre-existing native surface handle, maybe 0 if not yet determined
handle
,
final int initialWidth, final int initialHeight, final boolean
true if this ProxySurface instance owns the AbstractGraphicsConfiguration's AbstractGraphicsDevice, otherwise false. Owning the device implies closing it at destroyNotify().
ownsDevice
)

Utilizes a UpstreamSurfaceHook.MutableSize to hold the size information, which is being passed to the ProxySurface instance.

public
WrappedSurface(final AbstractGraphicsConfiguration cfg, final long
the wrapped pre-existing native surface handle, maybe 0 if not yet determined
handle
,
final UpstreamSurfaceHook
the UpstreamSurfaceHook to be used
upstream
,
final boolean
true if this ProxySurface instance owns the AbstractGraphicsConfiguration's AbstractGraphicsDevice, otherwise false.
ownsDevice
)

Method Summary

Modifier and TypeMethod and Description
public final int[]
convertToPixelUnits(final int[]
int[2] storage holding the window units for the x- and y-coord to convert and the resulting values.
windowUnitsAndResult
)

Implements com.jogamp.nativewindow.NativeSurface.convertToPixelUnits.

Converts the given window units into pixel units in place.
public final int[]
convertToWindowUnits(final int[]
int[2] storage holding the pixel units for the x- and y-coord to convert and the resulting values.
pixelUnitsAndResult
)

Implements com.jogamp.nativewindow.NativeSurface.convertToWindowUnits.

Converts the given pixel units into window units in place.
public final float[]
getCurrentSurfaceScale(final float[]
float[2] storage for the result
result
)

Implements com.jogamp.nativewindow.ScalableSurface.getCurrentSurfaceScale.

Returns the current pixel scale of the associated NativeSurface.
public final float[]
getMaximumSurfaceScale(final float[]
float[2] storage for the result
result
)

Implements com.jogamp.nativewindow.ScalableSurface.getMaximumSurfaceScale.

Returns the maximum pixel scale of the associated NativeSurface.
public float[]
getMinimumSurfaceScale(final float[]
float[2] storage for the result
result
)

Implements com.jogamp.nativewindow.ScalableSurface.getMinimumSurfaceScale.

Returns the minimum pixel scale of the associated NativeSurface.
public final float[]
getRequestedSurfaceScale(final float[]
float[2] storage for the result
result
)

Implements com.jogamp.nativewindow.ScalableSurface.getRequestedSurfaceScale.

Returns the requested pixel scale of the associated NativeSurface.
public final long
getSurfaceHandle()

Implements abstract jogamp.nativewindow.ProxySurfaceImpl.getSurfaceHandle.

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceHandle.

Returns the handle to the surface for this NativeSurface.
protected void
invalidateImpl()

Overrides jogamp.nativewindow.ProxySurfaceImpl.invalidateImpl.

Must be overridden by implementations allowing having a UpstreamSurfaceHook being passed.
protected final int
public final void
setSurfaceHandle(final long surfaceHandle)

Implements abstract jogamp.nativewindow.ProxySurfaceImpl.setSurfaceHandle.

Implements com.jogamp.nativewindow.MutableSurface.setSurfaceHandle.

Sets the surface handle which is created outside of this implementation.
public final boolean
setSurfaceScale(final float[]
requested surface pixel scale float[2] values for x- and y-direction.
pixelScale
)

Implements com.jogamp.nativewindow.ScalableSurface.setSurfaceScale.

Request a pixel scale in x- and y-direction for the associated NativeSurface, where size_in_pixel_units = pixel_scale * size_in_window_units.
protected final void
Inherited from jogamp.nativewindow.ProxySurfaceImpl:
addSurfaceUpdatedListeneraddSurfaceUpdatedListeneraddUpstreamOptionBitsclearUpstreamOptionBitscontainsUpstreamOptionBitscreateNotifydestroyNotifydumpHierarchyenableUpstreamSurfaceHookLifecyclegetDisplayHandlegetGraphicsConfigurationgetScreenIndexgetSurfaceHeightgetSurfaceLockOwnergetSurfaceWidthgetUpstreamOptionBitsgetUpstreamOptionBitsgetUpstreamSurfacegetUpstreamSurfaceHookisSurfaceLockedByOtherThreadlockSurfaceremoveSurfaceUpdatedListenersetGraphicsConfigurationsetUpstreamSurfaceHooksurfaceSwapsurfaceUpdatedtoStringtoStringunlockSurfacevalidateSurfaceLocked

Field Detail

hasPixelScaleback to summary
private final float[] hasPixelScale
surfaceHandleback to summary
private long surfaceHandle

Constructor Detail

WrappedSurfaceback to summary
public WrappedSurface(final AbstractGraphicsConfiguration cfg, final long handle, final int initialWidth, final int initialHeight, final boolean ownsDevice)

Utilizes a UpstreamSurfaceHook.MutableSize to hold the size information, which is being passed to the ProxySurface instance.

Parameters
cfg:AbstractGraphicsConfiguration

the AbstractGraphicsConfiguration to be used

handle:long

the wrapped pre-existing native surface handle, maybe 0 if not yet determined

ownsDevice:boolean

true if this ProxySurface instance owns the AbstractGraphicsConfiguration's AbstractGraphicsDevice, otherwise false. Owning the device implies closing it at destroyNotify().

WrappedSurfaceback to summary
public WrappedSurface(final AbstractGraphicsConfiguration cfg, final long handle, final UpstreamSurfaceHook upstream, final boolean ownsDevice)
Parameters
cfg:AbstractGraphicsConfiguration

the AbstractGraphicsConfiguration to be used

handle:long

the wrapped pre-existing native surface handle, maybe 0 if not yet determined

upstream:UpstreamSurfaceHook

the UpstreamSurfaceHook to be used

ownsDevice:boolean

true if this ProxySurface instance owns the AbstractGraphicsConfiguration's AbstractGraphicsDevice, otherwise false.

Method Detail

convertToPixelUnitsback to summary
public final int[] convertToPixelUnits(final int[] windowUnitsAndResult)

Implements com.jogamp.nativewindow.NativeSurface.convertToPixelUnits.

Doc from com.jogamp.nativewindow.NativeSurface.convertToPixelUnits.

Converts the given window units into pixel units in place.

WrappedSurface's implementation uses the given pixelScale directly.

Parameters
windowUnitsAndResult:int[]

int[2] storage holding the window units for the x- and y-coord to convert and the resulting values.

Returns:int[]

result int[2] storage windowUnitsAndResult for chaining holding the converted values

Annotations
@Override
convertToWindowUnitsback to summary
public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult)

Implements com.jogamp.nativewindow.NativeSurface.convertToWindowUnits.

Doc from com.jogamp.nativewindow.NativeSurface.convertToWindowUnits.

Converts the given pixel units into window units in place.

WrappedSurface's implementation uses the given pixelScale directly.

Parameters
pixelUnitsAndResult:int[]

int[2] storage holding the pixel units for the x- and y-coord to convert and the resulting values.

Returns:int[]

result int[2] storage pixelUnitsAndResult for chaining holding the converted values

Annotations
@Override
getCurrentSurfaceScaleback to summary
public final float[] getCurrentSurfaceScale(final float[] result)

Implements com.jogamp.nativewindow.ScalableSurface.getCurrentSurfaceScale.

Doc from com.jogamp.nativewindow.ScalableSurface.getCurrentSurfaceScale.

Returns the current pixel scale of the associated NativeSurface.

Parameters
result:float[]

float[2] storage for the result

Returns:float[]

the passed storage containing the current pixelScale for chaining

Annotations
@Override
getMaximumSurfaceScaleback to summary
public final float[] getMaximumSurfaceScale(final float[] result)

Implements com.jogamp.nativewindow.ScalableSurface.getMaximumSurfaceScale.

Doc from com.jogamp.nativewindow.ScalableSurface.getMaximumSurfaceScale.

Returns the maximum pixel scale of the associated NativeSurface.

The maximum pixel scale maybe used to determine the proper dpi value of the monitor displaying this NativeSurface.

   surfacePpMM = monitorPpMM * currentSurfaceScale / nativeSurfaceScale,
   with PpMM == pixel per millimeter

Parameters
result:float[]

float[2] storage for the result

Returns:float[]

the passed storage containing the maximum pixelScale for chaining

Annotations
@Override
getMinimumSurfaceScaleback to summary
public float[] getMinimumSurfaceScale(final float[] result)

Implements com.jogamp.nativewindow.ScalableSurface.getMinimumSurfaceScale.

Doc from com.jogamp.nativewindow.ScalableSurface.getMinimumSurfaceScale.

Returns the minimum pixel scale of the associated NativeSurface.

Parameters
result:float[]

float[2] storage for the result

Returns:float[]

the passed storage containing the minimum pixelScale for chaining

Annotations
@Override
getRequestedSurfaceScaleback to summary
public final float[] getRequestedSurfaceScale(final float[] result)

Implements com.jogamp.nativewindow.ScalableSurface.getRequestedSurfaceScale.

Doc from com.jogamp.nativewindow.ScalableSurface.getRequestedSurfaceScale.

Returns the requested pixel scale of the associated NativeSurface.

Parameters
result:float[]

float[2] storage for the result

Returns:float[]

the passed storage containing the current pixelScale for chaining

Annotations
@Override
getSurfaceHandleback to summary
public final long getSurfaceHandle()

Implements abstract jogamp.nativewindow.ProxySurfaceImpl.getSurfaceHandle.

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceHandle.

Doc from com.jogamp.nativewindow.NativeSurface.getSurfaceHandle.

Returns the handle to the surface for this NativeSurface.

The surface handle should be set/update by lockSurface(), where unlockSurface() is not allowed to modify it. After unlockSurface() it is no more guaranteed that the surface handle is still valid. The surface handle shall reflect the platform one for all drawable surface operations, e.g. opengl, swap-buffer.

On X11 this returns an entity of type Window, since there is no differentiation of surface and window there.
On Microsoft Windows this returns an entity of type HDC.

Annotations
@Override
invalidateImplback to summary
protected void invalidateImpl()

Overrides jogamp.nativewindow.ProxySurfaceImpl.invalidateImpl.

Doc from jogamp.nativewindow.ProxySurfaceImpl.invalidateImpl.

Must be overridden by implementations allowing having a UpstreamSurfaceHook being passed.

Annotations
@Override
lockSurfaceImplback to summary
protected final int lockSurfaceImpl()

Implements abstract jogamp.nativewindow.ProxySurfaceImpl.lockSurfaceImpl.

Annotations
@Override
setSurfaceHandleback to summary
public final void setSurfaceHandle(final long surfaceHandle)

Implements abstract jogamp.nativewindow.ProxySurfaceImpl.setSurfaceHandle.

Implements com.jogamp.nativewindow.MutableSurface.setSurfaceHandle.

Doc from com.jogamp.nativewindow.MutableSurface.setSurfaceHandle.

Sets the surface handle which is created outside of this implementation.

Annotations
@Override
setSurfaceScaleback to summary
public final boolean setSurfaceScale(final float[] pixelScale)

Implements com.jogamp.nativewindow.ScalableSurface.setSurfaceScale.

Doc from com.jogamp.nativewindow.ScalableSurface.setSurfaceScale.

Request a pixel scale in x- and y-direction for the associated NativeSurface, where size_in_pixel_units = pixel_scale * size_in_window_units.

Default pixel scale request for both directions is AUTOMAX_PIXELSCALE.

In case platform only supports uniform pixel scale, i.e. one scale for both directions, either AUTOMAX_PIXELSCALE or the maximum requested pixel scale component is used.

The requested pixel scale will be validated against platform limits before native scale-setup, i.e. clipped to IDENTITY_PIXELSCALE if not supported or clipped to the platform maximum. It can be queried via getRequestedSurfaceScale(float[]).

The actual realized pixel scale values of the NativeSurface can be queried via getCurrentSurfaceScale(float[]) or computed via surface.convertToPixelUnits(new int[] { 1, 1 })

WrappedSurface's implementation is to simply pass the given pixelScale from the caller down to this instance without validation to be applied in the conversion methods only.
This allows the caller to pass down knowledge about window- and pixel-unit conversion and utilize mentioned conversion methods.

The given pixelScale will not impact the actual getSurfaceWidth() and getSurfaceHeight(), which is determinated by this instances upstream surface.

Implementation uses the default pixelScale ScalableSurface#IDENTITY_PIXELSCALE and resets to default values on invalidateImpl(), i.e. destroyNotify().

Implementation returns the given pixelScale array.

Parameters
pixelScale:float[]

requested surface pixel scale float[2] values for x- and y-direction.

Returns:boolean

true if the current pixel scale has changed, otherwise false.

Annotations
@Override
unlockSurfaceImplback to summary
protected final void unlockSurfaceImpl()

Implements abstract jogamp.nativewindow.ProxySurfaceImpl.unlockSurfaceImpl.

Annotations
@Override