[Drawkit] Transforms / ScaleBy

Michael Caron michael.r.caron at gmail.com
Tue Apr 7 15:45:37 PDT 2009


Hi all,

I'm trying to understand the use of Affine Transforms through the use  
of DKLayer::applyTransformToObjects. Let me give some context.

So I have a Drawing with a grid layer, a guide layer and a drawing  
layer. The grid layer is setup to use a centimeter span. I  
programatically add some DK objects like a few DKDrawablePaths, a few  
DKArcPaths. At the end of adding objects, I get the bounding box for  
the layer. Then I create an Affine Transform to scale everything by  
1000 (to go to cm to mm). I'm a bit surprised to find it doesn't work  
as I thought.

Bounding Box Before Transform:
	x = 16.023.9811
	y = 15.9680157
	w = 18.1520519
	h = 18.1520519

Transform:
	NSAffineTransform* txfm = [NSAffineTransform transform];
	[txfm scaleBy: 1000];
	[currentLayer applyTransformToObjects:txfm];

Bounding Box After Transform:
	x = 25086.7695
	y = 25030.8047
	w = 26.4765625
	h = 26.4765625

I would have expected the size of the bounding box to scale by 1000 if  
the shapes contained in it scale by 1000. Thus yielding a bounding box  
like this:

	x = 16023.9811
	y = 15968.0157
	w = 18152.0519
	h = 18152.0519

Am I missing something here? Did the transform take the grid into  
consideration when scaling? I expected that it would simply rescale in  
quartz.


Michael
------------------------------------------------
michael.r.caron at gmail.com
http://techrad.wordpress.com
http://mrcaron.wordpress.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20090407/e1886683/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20090407/e1886683/attachment.pgp>


More information about the Drawkit mailing list