Re: NSBezierPath and affine transforms.
Re: NSBezierPath and affine transforms.
- Subject: Re: NSBezierPath and affine transforms.
- From: "Alastair J.Houghton" <email@hidden>
- Date: Tue, 9 Sep 2003 10:09:38 +0100
On Tuesday, September 9, 2003, at 07:03 am, Tobias Sargeant wrote:
Is there any way to defer output from an NSBezierPath? I'm doing some
graph
layout, which involves various filled and unfilled paths. Ideally I
would
like to be able to set up an affine transform to draw the graph at the
right
scale, and then just have the layout object draw itself with the path
object without needing to know about the transform. If I could delay
the
result of a fill/stroke, then I could apply the transformation once
after
the layout object had drawn itself, and then everything would be happy.
AFAICS, the only way to get around this would be for you to create a
list of NSBezierPaths that you wanted to draw, as well as any
attributes that needed to be set (e.g. the colour, line style, fill
style), then have something else do the transform and stroking/filling.
What's wrong with your layout object knowing the transform you wish to
apply?
Because I only want the graph drawn with this transformation, and
NSView
doesn't seem to provide any means of pushing/popping transformation
matrices,
I can't see any way to set up the transform on the view.
You can use
[NSGraphicsContext saveGraphicsState]
and
[NSGraphicsContext restoreGraphicsState]
to push/pop graphics state (including transformation matrices).
*However*, if you are drawing a graph, you need to be careful... if you
apply a transformation to a view, all of the line attributes will be
transformed as well; for example, if I apply the matrix
(2 0)
(0 1)
to my view, then vertical lines will be twice as thick as horizontal
ones, although horizontal lines will obviously be twice the length.
That probably isn't what you want.
Kind regards,
Alastair.
_______________________________________________
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.