Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Quickly Rotate An Image With Gestures On iOS And Android In Delphi FireMonkey

It displays a picture, which the user can rotate by pressing it with two fingers and rotating them. The image rotates in the direction that your fingers are pointing. The image rotates to the right when the fingers are rotated to the right. The image rotates to the left when the fingers are rotated to the left.

Location

You can find the ImageRotation sample project at:

How to Use the Sample

  1. Navigate to one of the locations given above and open:
    • Delphi: ImageRotation.dproj.
    • C++: ImageRotation.cbproj.
  2. Select the target platform, iOS and Android supported.
  3. Press F9 or choose Run > Run.
  4. Press the picture with two fingers and rotate them to see how the image rotates.

Files

File in DelphiFile in C++Contains
ImageRotation.dprojImageRotation.cbprojThe project itself.
ImageRotationU.fmxImageRotationU.fmxThe main form where the components are located.
ImageRotationU.pasImageRotationPCH.hImageRotation.cppUsed to define and implement the sample.
Information.txtInformation.txtFurther information about the sample.

Implementation

The sample shows a picture. When the user presses the picture with two fingers, the TGestureEventInfo detects a gesture event. If the user rotates the fingers, the sample calculates the rotation angle in order to rotate the image with the same angle.

The link below will guide you to the original post of Embarcadero:

http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FMX.ImageRotation_Sample

Head over and check out the full source code for the gesture-based image rotation on Embarcadero’s GitHub.

Do you want to quickly rotate an image with Gestures for iOS and Android? Try the Cross-Platform Development tool, which will assist you in developing apps in the Delphi or C++ environments.

Exit mobile version