Results 1 to 4 of 4

Thread: linear gradient

  1. #1
    Junior Member
    Join Date
    Oct 2007
    Posts
    13

    linear gradient

    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.........

  2. #2
    Senior Member
    Join Date
    May 2006
    Posts
    353
    Where is your color ramp?
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  3. #3
    Junior Member
    Join Date
    Oct 2007
    Posts
    13
    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????????

  4. #4
    Senior Member
    Join Date
    Feb 2006
    Posts
    115

    Re: linear gradient

    Quote Originally Posted by tinuhp
    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.

Similar Threads

  1. Linear Interpolation for floats
    By ice in forum OpenCL
    Replies: 7
    Last Post: 03-14-2010, 01:36 AM
  2. Linear gradients
    By gmit in forum OpenVG and VGU
    Replies: 3
    Last Post: 01-11-2007, 12:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •