Recent

Author Topic: Pixels versus Points  (Read 3800 times)

Dan3468298

  • Full Member
  • ***
  • Posts: 131
Pixels versus Points
« on: July 15, 2020, 11:37:59 pm »
In Lazarus using the LCL (I am currently using Cocoa) I am having trouble finding what metric Laz uses for control dimensions.  Is it Points or Pixels (i.e. Dots)?   
MacOS 10.15.5/Lazarus 2.0.10 Build 2020-07-07

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Pixels versus Points
« Reply #1 on: July 16, 2020, 12:00:48 am »
Left/Top/Width/Height are (should be) in Pixel.

But: The Designer stores the PPI (Pixel per Inch) value, for which those measurements where correct. So if you open the form on a device with different PPI then everything will be scaled.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Pixels versus Points
« Reply #2 on: July 16, 2020, 12:18:45 am »
Hi!

Take care with Fonts:

Size is Points
Height is Pixels

Winni

Dan3468298

  • Full Member
  • ***
  • Posts: 131
Re: Pixels versus Points
« Reply #3 on: July 16, 2020, 01:58:15 pm »
Can Points Per Inch (PPI) always be assumed to be 72?
MacOS 10.15.5/Lazarus 2.0.10 Build 2020-07-07

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: Pixels versus Points
« Reply #4 on: July 16, 2020, 02:09:21 pm »

Dan3468298

  • Full Member
  • ***
  • Posts: 131
Re: Pixels versus Points
« Reply #5 on: July 16, 2020, 03:08:40 pm »
Thanks!
MacOS 10.15.5/Lazarus 2.0.10 Build 2020-07-07

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Pixels versus Points
« Reply #6 on: July 16, 2020, 04:02:36 pm »
You can disable scaling though, if that is what you want.
https://wiki.lazarus.freepascal.org/High_DPI#High_DPI_in_Lazarus_1.8_and_above


Dan3468298

  • Full Member
  • ***
  • Posts: 131
Re: Pixels versus Points
« Reply #7 on: July 16, 2020, 04:48:25 pm »
Is TForm.DesignTimePPI Points Per Inch?  When application is running what property do I use to get current Points Per Inch?  Thanks
MacOS 10.15.5/Lazarus 2.0.10 Build 2020-07-07

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Pixels versus Points
« Reply #8 on: July 16, 2020, 04:52:37 pm »
Not sure about point. Maybe you can use Monitor.PixelsPerInch function.

Higher resolution displays usually have higher PPI. In printer, they usually call it DPI.

iPhone 6 Plus has 401 PPI:
https://en.wikipedia.org/wiki/Retina_display#Models
« Last Edit: July 16, 2020, 05:06:41 pm by Handoko »

Dan3468298

  • Full Member
  • ***
  • Posts: 131
Re: Pixels versus Points
« Reply #9 on: July 16, 2020, 04:53:42 pm »
Can Points Per Inch (PPI) always be assumed to be 72?
No, you can't assume that.

https://www.photoshopessentials.com/essentials/the-72-ppi-web-resolution-myth/

That article is only about Pixels.  I am wondering about Points https://en.wikipedia.org/wiki/Point_(typography) where DTP defined a Point as 1/72 Inches.  Should I ignore Points and only consider Pixels and the Pixels per Inch because Lazarus only does that?
« Last Edit: July 16, 2020, 04:55:34 pm by Dan3468298 »
MacOS 10.15.5/Lazarus 2.0.10 Build 2020-07-07

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Pixels versus Points
« Reply #10 on: July 16, 2020, 05:02:38 pm »
On Cocoa widgetset DPI is 96.
https://wiki.freepascal.org/Cocoa_DPI

There's a special behavior added to draw higher quality images for Retina displays.
But overall DPI is assumed to be 96.
(even though the native macOS is 72)

Dan3468298

  • Full Member
  • ***
  • Posts: 131
Re: Pixels versus Points
« Reply #11 on: July 16, 2020, 05:08:00 pm »
On Cocoa widgetset DPI is 96.
https://wiki.freepascal.org/Cocoa_DPI

There's a special behavior added to draw higher quality images for Retina displays.
But overall DPI is assumed to be 96.
(even though the native macOS is 72)

Thanks for pointing this out.
MacOS 10.15.5/Lazarus 2.0.10 Build 2020-07-07

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: Pixels versus Points
« Reply #12 on: July 16, 2020, 05:18:26 pm »
Can Points Per Inch (PPI) always be assumed to be 72?
No, you can't assume that.
https://www.photoshopessentials.com/essentials/the-72-ppi-web-resolution-myth/
That article is only about Pixels.  I am wondering about Points https://en.wikipedia.org/wiki/Point_(typography) where DTP defined a Point as 1/72 Inches.  Should I ignore Points and only consider Pixels and the Pixels per Inch because Lazarus only does that?
You also take about PPI (which is pixels per inch and not points per inch).

Anyway... you can never assume point or dots per inch of 72. For example richedit can have 72 dpi while a printer has 300, 600 or 1200 dpi.

It all depends on what you are taking about.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Pixels versus Points
« Reply #13 on: July 16, 2020, 05:37:35 pm »
I am wondering about Points https://en.wikipedia.org/wiki/Point_(typography) where DTP defined a Point as 1/72 Inches.  Should I ignore Points and only consider Pixels and the Pixels per Inch because Lazarus only does that?
The D in DPI is a "dot". For screens a dot nearly always means a picture element or pixel. Screen pixels vary in size, and are not always square. A pixel refers to an item of hardware, and is not a measurement. Early cathode ray tube screens had pixels whose size was determined by the width of the electron beam that was aimed at a curved glass screen covered in phosphorescent materials.

For printers, a "dot" represents a splodge of ink, and the printer resolution determines the smallest splodge the printer can produce. The distance between printer dots or splodges is commonly measured in points, an ancient measurement, predating the computer era. A point is always exactly 1/72 inch. It is a measurement, not a specific item of hardware.

Dan3468298

  • Full Member
  • ***
  • Posts: 131
Re: Pixels versus Points
« Reply #14 on: July 19, 2020, 04:39:48 pm »
On Cocoa widgetset DPI is 96.
https://wiki.freepascal.org/Cocoa_DPI

There's a special behavior added to draw higher quality images for Retina displays.
But overall DPI is assumed to be 96.
(even though the native macOS is 72)

Shouldn't:
Code: Pascal  [Select][+][-]
  1. Panel1.Width := Round(96 * 3.5);

result in a panel 3.5 inches wide on screen?  If I measure with a ruler, its about 2.68 inches.   
« Last Edit: July 19, 2020, 04:43:36 pm by Dan3468298 »
MacOS 10.15.5/Lazarus 2.0.10 Build 2020-07-07

 

TinyPortal © 2005-2018