Bug 1107 - Refine PixelFormat, GLPixelBuffer and DirectDataBufferInt/BufferedImageInt
Summary: Refine PixelFormat, GLPixelBuffer and DirectDataBufferInt/BufferedImageInt
Alias: None
Product: Jogl
Classification: JogAmp
Component: core (show other bugs)
Version: 2.3.0
Hardware: All all
: --- enhancement
Assignee: Sven Gothel
Depends on:
Reported: 2014-12-06 21:11 CET by Sven Gothel
Modified: 2019-03-29 17:54 CET (History)
1 user (show)

See Also:
Type: ---
SCM Refs:
Workaround: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2014-12-06 21:11:47 CET
- PixelFormat 
  Refine definition allowing complete format conversion by its attributes
  instead of static 'knowledge'.

  - PixelFormat has_a *new* PixelFormat.Composition

  - PixelFormat.Composition contains all pixel component layout
    information as required for inspection and conversion.
    Component names are enumerated via PixelFormat.CType.

  - PixelFormatUtil.convert(..) utilizes generic conversion 
    based on PixelFormat.Composition rather static type mapping. 
    However, a int32 RGBA static conversion is still supported for performance.
    Utilizes Bitstream for varying pixel component bit-width.

  - Complete w/ hashCode() and equals(..)

- GLPixelBuffer
  - Take 'pack' mode into account when determine GLPixelAttributes,
    i.e. on GLES pack=true (e.g. glReadPixel) only RGBA is guaranteed to work.
    Hence querying GLPixelAttributes requires the GLProfile, PixelFormat and pack mode.

  - Complete GLPixelAttributes conversions from PixelFormat or GL format/data-type,
    while taking GL data-type into account, as well as pack-mode.

  - Complete w/ hashCode() and equals(..)

  - SingletonGLPixelBufferProvider queries singleton GLPixelBuffer via 
      - PixelFormat.Composition hostPixelComp, 
      - GLPixelAttributes pixelAttributes, 
      - boolean pack
    which comprise a unique key, allowing the implementation to utilize 
    a hash map. This is implemented in AWTSingletonGLPixelBufferProvider.
    This allows distinct singleton GLPixelBuffer for different 
    host PixelFormat (conversion) and GLPixelAttributes (depending on GLProfile).

  - Removes field 'componentCount' which was 'hacked in' to pass
    information about an optional host memory layout.
    Implementations utilizing conversion, e.g. AWTGLPixelBuffer,
    can implement GLPixelBufferProvider's 
      'PixelFormat.Composition getHostPixelComp(final GLProfile glp, final int componentCount)'
    and manage such implementation details, see use-case GLJPanel.
- DirectDataBufferInt/BufferedImageInt: Expose underlying NIO ByteBuffer

- AWTMisc.createCursor(..) uses DirectDataBufferInt.BufferedImageInt exposed 
  NIO ByteBuffer, allowing to use generic PixelFormatUtil.convert(..).
Comment 1 Sven Gothel 2014-12-06 21:12:43 CET
a53e87a84c92444e8a3173f25ce86dcfd536d6a8: Fixed as described