Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodCode SnippetDelphiFiremonkeyIOSOSXWindows

Three Graphics Tips For Delphi XE6 Firemonkey On Android And IOS

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE6 Firemonkey Graphics Tips | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSHere are three different graphics question and answer tips from the Firemonkey section on StackOverflow:

#1: How do I flood fill a TCanvas with Firemonkey?

The given solution recommends defining path data in a TPathData and then flood filling the path with TCanvas.FillPath. TPathData is pretty useful as you can use it to draw all kinds of custom shapes in Firemonkey with it as well.

#2: How can I access every pixel on a mobile define screen when all the resolutions are different?

The solution basically says that you can draw with the native device resolution by inverting the scaling with TCanvas.SetMatrix like this:

Canvas.SetMatrix(TMatrix.CreateScaling(1/ Canvas.Scale,1/ Canvas.Scale)* Canvas.Matrix)

#3: How can I display an image full screen with TImageView on mobile devices without distortion?

The recommended solution is to place the TImageView inside of a ScaledLayout and then use the Screen.Size property to scale the ScaledLayout component based on the screen size.

screenSize: TSize;
  screenSize := Screen.Size;
  ScaledLayout1.Scale.X := / ScaledLayout1.OriginalWidth;
  ScaledLayout1.Scale.Y := / ScaledLayout1.OriginalHeight;

The code from these tips should work cross platform on all Firemonkey supported platforms which are Android, IOS, Windows, and OSX.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts

Unleashing Creativity With Song Writer AI: A Deep Dive


How To Build Stable Diffusion Text To Image Prompts


FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes


Ryzen 9 5950x: One Billion Lines Of Delphi Code Compiled In ~5 Minutes On 16 Cores

Sign up for our Newsletter and
stay informed

Leave a Reply