[Mono-osx] [MonoMac] CGAffineTransform question
kjpou
kjpou at pt.lu
Sun Feb 6 05:29:10 EST 2011
Hello everyone
Is there any reason for the naming convention used in the
CGAffineTransform structure? When I went for the matrix expecting a tx
and ty (as well as a, b, c, d) had to look up which one was which.
Maybe adding convenience properties would help in this situation.
public struct CGAffineTransform {
public float xx; // a
public float yx; // b
public float xy; // c
public float yy; // d
public float x0; // tx
public float y0; // ty
Even in the following methods they are referred to as tx and ty
public void Translate (float tx, float ty)
{
Multiply (MakeTranslation (tx, ty));
}
public static CGAffineTransform MakeTranslation (float tx,
float ty)
{
return new CGAffineTransform (1, 0, 0, 1, tx, ty);
}
In all my dealings with a graphics matrix the variables are usually
defined a, b, c, d, tx, ty respectively.
That would also coincide with the documentation.
CGAffineTransformMake
Returns an affine transformation matrix constructed from values you provide.
CGAffineTransform CGAffineTransformMake (
CGFloat a,
CGFloat b,
CGFloat c,
CGFloat d,
CGFloat tx,
CGFloat ty
);
Parameters
a
The value at position [1,1] in the matrix.
b
The value at position [1,2] in the matrix.
c
The value at position [2,1] in the matrix.
d
The value at position [2,2] in the matrix.
tx
The value at position [3,1] in the matrix.
ty
The value at position [3,2] in the matrix.
Return Value
A new affine transform matrix constructed from the values you specify.
Discussion
This function creates a CGAffineTransform structure that represents a
new affine transformation matrix, which you can use (and reuse, if you
want) to transform a coordinate system. The matrix takes the following form:
Kenneth
More information about the Mono-osx
mailing list