Professional Web Applications Themes

how do I flip a bezierpath vertically? - Mac Programming

I can't find a nsaffinetransform function to do a vertical flip on a bezier path. Is there one hiding somewhere? Or is there another simple way to flip a path? It is made up of straight lines, all connected, in a closed path, if that makes it easier. Thanks...

  1. #1

    Default how do I flip a bezierpath vertically?

    I can't find a nsaffinetransform function to do a vertical flip on a
    bezier path. Is there one hiding somewhere? Or is there another simple
    way to flip a path? It is made up of straight lines, all connected, in
    a closed path, if that makes it easier.

    Thanks
    None Guest

  2. #2

    Default Re: how do I flip a bezierpath vertically?

    In article <161120032057328513%com>, None <com>
    wrote:
     

    I haven't done it myself, but you build your transform matrix as follows:

    Translate so the flip axis gets moved to the X axis, apply the identity
    matrix, except use -1 for the Y column, then translate back to the
    original position. (Since Y is now flipped, this _might_ be in the
    opposite direction from what you'd niavely expect.)
    David Guest

  3. #3

    Default Re: how do I flip a bezierpath vertically?

    In article <sf.sbcglobal.net>,
    David Phillip Oster <org> wrote:
     
    >
    > I haven't done it myself, but you build your transform matrix as follows:
    >
    > Translate so the flip axis gets moved to the X axis, apply the identity
    > matrix, except use -1 for the Y column, then translate back to the
    > original position. (Since Y is now flipped, this _might_ be in the
    > opposite direction from what you'd niavely expect.)[/ref]

    Reflection over line y = k corresponds to the matrix

    | 1 0 0 |
    | 0 -1 2k |
    | 0 0 1 |

    (i.e. x' = x, y' = 2k - y)

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

  4. #4

    Default Re: how do I flip a bezierpath vertically?

    Thanks to both for the help. For follow up, in case of future seekers,
    it also turns out there is a (almost) built-in way to do a flip
    NSAffineTransform. As shown in the sample Sketch program from Apple:


    if (flippedHorizontally || flippedVertically) {
    // If the image needs flipping, we need to play
    some games with the transform matrix
    NSAffineTransform *transform = [NSAffineTransform
    transform];
    [transform scaleXBy:([self flippedHorizontally] ?
    -1.0 : 1.0) yBy:([self flippedVertically] ? -1.0 : 1.0)];
    [transform translateXBy:([self flippedHorizontally]
    ? -bounds.size.width : 0.0) yBy:([self flippedVertically] ?
    -bounds.size.height : 0.0)];
    [transform concat];
    }
    None Guest

Similar Threads

  1. Align Text Vertically
    By kathie2020@yahoo.com in forum Adobe Indesign Macintosh
    Replies: 3
    Last Post: May 5th, 02:01 PM
  2. Is there a way to orient text vertically?
    By wolfv in forum Coldfusion - Advanced Techniques
    Replies: 7
    Last Post: July 30th, 02:32 AM
  3. Traking the mouse vertically
    By gerkintrigg in forum Macromedia Flash Actionscript
    Replies: 1
    Last Post: March 3rd, 10:19 PM
  4. Draggable Sprites (but only vertically)
    By Mintyman in forum Macromedia Director Basics
    Replies: 2
    Last Post: December 18th, 10:38 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139