Search code examples
iosmacoscore-graphicscore-animationcgaffinetransform

How does CALayer geometryFlipped behave exactly?


Let's assume i have a CGPathRef called somePath and I'm doing this:

CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init];
shapeLayer.path = somePath;
shapeLayer.geometryFlipped = YES;

But for some reason i don't want to flip the geometry – i'd want to do something like this:

CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init];
CGAffineTransform flipTransform = ........;
shapeLayer.path = CGPathApplyAffineTransform(somePath, &flipTransform);
shapeLayer.geometryFlipped = NO;

How would the flipTransform have to look like to make the layer display exactly the same as before?

:)


Solution

  • CGAffineTransform flipTransform = CGAffineTransformMakeScale(1, -1);