Re: NSAffineTransform scaleBy not scaling

2009-12-04 Thread Shane
> Yes, you are transforming the pointsPath 'in place'. That was it. > I thought I'd mentioned the need to do that in my previous message: "You'll > need to regenerate a new path for each plot though, as the path will be > permanently changed by the above." I guess it wasn't clear what I meant b

Re: NSAffineTransform scaleBy not scaling

2009-12-04 Thread Graham Cox
On 05/12/2009, at 10:59 AM, Shane wrote: > Anyone see anything wrong that I'm doing? Yes, you are transforming the pointsPath 'in place'. You need to make a copy of the original path, apply the transform to it and draw the copy. Making a copy every time in drawRect: should be OK unless your p

Re: NSAffineTransform scaleBy not scaling

2009-12-04 Thread Greg Guerin
Shane wrote: So my thought is that somehow the transformations are not resetting to the identity matrix, but they are as far as I can tell. Maybe, I'm thinking, that the transforms are being added on top of each other as the view resizes. That's a fair description of what your code is doing.

Re: NSAffineTransform scaleBy not scaling

2009-12-04 Thread Shane
> That then just leaves you with the translation to deal with, for positioning > the scaled path where you want it. > I really hate to post this again, but I believe I'm doing it right, but there's obviously something I'm not understanding. By trying to figure out what's wrong w/ my scaling, I've

Re: NSAffineTransform scaleBy not scaling

2009-12-01 Thread Graham Cox
On 02/12/2009, at 3:42 PM, Shane wrote: > - (void) appendPoint:(NSPoint) point > { > if (firstPoint) { > [pointsPath moveToPoint:point]; > > firstPoint = NO; > } > > [pointsPath lineToPoint:point]; > > pointCoun

Re: NSAffineTransform scaleBy not scaling

2009-12-01 Thread Shane
> The problem is that the code you've posted is not the whole story. Sorry about that, just for clarity, here's how I'm filling the path. I will try to work with what you posted. Thanks. - (void) appendPoint:(NSPoint) point { if (firstPoint) { [pointsPath moveToPoin

Re: NSAffineTransform scaleBy not scaling

2009-12-01 Thread Graham Cox
On 02/12/2009, at 3:03 PM, Shane wrote: > Still trying to make this work right using > transformUsingAffineTransform. If I add in translateXBy or scaleXBy, > my wave (pointsPath) show up all wrong, not translated or scaled, but > if I comment them out (as is below), my wave appears just fine, it'

Re: NSAffineTransform scaleBy not scaling

2009-12-01 Thread Shane
Still trying to make this work right using transformUsingAffineTransform. If I add in translateXBy or scaleXBy, my wave (pointsPath) show up all wrong, not translated or scaled, but if I comment them out (as is below), my wave appears just fine, it's just not scaled. Am I not using them correctly?

Re: NSAffineTransform scaleBy not scaling

2009-11-30 Thread Graham Cox
On 01/12/2009, at 3:21 PM, Shane wrote: > I'm trying to keep the stroke path > the same size, even thought I resize and scale the entire NSBezierPath > to the view size. Having a little trouble figuring out how to do this. Instead of concatenating your transform to the current graphics context,

Re: NSAffineTransform scaleBy not scaling

2009-11-30 Thread Shane
Just adding the other methods for clarification. - (void) drawAxes:(NSRect) rect { NSRect bounds = [self bounds]; NSBezierPath *path = [NSBezierPath bezierPath]; [path moveToPoint:NSMakePoint(0.1, 0.0)]; [path lineToPoint:NSMakePoint((bound

Re: NSAffineTransform scaleBy not scaling

2009-11-30 Thread Shane
> But the order of operations you apply to the transform is the reverse of what > you might think will happen. One way to simplify the maths slightly is to > generate the graph path using a fixed reference bounds of 1 x 1, located at > the origin. Then you can directly use your view's size and p

Re: NSAffineTransform scaleBy not scaling

2009-11-30 Thread Graham Cox
On 01/12/2009, at 12:55 PM, Shane wrote: > I'm drawing a graphing line, looks like a wave within an NSView. The > line looks fine, except that it's not scaled to the size of the > window. So my problem is trying to figure out how to scale it to the > window size and every time that the window is

Re: NSAffineTransform scaleBy not scaling

2009-11-30 Thread Stephen J. Butler
On Mon, Nov 30, 2009 at 7:55 PM, Shane wrote: > Anyone see what I'm doing wrong here, or know how to get the > NSBezierPath to take up 90% of my NSView (leaving 10% blank for > borders which is what I tried to do below)? You call concat before you apply the scale. Do the translate, scale, and the

NSAffineTransform scaleBy not scaling

2009-11-30 Thread Shane
Hey all, I'm drawing a graphing line, looks like a wave within an NSView. The line looks fine, except that it's not scaled to the size of the window. So my problem is trying to figure out how to scale it to the window size and every time that the window is resized. I currently have something like