Results 1 to 5 of 5

Thread: Is the pattern image mutiplied by matrix PAINT to USER?

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Posts
    5

    Is the pattern image mutiplied by matrix PAINT to USER?

    When an image is used as a pattern, have I to do a Paint to User transform on that image? Or, just draw the path in User Space, and use the x,y of pixel P(5,5) to get the pattern image texel T(5,5), and transform to Surface at last?
    Thanks for your help!

  2. #2
    Senior Member
    Join Date
    Feb 2006
    Posts
    115
    Conceptually, the path user to surface transform is a matrix for transforming the path data (for example moving it around the screen).

    The Paint to user transforms on the other hand are for transforming the paint about on your path data (e.g. making use the texture is rotate 45 degrees).

    So if:
    Mu = Matrix: User to Surface Transform, and
    Mp = Matrix: Paint Transform
    P = Data coordinate [x y 1]^T
    C = Texel coordinate [x y 1]^T

    then the path data points (which give the shape) will be transformed with:
    Screen coordinate = Mu * P

    However, the colors that will appear on the screen are as if you drew the pixels under the this transformation:
    Mp * Mu * C

    Just play with it, you'll get the idea. Hope that helped.

  3. #3
    Junior Member
    Join Date
    Apr 2007
    Posts
    5
    That really help me. Thanks a lot!
    But I still have a question. If the pattern image is rotated, it may not be a rectangle anymore. So how to do pattern tiling with it?

  4. #4
    Senior Member
    Join Date
    Feb 2006
    Posts
    115
    Quote Originally Posted by Leezhang
    That really help me. Thanks a lot!
    But I still have a question. If the pattern image is rotated, it may not be a rectangle anymore. So how to do pattern tiling with it?
    vgSetParameter(Your_paint, VG_PAINT_PATTERN_TILING_MODE, mode);

    The allowed modes are:
    VG_TILE_FILL - tile color is used outside of the image
    VG_TILE_PAD - border of image is extended
    VG_TILE_REPEAT - image is repeated
    VG_TILE_REFLECT - image is repeatedly relfected

    If you just want to rotate the path data, you should just leave the paint matrix constant. The paint matrix only moves the paint relative to the path. As such, it's your responsibilty to make sure it doesn't move in a way you don't want by setting the paint matrix correctly.

  5. #5
    Junior Member
    Join Date
    Apr 2007
    Posts
    5
    Now I think I get this idea. Thank you very much!

Similar Threads

  1. Memory access pattern
    By nachovall in forum OpenCL
    Replies: 2
    Last Post: 10-13-2011, 04:20 PM
  2. Pattern drawing like image multiply draw mode
    By yuneng in forum OpenVG and VGU
    Replies: 5
    Last Post: 01-25-2008, 12:50 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
  •