FMX.ImageZoom Sample
This sample uses the TGestureManager class to demonstrate how to zoom an image.
Contents
Location
You can find the ImageZoom sample project at:
- Start | Programs | Embarcadero RAD Studio Rio | Samples and then navigate to:
Object Pascal\Mobile Snippets\InteractiveGestures\ImageZoom
CPP\Mobile Snippets\InteractiveGestures\ImageZoom
- Subversion Repository:
- You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
Description
The ImageZoom sample demonstrates how to zoom an image on an iOS or Android device. The sample provides a picture and the user can zoom the picture by pinching it.
How to Use the Sample
- Navigate to one of the locations given above and open:
- Delphi: ImageZoom.dproj.
- C++: ImageZoom.cbproj.
- Select the target platform, iOS and Android supported.
- Press F9 or choose Run > Run.
- Pinch the picture to see how it zooms.
Files
File in Delphi | File in C++ | Contains |
---|---|---|
ImageZoom.dproj |
ImageZoom.cbproj |
The project itself. |
ImageZoomU.fmx |
ImageZoomU.fmx |
The main form where the components are located. |
ImageZoomU.pas |
ImageZoomPCH.h, ImageZoom.cpp |
Used to define and implement the sample. |
Information.txt |
Information.txt |
Further information about the sample. |
Implementation
- The sample uses TImage to display and define a 2D image component.
- The properties TImage.Position, TImage.Width and TImage.Height are used to specify the position and size of the image.
- The sample uses the TGestureManager class to manage all the touch and gesturing functionalities of the application. The TGestureEventInfo describes a gesture event. It is a record that contains information about a gesture event. The TGestureEvent type passes a TGestureEventInfo record to the user code.
The sample shows a picture. The sample uses the field GestureID of the TGestureEventInfo to identify a zoom gesture. When TGestureEventInfo identifies a zoom gesture, the sample uses the TImage.Position, TImage.Width and TImage.Height properties to zoom the picture.
Uses
- FMX.Objects.TImage
- FMX.Objects.TImage.Position
- FMX.Objects.TImage.Width
- FMX.Objects.TImage.Height
- FMX.Gestures.TGestureManager
- FMX.Types.TGestureEventInfo
See Also
- Images
- Mobile Tutorial: Taking and Sharing Pictures (iOS and Android)
- Gesturing Overview
- Using Gesturing in Your Applications