iOS Question Can someone explain Screen Pixels on iOS?

Andrew A Gray

Member
Licensed User
I was just wanting to put up a 1280x720 image up on an iPhone, (no problem, right?)

Then I found this table:

B4X:
Device          Points    Pixels     Scale  Physical Pixels   Physical PPI  Size
iPhone X        812x375   2436x1125  3x     2436x1125         458           5.8"
iPhone 6 Plus   736x414   2208x1242  3x     1920x1080         401           5.5"
iPhone 6        667x375   1334x750   2x     1334x750          326           4.7"
iPhone 5        568x320   1136x640   2x     1136x640          326           4.0"
iPhone 4        480x320   960x640    2x     960x640           326           3.5"
iPhone 3GS      480x320   480x320    1x     480x320           163           3.5"

WTF???

I used Erel's smiley code to put up the 1280x720 image on my iPhone 6, and the image
spilled off the screen, acting like it was 736 pixels wide.

What is going on with screen size, screen pixels, and scale? How can one find all this info in ones program?

What's the best way to put up a 1280x720 image from a bitmap onto the screen so it
doesn't crop or stretch but fills as much as possible, perhaps No Scaling if the screen "pixel size" is close.

In other words, what B4i function do I call to get the REAL SCREEN PIXEL SIZE and scale factor?

And what is up with the peculiar values for the iPhone 6 Plus (see above)???
That is, there is a difference between "Pixels" and "Phyiscal Pixels"? WTF?
 
Last edited:

Andrew A Gray

Member
Licensed User
OK, I found this:

"On my iPhone 6, LayoutValues.Scale returns 1 and LayoutValues.NonnormalizedScale returns 2"


Is this the correct syntax for B4i? :
B4X:
   Dim LayoutVal As LayoutValues
   LayoutVal = GetDeviceLayoutValues  

   Width = LayoutVal.Width
   ...

I will give this a try. Whew.

Andrew
 
Upvote 0

Andrew A Gray

Member
Licensed User
Add an ImageView anchored to all sides with ContentMode set to FIT.

OK, I know "FIT" would work, but our app again deals with motion jpeg (mjpeg) which are periodic jpeg images received rapidly.
So I want to minimize scaling load.

Do you think, for example, that on my iPhone 6 Plus (2208x1242), a

1280 --> 2208 = 1.725 scale

would be much slower than a

1280 --> 1920 = 3:2 scale??? (leaving a small black border)

I know that if I were writing the scaling algorithm , the 3:2 scaling would be much faster.
That is what I am after.

(on the iPhone5 & 6, the 1136 & 1334 widths are close enough to 1280 to leave the scaling 1:1 )

Andrew

P.S. on my iPhone6 Plus, the

LayoutVal.NonnormalizedScale --> 3
LayoutVal.Width ------------------> 736
LayoutVal.Height -----------------> 414

Making the Pixel Size 2208x1242 (and NOT 1920x1080 as shown in wacky chart above)

Thank you for your support and for this forum.

 
Upvote 0
Top