Results 1 to 6 of 6

Thread: VG_SCISSOR_RECTS

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Location
    INDIA
    Posts
    29

    VG_SCISSOR_RECTS

    When ever we want to enable scissoring in openvg, does the scissoring rectangle co-ordinate always starts with reference to the bottom-left corner(0,0 of OpenVG canvas) of the screen OR can we specify it w.r.t the current co-ordinate system.May be the following example will clarify this more.

    VGPath vgPath1;
    int bitField=1;
    VGfloat coords[4]={0,0,25,55};
    VGfloat fillColor[4]={1,0,1,1};
    VGPaint myFillPaint = vgCreatePaint();
    VGfloat strokeColor[4]={1.0,0.0,0.0,1.0};
    vgPath1 = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, (unsigned int)VG_PATH_CAPABILITY_ALL);

    //set FillmyPath


    vgSetParameteri(myFillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
    vgSetParameterfv(myFillPaint, VG_PAINT_COLOR, 4, fillColor);
    vgSetPaint(myFillPaint, VG_FILL_PATH);

    vgLoadIdentity();
    vgTranslate(20,20);

    vgSeti(VG_SCISSORING,VG_TRUE);
    vgSetfv(VG_SCISSOR_RECTS,4,coords);

    vguRect(vgPath1, 0,0,50,50);

    vgDrawPath(vgPath1, bitField);

    So, the above o/p is that the rectangle with fillcolor as PINK(RGB(1,0,1,1) is drawn not at the origin(i.e bottom left corner of the screen), but the ractangle gets drawn with the origin getting shifted by (20,20) because of vgTranslate(20,20).

    But the scissoring rectangle is still (0,0,25,55) i.e. its origin is still at the bottom left corner.My question is can i specify the scissoring rectangle to also start from (20,20).

    I dont want to mention the coords as (20,20,25,55) but i want to mention is as (0,0,25,55) but my intention is this rectangle will start from the current active co-ordinate system and NOT from the bottom left corner of the screen.

  2. #2
    Senior Member
    Join Date
    May 2006
    Posts
    353

    Re: VG_SCISSOR_RECTS

    Quote Originally Posted by mustaf
    I dont want to mention the coords as (20,20,25,55) but i want to mention is as (0,0,25,55) but my intention is this rectangle will start from the current active co-ordinate system and NOT from the bottom left corner of the screen.
    Scissoring (part of stage 5 of the OpenVG pipeline) comes after transformation (stage 3). Scissor rectangles are given in integer pixel coordinates and cannot be rotated or sheared, they are always rectangles in surface space. Thus applying an arbitrary transformation is not possible.

    It shouldn't be hard to translate your scissor rectangles manually along with your path translations, though.
    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
    Aug 2007
    Location
    INDIA
    Posts
    29
    Thanks George, yes it is true that scissor rectangles cant be rotated or skewed.But i have just applied translation and any rectangle remains rectangle after translation transformation.Then why am i not able to shift my scissor rectangle w.r.t origin?..Could you explain bit more?..

    Also, i did not understand the alternative you suggested, if you can throw more light on that, too it would be great.


    Thanks for your help again,

    Regs,
    Mustaf

  4. #4
    Senior Member
    Join Date
    May 2006
    Posts
    353
    Quote Originally Posted by mustaf
    Thanks George, yes it is true that scissor rectangles cant be rotated or skewed.But i have just applied translation and any rectangle remains rectangle after translation transformation.Then why am i not able to shift my scissor rectangle w.r.t origin?..Could you explain bit more?..
    Because OpenVG offers no way to express that you only ever want to translate and that you want to apply this translation to the scissor rectangles.

    Adding this would increase the complexity of the API for little gain. You can already do what you want by simply translating your scissor rectangles manually.

    Also, i did not understand the alternative you suggested, if you can throw more light on that, too it would be great.
    Exactly what you were describing in the initial post: just change the coordinates you pass into vgSetfv(VG_SCISSOR_RECTS, ...).
    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

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

    Re: VG_SCISSOR_RECTS

    Quote Originally Posted by mustaf
    ...

    I dont want to mention the coords as (20,20,25,55) but i want to mention is as (0,0,25,55) but my intention is this rectangle will start from the current active co-ordinate system and NOT from the bottom left corner of the screen.
    There is no "active co-ordinate system" in OpenVG.
    Paths are transformed by one matrix, images by another.
    Scissoring, however, applies to both paths and images, as well as things like vgClear(), vgCopyPixels(), etc, which have no transformation matrix at all.

    Best to do as Xmas suggests - it's easy. Just keep a copy of the original co-ordinate scissor boxes and make a copy to which you simply add the x & y offsets to each scissorbox starting coordinate.

  6. #6
    Junior Member
    Join Date
    Aug 2007
    Location
    INDIA
    Posts
    29

    Thank you

    Thanks to both of you gentleman.Yes, i can do it by manually modifying the scissoring rectangle, but i just wanted to know whether OVG has support to change the scissor rectangle w.r.t. co-ordinate system.

    It got clear now, thanks again.

Posting Permissions

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