• 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: NSBezierPath and affine transforms.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >NSBezierPath and affine transforms. (From: Tobias Sargeant <email@hidden>)

  • Prev by Date: Re: how to pause
  • Next by Date: TableView sending messages to released data source
  • Previous by thread: NSBezierPath and affine transforms.
  • Next by thread: Arguments to an NSTask
  • Index(es):
    • Date
    • Thread