Best Way to Rotate

  • Now that I've got my data structure handling down to functional, I'm
    focusing on other things, like how to actually draw something useful.  I'm
    creating a shape rendering object (no shape creation yet) and am wrestling
    with how much should be done in rendering and how much in creation (i.e.,
    creating/drawing the shapes).

        I like the idea of each shape (at least ones having fill/content) having
    its own coordinate system.  Maybe that's not the best approach.  Shapes can
    contain a shader, an NSImage, a QTMovie, text etc.  The philosophy of
    rotation has now become an issue: Rotate the Bezier or rotate the
    coordinates?

        Rotating the Bezier had advantages, one being that you can then easily
    get its bounds when needed.  Rotating the coordinates creates problems for a
    Bezier in determining bounds, especially if it contains curved segments.  In
    the latter case, it appears that the only solution is to also rotate a copy
    of the Bezier so you can ask for its bounds.

        I don's see a way to rotate an NSImage, so it looks like rotating
    coordinates is de rigueur.  OTOH, rotating coordinates for drawing isn't
    going to work for a QTMovie.  The movie is expected to play and be clipped
    rotated regardless of what else is going on, so the movie object itself has
    to be rotated.  I assume that text will do ok in coordinate rotation, so I
    don't think that's an issue.

        Any thoughts on these issues.  Am I just going to have to handle each
    content type independently like I described?
  • On Oct 27, 2007, at 2:17 PM, Gordon Apple wrote:

    > I like the idea of each shape (at least ones having fill/
    > content) having
    > its own coordinate system.  Maybe that's not the best approach.
    > Shapes can
    > contain a shader, an NSImage, a QTMovie, text etc.  The philosophy of
    > rotation has now become an issue: Rotate the Bezier or rotate the
    > coordinates?

    My instinct is to rotate the coordinates, but that's without knowing
    much about your requirements.

    > I don's see a way to rotate an NSImage, so it looks like rotating
    > coordinates is de rigueur.  OTOH, rotating coordinates for drawing
    > isn't
    > going to work for a QTMovie.  The movie is expected to play and be
    > clipped
    > rotated regardless of what else is going on, so the movie object
    > itself has
    > to be rotated.  I assume that text will do ok in coordinate
    > rotation, so I
    > don't think that's an issue.

    CoreAnimation is likely an ideal solution for you if you can target
    Leopard. It will handle all the media types and will do all of the
    rotation math for you.

        - Scott
  • Sorry, I wasn't totally clear that I was talking about a stationary draw
    object.  However, your answer is relevant because I would like to eventually
    do some fancy animations like spinning a half-screen-centered QTMovie up to
    a reduced size position in the corner.

        I decided I was trying to make the rendering problem too hard.  Instead,
    except for the applied transform, I'm going to keep the rendering as simple
    as possible and put the computational burden on the create/edit phase.  One
    implication is that I will need to store a separate drawing bounds rect for
    draw-decision testing and for invalidation.  The create/edit code is where I
    will need to rotate a copy of the Bezier as part of computing the drawing
    bounds that will be  needed later in the rendering.

        If I transform before drawing the shape, that should also handle
    contained text (using my own container flow object) or an NSImage.  I'm
    still not clear on how to handle a contained QTMovie, but I'll research that
    more thoroughly when I get there.

    > On Oct 27, 2007, at 2:17 PM, Gordon Apple wrote:
    >
    >> I like the idea of each shape (at least ones having fill/
    >> content) having
    >> its own coordinate system.  Maybe that's not the best approach.
    >> Shapes can
    >> contain a shader, an NSImage, a QTMovie, text etc.  The philosophy of
    >> rotation has now become an issue: Rotate the Bezier or rotate the
    >> coordinates?
    >
    > My instinct is to rotate the coordinates, but that's without knowing
    > much about your requirements.
    >
    >
    >> I don's see a way to rotate an NSImage, so it looks like rotating
    >> coordinates is de rigueur.  OTOH, rotating coordinates for drawing
    >> isn't
    >> going to work for a QTMovie.  The movie is expected to play and be
    >> clipped
    >> rotated regardless of what else is going on, so the movie object
    >> itself has
    >> to be rotated.  I assume that text will do ok in coordinate
    >> rotation, so I
    >> don't think that's an issue.
    >
    > CoreAnimation is likely an ideal solution for you if you can target
    > Leopard. It will handle all the media types and will do all of the
    > rotation math for you.
    >
    > - Scott
previous month october 2007 next month
MTWTFSS
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        
Go to today