Unit conversion

PowerBuilder and iOS use different measurement systems to produce a consistent size of output that is device independent. In PowerBuilder, size is measured in PowerBuilder Units (PBUs), while in iOS, the measurement unit is Points (Notice that Point and Dot are used interchangeably in both Appeon documentation and product UI).

It is important for users to understand the concept of Point and how many Points in the width and height of each device type. Compared to Point, people are more familiar with Pixel, the measurement of the display resolution. In the iOS coordinate system, there is a mapping relationship between Pixel and Point, which is one Point equals to one Pixel on a standard-resolution screen, while one Point equals to two Pixels on a high-resolution screen (such as Retina Display). For details, please read the relevant page at Drawing and Printing Guide for iOS. Now understanding the relationship between Point and Pixel, you can easily figure out how many Points in the width and height of each device screen, as shown in the table below.

Table 1. Device screen size

Device

Display Resolution (in Pixels)

Screen Size (in Points)

iPad 2

1024 x 768 pixels

1024 x 768 points

iPad 3/4

2048 x 1536 pixels

1024 x 768 points

iPad mini

1024 x 768 pixels

1024 x 768 points

iPhone 4/4S or iPod Touch 4

640 x 960 pixels

320 x 480 points

iPhone 5/5C/5S or iPod Touch 5

640 x 1136 pixels

320 x 568 points

iPhone 6 750 x 1334 pixels 375 x 667 points
iPhone 6 Plus 1080 x 1920 pixels 414 x 736 points

Now that you understand how many Points in each device type, you can use the following formula to convert from Point to PBU:

Point-to-PBU conversion:

In the English environment:

In the X axis: PBUnit = (PointX x 6144 + 96 x 7) / (96 x 14)

In the Y axis: PBUnit = (PointY x 768 + 96) / (96 x 2)

In the Japanese environment:

In the X axis: PBUnit = (PointX x 6144 + 96 x 8) / (96 x 16)

In the Y axis: PBUnit = (PointY x 2048 + 96 x 3) / (96 x 6)

Notes:

PointX indicates the number of Point in the X axis.

PointY indicates the number of Point in the Y axis.

See also

Pixel-to-PBU conversion:

Since you can also easily get the display resolution (in Pixels) and PPI from the device specification, you may use the formula to convert from Pixel to PBU:

In the X axis: PBUnit = (PixelX x 6144 + PPI x 7) / (PPI x 14)

In the Y axis: PBUnit = (PixelY x 768 + PPI) / (PPI x 2)

Notes:

PixelX indicates the number of pixels in the X axis.

PixelY indicates the number of pixels in the Y axis.

PPI stands for Pixel Per Inch, which is 132 for iPad 2, 264 for iPad 3/4 and iPad mini, 326 for iPhone 4/4S/5/5C/5S/6 and iPod Touch 4/5, and 401 for iPhone 6 Plus.