https://github.com/feenkcom/fenster
I contain reusable components to help implement support of native windows
https://github.com/feenkcom/fenster
Last synced: 5 months ago
JSON representation
I contain reusable components to help implement support of native windows
- Host: GitHub
- URL: https://github.com/feenkcom/fenster
- Owner: feenkcom
- License: mit
- Created: 2020-01-09T19:46:24.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-12-12T18:25:50.000Z (over 2 years ago)
- Last Synced: 2023-12-13T19:15:14.587Z (over 2 years ago)
- Language: Smalltalk
- Size: 39.1 KB
- Stars: 1
- Watchers: 13
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fenster
```
das Fenster (Ger.) – a window
```
Contains reusable components to deal with various aspects of the native windows
## Geometry
When working with native windows we should handle two types of geometrical measurements: logical and physical.
For example, when creating a rendering surface, the size of that surface should be given in physical pixels, however when creating a window itself, the size is given in logical pixels.
The relation between logical and physical pixels is defined by the display scale factor which depends on the user OS settings and display's pixel density.
`fenster` models logical and physical metrics as first class objects and allows users to convert between them:
```smalltalk
logicalSize := FensterLogicalSize
width: 400
height: 300.
scaleFactor := 2.
physicalSize := logicalSize asPhysical: scaleFactor.
self assert: physicalSize asPoint equals: 800@600.
logicalSize := physicalSize asLogical: scaleFactor.
self assert: logicalSize asPoint equals: 400@300.
```