PDA

View Full Version : linear gradient



tinuhp
11-22-2007, 05:28 AM
Hi
I have a doubt on linear gradients in openVG

I draw an ellipse and wnat to have an output such that along a line I should get variant of shades of same color......(color in which the ellipse is drawn)

I have used the following Code:

VGfloat coords[4]= {250.0,340.0,250.0,160.0};
shadowPaint = vgCreatePaint(); vgSetParameteri(shadowPaint,VG_PAINT_TYPE,VG_PAINT _TYPE_LINEAR_GRADIENT);
vgSetParameterfv(shadowPaint,VG_PAINT_LINEAR_GRADI ENT,4,coords);
circle = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
vguEllipse(circle, 250.0f,250.0f, 180.0f, 180.0f);
vgSetPaint(shadowPaint, VG_FILL_PATH);
vgDrawPath( circle, VG_FILL_PATH );


But I see a grayuniformly shaded ellipse
But I need an ellipse with variants of black color.....
What is going wrong here...

Expecting reply.........

Xmas
11-22-2007, 05:58 AM
Where is your color ramp?

tinuhp
11-22-2007, 07:37 AM
If I am not wrong color ramps are used for setting colors...
I dont want colors ...
I want variants of the single color (black which is the default)
The same code when I use with radial gradient, I can see the radial gradient effect there.
Why is not the case with Linear Gradient????????

Ivo Moravec
11-22-2007, 12:06 PM
Hi
I have a doubt on linear gradients in openVG

I draw an ellipse and wnat to have an output such that along a line I should get variant of shades of same color......(color in which the ellipse is drawn)

I have used the following Code:

VGfloat coords[4]= {250.0,340.0,250.0,160.0};
shadowPaint = vgCreatePaint(); vgSetParameteri(shadowPaint,VG_PAINT_TYPE,VG_PAINT _TYPE_LINEAR_GRADIENT);
vgSetParameterfv(shadowPaint,VG_PAINT_LINEAR_GRADI ENT,4,coords);
circle = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
vguEllipse(circle, 250.0f,250.0f, 180.0f, 180.0f);
vgSetPaint(shadowPaint, VG_FILL_PATH);
vgDrawPath( circle, VG_FILL_PATH );


But I see a grayuniformly shaded ellipse
But I need an ellipse with variants of black color.....
What is going wrong here...

Expecting reply.........

Well, theoretically and from just inspection, the code should work as you intended it to. I'm assuming you're leaving your fill paint matrix at identity. It's customary to set a color ramp after setting a linear gradient, so maybe you've discovered a bug in whatever OpenVG driver you're using. Try setting a ramp and/or moving the coords a little to see what's going wrong.

Expecting praise, love, and a brighter tommorow....... but wont be too disappointed if I don't get anything.