color transformations - problem with alpha

Hello all,

using this code snippet:

VGPath rect;
VGPaint green;
VGfloat alphaValues[] = { 1.0, 1.0, 1.0, 0.3, 0.0, 0.0, 0.0, 0.0 };
green = vgCreatePaint();
vgSetColor(green, 0x00FF00FF);
vgSetPaint(green, VG_FILL_PATH | VG_STROKE_PATH);
vgSetfv(VG_COLOR_TRANSFORM_VALUES, 8, alphaValues);
vgSeti(VG_COLOR_TRANSFORM, VG_TRUE);
vgDrawPath(rect, VG_FILL_PATH);

I would like to change the alpha channel of the green color to be 0.3. However it has no effect on alpha.
I was playing with it and for R,G,B channels the transformations worked.

EGLConfig Attributes:
{
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_ALPHA_SIZE, 0,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
EGL_NONE
}

Any idea why alpha remains unchanged ??

Thanks in advance for any comments/suggestions.
Martin

Your framebuffer format looks to be RGB565- it has no alpha channel, hence the result of the color transformation is lost once the color is written to the framebuffer.
When you read back the contents of the framebuffer, you are reading back the contents of the framebuffer and converting them into your destination format (RGBA8888 I’m guessing). The alpha value is always assumed 1 (0xFF) when reading sampling the 565 format.

Try using a surface format that has an alpha channel.

Thank you for the reply,

I switched to 8888 RGBA EGL-Pbuffer surface as it is the only surface having some alpha channel which my device supports.
When OpenVG rendering is done the Pbuffer is mapped to OpenGL ES texture and this is drawn to Window surface (565 RGB).

However the result is the same as before when rendering directly to Window surface; color transforms happen just for RGB channels while alpha remains unchanged.

Any idea what’s wrong ??

Thanks in advance for any suggestion.
Martin

My surface configs are as follows:
const int winConfigAttribs[] =
{
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_ALPHA_SIZE, 0,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT|EGL_OPENGL_ES_BIT,
EGL_NONE
};
const int pbConfigAttribs[] =
{
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT|EGL_OPENGL_ES_BIT,
EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE,
EGL_NONE
};
int pbSurfaceAttribs[] = {
EGL_WIDTH, 1024,
EGL_HEIGHT, 1024,
EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,
EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
EGL_NONE
};

Hi all,

it seems that problem is in OpenVG implementation I am using as with reference implementation it works well.

Martin