Le 29 avr. 2011 à 17:01, McLaughlin, Michael P. a écrit :

> 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));

[…]

I think this method has the drawback, as you said, to apply to the image as a 
whole, line width included.

Basically, if this helps, what I did for my simple GIS, where I also need to 
translate from one set of coordinates (geographical) to another (screen) was to 
use the Accelerate framework (CBLAS), that provides the dot product you're 
looking for and matrix multiplications to "concatenate" your various 
transforms. You can then compute the new coordinates and then draw directly to 
screen.

Vincent_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to