title: NSImageView non-uniform scaling not possible with NSAffineTransform in Cocoa?
body: <p>I have been browsing the Internet for two days now, and apparently I'm missing something. I am trying to achieve a skewing effect for a <code>NSImageView</code>. I found <a href="https://stackoverflow.com/questions/12752331/how-do-i-create-an-nsaffinetransform-with-a-skew-effect">this question</a> on stack overflow, which suggests that it is possible. Also, in the <a href="https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaDrawingGuide/Transforms/Transforms.html#//apple_ref/doc/uid/TP40003290-CH204-BCIIICJI" rel="nofollow noreferrer">Apple Documentation</a> it suggests that a NSAffineTransform with a <code>NSAffineTransformStruct</code> is allowed.</p>
  
  <p>Nevertheless: it doesn't work. The only thing I am able to perform are <code>NSAffineTransform rotateByDegrees</code>, <code>NSAffineTransform scaleXBy:foo yBy:foo</code>. Everything else doesn't show any apparent effect. I don't get any errors, just no result.</p>
  
  <p>So my question is: is non-uniform scaling using <code>NSAffineTransform</code> not allowed for Apps on OSX? And if so, why doesn't Xcode (at least) warn me for this? Or am I missing something here (like a programming mistake)?</p>
  
  <p>Any help would be appreciated!</p>
  
  <p>The code I'm using:</p>
  
  <pre><code>- (void)drawRect:(NSRect)dirtyRect {
  [super drawRect:dirtyRect];
  
  // Drawing code here.
  NSAffineTransform *rotate = [[NSAffineTransform alloc] init];
  NSGraphicsContext *context = [NSGraphicsContext currentContext];
  
  [context saveGraphicsState];
  [currentImage lockFocus];
  [rotate setTransformStruct:currentTransForm]; //This is filled in another routine
  [rotate concat];
  
  /* Your drawing code [NSImage drawAtPoint....]for the image goes here
   Also, if you need to lock focus when drawing, do it here.       */
  CGRect imageRect = dirtyRect;
  
  [self.image drawInRect:imageRect fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0];
  [self.image unlockFocus];
  [context restoreGraphicsState];
  } 
  </code></pre>