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 10 Seattle | Samples and then navigate to:
Object Pascal\Mobile Snippets\InteractiveGestures\ImageZoom
CPP\Mobile Snippets\InteractiveGestures\ImageZoom
- Subversion Repository:
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