• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Shearing with NSAffineTransform
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shearing with NSAffineTransform


  • Subject: Re: Shearing with NSAffineTransform
  • From: Edwin Zacharias <email@hidden>
  • Date: Wed, 29 May 2002 20:45:25 -0400

Thanks for the info. I wonder why Apple doesn't add some methods for shearing? It would take five minutes.

I have two more drawing questions.

First, what is the relationship between a view's bounds and the transformation matrix?

Second. I'm trying to draw an image to a rectangular portion of a view so that the image crops if it's larger than that portion. The image is rotated so using drawAtPoint:fromRect:... will not work. I either need something to select a diamond shape from the image to draw or some way to restrict drawing to a rectangular portion of the view. I hope this makes sense.

-Edwin


On Wednesday, May 29, 2002, at 05:07 PM, Thomas Lachand-Robert wrote:


Le mardi 28 mai 2002, ` 04:27 , Edwin Zacharias a icrit :

Can someone post a quick example of doing shearing with NSAffineTransform?
I can't seem to find one in the documentation.


A shearing matrix (in the x direction) has the form {1, s, 0, 1}, where s is the shearing coefficient; use {1, 0, s, 1} for shearing in the y direction.
So you need to use NSAffineTransform setTransformStruct with these values (plus two zero values for the translation coefficients).

For instance with s = 2, you get the matrix {1, 2, 0, 1}. The four vertices of the unit square will change as follows:
(0, 0) -> (0, 0)
(1, 0) -> (1, 0)
(1, 1) -> (3, 1)
(0, 1) -> (2, 1)
hence the two bottom points don't change, but the two top points are moved by s = 2 in the horizontal direction, which gives the shearing.


Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Shearing with NSAffineTransform (From: Thomas Lachand-Robert <email@hidden>)

  • Prev by Date: Drag & Drop Table View - A Simple Version?
  • Next by Date: Re: Drag & Drop Table View - A Simple Version?
  • Previous by thread: Re: Shearing with NSAffineTransform
  • Next by thread: Handling a mouse event
  • Index(es):
    • Date
    • Thread