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


Permlink Replies: 8 - Pages: 1 - Last Post: 27-Jan-2017 16:03 Last Post By: davidekholm
Dschuwi

Posts: 469
Registered: 12-Nov-2003
How to check whether hiDpi is selceted
Posted: 25-Jan-2017 10:37
 
  Click to reply to this thread Reply
I need to determine whether hiDpi checkmarks are set or not. I cannot find it in the API.

How to test for hiDpi?
davidekholm

Posts: 3,576
Registered: 18-Oct-2002
Re: How to check whether hiDpi is selceted
Posted: 25-Jan-2017 13:10   in response to: Dschuwi in response to: Dschuwi
 
  Click to reply to this thread Reply
I recommend using these methods:
engine.getImageScale();
engine.getThumbScale();
They will return 1 for ordinary DPI and 2 (and in the future perhaps more) for HiDPI. You can simply multiply these values with the imageWidth, imageHeight, thumbWidth and thumbHeight values to get the true pixel size of the corresponding image.

"scale" is the technical term for the scale factor that is applied to all coordinates when painting to various screens. A scale factor of 1 corresponds to a classic 1/72" dot pitch screen.
jGromit

Posts: 7,524
Registered: 31-Jan-2006
Re: How to check whether hiDpi is selceted
Posted: 25-Jan-2017 13:48   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
There are also engine.isHiDPIImages() and engine.isHiDPIThumbs() - simple booleans, but without telling you anything about the scaling. For now, it's always 2, but...
Dschuwi

Posts: 469
Registered: 12-Nov-2003
Re: How to check whether hiDpi is selceted
Posted: 25-Jan-2017 16:11   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
I recommend using these methods:
engine.getImageScale();
engine.getThumbScale();

Works like a charm, thanks!
davidekholm

Posts: 3,576
Registered: 18-Oct-2002
Re: How to check whether hiDpi is selceted
Posted: 25-Jan-2017 20:33   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
jGromit wrote:
There are also engine.isHiDPIImages() and engine.isHiDPIThumbs() - simple booleans, but without telling you anything about the scaling. For now, it's always 2, but...

True, but multiplying getXXXScale with the width and height variables is always ensured to give you the true # of pixels, but if you're only interested in knowing if a "high" DPI is being used, then you can use the engine.isHiDPIImages() and engine.isHiDPIThumbs() calls.
Dschuwi

Posts: 469
Registered: 12-Nov-2003
Re: How to check whether hiDpi is selceted
Posted: 25-Jan-2017 21:33   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
if you're only interested in knowing if a "high" DPI is being used, then you can use the engine.isHiDPIImages() and engine.isHiDPIThumbs() calls.

That was my initial intention, it doesn't seem to be listed in the API docs though.

Which was good luck after all, since I need the scale factor anyway and I would not have asked here, getThumbScale() ist just perfect. :-)
jGromit

Posts: 7,524
Registered: 31-Jan-2006
Re: How to check whether hiDpi is selceted
Posted: 25-Jan-2017 21:34   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Yes, for both Matrix and NoPages, I simply need to know whether the option has been selected (images for Matrix, both images and thumbs for NoPages). The option is just incompatible, regardless of the scaling factor.
davidekholm

Posts: 3,576
Registered: 18-Oct-2002
Re: How to check whether hiDpi is selceted
Posted: 25-Jan-2017 21:48   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
I'm planning to update the API docs, but some Java update now puts increased syntactic rules on the existing Javadocs so they don't compile anymore. It's currently at 100 errors and then halted the javadoc compilation. Well well, I just have to find some tool that can replace all > and < references with > and < and & with & etc.
davidekholm

Posts: 3,576
Registered: 18-Oct-2002
Re: How to check whether hiDpi is selceted
Posted: 27-Jan-2017 16:03   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums