objective c - Dynamically scale and translate shape -
i drawing series of uibezierpath's, of have different sizes , locations. scale each shape specific size , move specific location on uiview
. working cgaffinetransformation
right now. becoming messy, location , size not work shapes.
is there way can scale uibezierpath
specific size , translate (move) specific location work shapes? maybe there way set size , location of shape without having use transformations unaware of? shapes drawing different in size, jagged edges.
this doing far affinetransformations.
cgaffinetransform scale = cgaffinetransformmakescale(2.0f,2.0f); [path applytransform:scale]; cgaffinetransform move = cgaffinetransformmaketranslation(-10, -10); [path applytransform:move];
where path
uibezierpath
.
is correct? values using (-10, 2.0f) examples.
what looking how apply affine transform bezier path. sure can, method:
- (void)applytransform:(cgaffinetransform)transform;
this how structure defined:
struct cgaffinetransform { cgfloat a; cgfloat b; cgfloat c; cgfloat d; cgfloat tx; cgfloat ty; }; typedef struct cgaffinetransform cgaffinetransform;
and fields meaning:
fields
a
entry @ position [1,1] in matrix.
b
entry @ position [1,2] in matrix.
c
entry @ position [2,1] in matrix.
d
entry @ position [2,2] in matrix.
tx
entry @ position [3,1] in matrix.
ty
entry @ position [3,2] in matrix.
reference:
Comments
Post a Comment