-2

I have an image component for drawing an autograph. At the moment you have to set a scale property mannually in order to let it draw correctly, because each device has an other screen density.

Is there a way to calculate the scale or not to have to use the scale for both Android and iOS?

As you can read in the following link every android and iOS device have a different screen density: http://docwiki.embarcadero.com/RADStudio/XE8/en/Using_Multi-Resolution_Bitmaps

Also tried this method but it does not give the correct scale:

function GetScreenScale: Single;
var
   ScreenService: IFMXScreenService;
begin
   Result := 1;
   if TPlatformServices.Current.SupportsPlatformService (IFMXScreenService, IInterface(ScreenService)) then
   begin
      Result := ScreenService.GetScreenScale;
   end;
end;
Remi
  • 1,289
  • 1
  • 18
  • 52
  • I'm sure there's a way to calculate the scale. What result are you seeking? What result are you getting instead? Posting some code or screen shots might help describe the problem. – Rob Kennedy May 11 '15 at 13:37
  • 1
    I deleted my answer, which you clearly did not understand. If you could only understand what I said then you'd be fine. I would have helped you understand, but you downvoted me! Anyway, good luck. – David Heffernan May 15 '15 at 07:15
  • @DavidHeffernan I did understand but it just wasn't correct – Remi May 15 '15 at 07:16
  • 1
    You did not understand. I could explain, but you don't want to listen. Never mind. If you would like to me try again, please let me know. In the interests of good faith, you took `ImageWidth` to mean the width of your image control, and that is not what was meant. – David Heffernan May 15 '15 at 07:17
  • How do you figure that I don't want to listen? I do want to listen. But I need to get screen properties in order to solve my question so i know your solution can't work. – Remi May 15 '15 at 08:52

1 Answers1

0

Solution:

function GetScreenScale: Single;
var
   Service : IFMXScreenService;
begin
   Service := IFMXScreenService(
      TPlatformServices.Current.GetPlatformService(IFMXScreenService));
   Result := Service .GetScreenScale;
end;
Remi
  • 1,289
  • 1
  • 18
  • 52