Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Drawing at native resolution? XE6


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Jun 2, 2016 3:23 PM Last Post By: Ian Calegory
Ian Calegory

Posts: 6
Registered: 4/13/14
Drawing at native resolution? XE6  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 25, 2014 3:50 PM
How is it possible to access the device's native resolution? The native resolution on my Android device, HTD Evo 3D 4G, is 540x960, but with a default Canvas->Scale of 1.5 I'm only able to access 640x360 pixels.

I found this way that's supposed to enable access to a device's native resolution (this is Delphi code):
Canvas.SetMatrix(TMatrix.CreateScaling(1/Canvas.Scale,1/Canvas.Scale)* Canvas.Matrix);
(Found at this page: http://www.fmxexpress.com/three-graphics-tips-for-delphi-xe6-firemonkey-on-android-and-ios/)

However, I wasn't able to directly translate this code into C++ without adding some additional code to System.Math.Vectors.hpp. Here's the C++ translation:

Canvas->SetMatrix(TMatrix::CreateScaling(1/Canvas->Scale, 1/Canvas->Scale)*Canvas->Matrix);

This is the code I had to add to System.Math.Vectors.hpp to access the multiply operator:
TMatrix operator * (const TMatrix &AMatrix1, const TMatrix &AMatrix2) {
TMatrix::_op_Multiply(AMatrix1, AMatrix2);
}
TMatrix operator * (TMatrix &AMatrix1, TMatrix &AMatrix2) {
TMatrix::_op_Multiply(AMatrix1, AMatrix2);
}

After calling the transform function, SetMatrix(), above, Canvas->Scale still has the value of 1.5 when running on my Android device. Running this code in Delphi confirms that it hasn't changed Canvas.Scale there, either:
d := Canvas.Scale;
Canvas.SetMatrix(TMatrix.CreateScaling(1/Canvas.Scale,1/Canvas.Scale)* Canvas.Matrix);
d := Canvas.Scale;

I found this Delphi code, that enables me to get my device's actual screen resolution:
var ScreenSvc: IFMXScreenService;
Size: TPointF;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, IInterface(ScreenSvc)) then
begin
Size := ScreenSvc.GetScreenSize * ScreenSvc.GetScreenScale;
end;
end;

(Incidentally, I was unable to instantiate IFMXScreenService under C++... it gives me a "variable type 'IFMXScreenService' is an abstract class error"! Any ideas?)

Anyway, I'm able to get the device's actual resolution with this code, but how do I translate it into writing to the device at its native resolution?

Thanks for any pointers.
Ian

Edited by: Ian Calegory on Sep 25, 2014 3:50 PM

Edited by: Ian Calegory on Sep 25, 2014 3:51 PM

Edited by: Ian Calegory on Sep 29, 2014 9:56 AM
mike wendland

Posts: 15
Registered: 10/23/03
Re: Drawing at native resolution? XE6  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 2, 2014 12:33 PM   in response to: Ian Calegory in response to: Ian Calegory
This thread shows how to use the screenservice, this should get you what you need.

https://forums.embarcadero.com/thread.jspa?threadID=107859&tstart=0
Ian Calegory

Posts: 4
Registered: 8/9/15
Re: Drawing at native resolution? XE6  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 2, 2016 3:23 PM   in response to: mike wendland in response to: mike wendland
Thank you Mike!
Ian
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02