Domanda

I want to do this: draw an image using Quartz 2D, the image look like rotated according to its y axis in a 3D space, like this: enter image description here

Is Quartz 2D capable to do this?

È stato utile?

Soluzione

No, you cannot do this directly with Quartz 2D. It supports only affine transformations, which always preserve parallel lines.

(It's clear that you want the parallel lines on the top and bottom edges of your figure to become non-parallel.)

The term you're looking for is "perspective transformation", if you want to search for other ways to achieve this result.

Altri suggerimenti

I don't know how to do it in 2d, but its really easy to do it with quartz using this kind of call:

yourView.layer.transform = CATransform3DMakeRotation(M_PI/4, 0.0, 0.0, 1.0);

You should look into using the CATransform3D's. They are pretty powerful and easy to call.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top