sprite/cursor extension ideas

Brian Paul brian.paul at tungstengraphics.com
Sat May 21 05:43:51 PDT 2005


Support for cursors or sprites should be a separate extension layered 
on EGL_MESA_screen_surface.

Here's a brain-dump of what I think is needed (I'm going to use the 
term "sprite"):

1. Support for multiple, full-color RGBA sprites.

2. Separate the notion of a "sprite" and a "sprite image".  For 
example, the hardware may support displaying a single sprite at a time 
but you might pre-define any number of sprite images.  You could 
quickly cycle through them with a "BindSpriteImage" function for 
animated effects.

3. To specify a sprite image, we might use a function like this:

    EGLSpriteImageMESA eglSpriteImage(EGLint width, EGLint height,
                                      EGLint xorigin, EGLint yorigin,
                                      EGLint format, EGLint type,
                                      const void *image)

    A new EGLSpriteImageMESA handle would be returned for the image.
    Format and type are similar to glDrawPixels but for the time
    being we might only support EGL_RGBA / EGL_UNSIGNED_BYTE.

    If we provided a way to query the depth of each color channel
    for the sprite, could we avoid color-index mode entirely?
    For example, if only 4 shades of grey were supported, perhaps
    querying the color depths would return {4, 0, 0, 2} implying
    a GL_LUMINANCE-like grayscale image with binary alpha.

    Otherwise, the format/type parameters could be used to express
    color-index sprite images, I suppose.

4. Other needed functions:

    Set a sprite's position (should Y=0 be bottom or top?)
    Query a sprite's position.
    Set sprite's current sprite image.
    Query sprite image binding.
    Query number of available sprites per screen (may be zero)
    Query max width/height sprite image size.
    Query sprite image data.
    Show/hide a sprite (maybe bind EGL_NO_SPRITE_IMAGE to hide)

5. If multiple sprites are supported, what happens when two or
    more overlap?  Should a stacking order be defined?


I encourage someone to start working on the spec.

-Brian


More information about the dri-egl mailing list