objective c - CGRectApplyAffineTransform not doing anything? -


i'm new cgaffine world. know why transformation doesn't work/take ?

  1. i have valid pdfcontext created uigraphicsbeginpdfcontexttodata , following current matrix:

    cgaffinetransform curmat = cgcontextgetctm(context); nslog (@"current context matrix: %f %f %f %f %f %f", curmat.a, curmat.b, curmat.c, curmat.d, curmat.tx, curmat.ty); 
  2. nslog values:

    current matrix: 1.000000 0.000000 -0.000000 -1.000000 0.000000 792.000000

  3. i create transformation matrix with:

    cgaffinetransform xform = cgaffinetransformmake(a, b, c, d, tx, ty); 
  4. nslog values:

    transform matrix: 0.062500 0.000000 0.000000 0.062500 0.000000 0.000000

  5. i rect from:

    cgrect pdfbounds = uigraphicsgetpdfcontextbounds(); 
  6. nslog values:

    pdfbounds: 0.000000 0.000000 612.000000 792.000000

  7. i apply transformation matrix with:

     cgrectapplyaffinetransform (pdfbounds, xform); 
  8. then re-check current matrix value with:

    cgaffinetransform curmat2 = cgcontextgetctm(context); nslog (@"current context matrix after transformation: %f %f %f %f %f %f", curmat2.a, curmat2.b, curmat2.c, curmat2.d, curmat2.tx, curmat2.ty) 
  9. and nslog values same @ beginning.

    current context matrix after transformation: 1.000000 0.000000 -0.000000 -1.000000 0.000000 792.000000

what missing ? why transformation not happening/taking ? thank you.

you ignoring result of applied transformation , not applying transformation context.

step 7 should be:

cgcontextconcatctm(context, xform); 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -