Using affine transforms
Using affine transforms
- Subject: Using affine transforms
- From: "McLaughlin, Michael P." <email@hidden>
- Date: Fri, 29 Apr 2011 11:01:03 -0400
- Acceptlanguage: en-US
- Thread-topic: Using affine transforms
I am writing the drawRect routine for a custom view in which I need to draw
a simple X-Y graph, given the data. Desiring to be elegant and up-to-date,
I decided that the best (Cocoa) way to do this was to construct a scaling
affine transform to change x,y coordinates into view coordinates using
CGAffineTransform matrix = CGAffineTransformMakeScale(360/(x2 - x1), 240/(y2
- y1));
followed by
CGContextConcatCTM(context, matrix);
When I tried this,
[graphPath stroke];
appeared to have applied the transform to the path linewidth as well. Is
this how it is supposed to work?
Since this would seem to be a common task, is there a recommended way to
keep linewidth = 1 (and likewise for data-point circles) or would I be
better off just doing the transformations "manually" beforehand?
TIA.
--
Mike McLaughlin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden