Questions tagged [nsaffinetransform]

12 questions
5
votes
2 answers

Drawing an image in a NSView

I have a simple Obj C program that, at the moment, lets you load an image, draws it up, and theoretically should let you zoom and rotate. I'm using NSAffineTranslations. I want the image to be locked to the upper left (As opposed to the PS/PDF…
Brian Postow
  • 11,709
  • 17
  • 81
  • 125
2
votes
2 answers

Apply NSAffineTransform to NSView

I want to do a couple of simple transforms on an NSView subclass to flip it on the X axis, the Y axis, or both. I am an experienced iOS developer but I just can't figure out how to do this in macOS. I have created an NSAffineTransform with the…
mashers
  • 1,009
  • 7
  • 22
2
votes
1 answer

Is there a way to make NSAffineTransform from CGAffineTransform?

I'm trying to convert the iOS code to OSX code, and having some difficulties with graphics porting. Under iOS I had this: NSRect rect = NSMakeRect(centerX.doubleValue - width.doubleValue / 2, centerY.doubleValue -…
Eugene Gordin
  • 4,047
  • 3
  • 47
  • 80
2
votes
3 answers

Rotating an NSImage with or without NSAffineTransform

I've got an NSImage being drawn on a subclass of NSView. In a previous question, I was helped to draw it upright in the upper left corner. Now, I want to be able to rotate the image. I have a button that increments a rotation variable %4, and then I…
Brian Postow
  • 11,709
  • 17
  • 81
  • 125
1
vote
1 answer

NSAffineTransform vs AffineTransform (Swift)

I've been having a little success with NSAffineTransform but have come across AffineTransform which is presumably more Swifty. However it doesn't have a concat method, so how do you use it? I'm aiming to draw the same little BezierPath rotated…
AlexT
  • 596
  • 7
  • 15
1
vote
1 answer

Does NSAffineTransform have different Coordinate system in Mac OS X 10.11?

My project works well on Mac OSX 10.10/10.9, however it works incorrectly in 10.11 with this code: [(PDFAnnotationInk*)_activeAnnotation removeBezierPath:_path]; [_activeAnnotation setBounds:bound]; // Lazy, redraw…
SuperBerry
  • 1,193
  • 1
  • 12
  • 28
1
vote
1 answer

NSAffineTransforms not being used?

I have a subclass of NSView, and in that I'm drawing an NSImage. I'm unsing NSAffineTransforms to rotate, translate and scale the image. Most of it works fine. However, sometimes, the transforms just don't seem to get activated. For example, when I…
Brian Postow
  • 11,709
  • 17
  • 81
  • 125
1
vote
0 answers

NSAffineTransform running out of memory

I am using NSAffineTransform to rotate/ reflect an NSImage and when using larger images i run into an error: NSImage: Insufficient memory to allocate pixel data buffer of 4496342739800064 bytes The image i am transforming here is 6,998,487 bytes at…
BenJacob
  • 957
  • 10
  • 31
0
votes
1 answer

how to rotate an nscell

I am making a subclass of the NSLevelIndicatorCell and I want to draw it vertically. This doesn't work, what am I doing wrong? - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView{ [[NSGraphicsContext currentContext]…
joels
  • 7,249
  • 11
  • 53
  • 94
0
votes
1 answer

Using NSAffineTransform to rotate NSImage results in a file twice the size

I'm using the following code to flip (rotate by 180 degrees) an NSImage. But the new image is twice the size (MBs, not dimensions) of the original when saved to disk. I want it to be approximately the same as the original. How can I accomplish this?…
0
votes
1 answer

Resizing weirdness in custom View with isFlipped YES

I'm having a hard time getting my subview to behave properly. I am using auto-layout. My main window is an NSSplitView. One of the views in the split view is a custom view, where I set -(BOOL)isFlipped { return YES; } An added subview in this…
Carelinkz
  • 936
  • 8
  • 27
0
votes
1 answer

how to translate and scale a NSImage?

I have built so far an application that allows the user to drag and drop images onto a NSImageView. However, I want to be able to move these images by simply clicking on any image and hold down the mouse button to move it's location. How can I…