Comments (4)
Why was this closed? I can't find an upstream issue you hinted at.
from orbtk.
This is a good feature to implement. I am unsure where the features should go, that is, which library. My guess would be orbclient and orbfont
from orbtk.
orbclient and orbfont could be the right place, because then not only orbtk is benefits from HiDPI scaling.
from orbtk.
I tried out the orbtk examples on a macbook and noticed it didn't handle DPI scaling.
I think that orbtk and orbclient may need to both be aware of DPI scaling (orbfont, however, hopefully doesn't need to care, as orbtk can just request scaled font sizes to accommodate). I'll try and enumerate some of the things to consider when handling DPI, in case it helps orbtk in the future.
orbclient/orbtk_shell:
- Window creation: orbtk needs to be able to request a window sized in logical pixels and a framebuffer sized in physical pixels.
- It looks like the way to handle HiDPI in e.g.
minifb
is to pass a buffer larger than the window size toupdate_with_buffer
(emoon/minifb#50). I'm sure each window library handles this slightly differently, while some might not expose the functionality at all! - For the web, the canvas should be sized based on physical pixels and have a CSS size in "points" (rust-windowing/winit#1233).
- It looks like the way to handle HiDPI in e.g.
- Window resize: orbclient/orbtk_shell would need to handle the dpi scale potentially changing as its own event and/or during resize. IIRC this is difficult to get right cross-platform without missing frames or jittering for a couple frames during the transition.
- Note that the DPI scale factor isn't necessarily a whole number and can go below 1.0 on the web.
orbtk:
- API coordinates: HiDPI scaling is just what happens when physical pixels and logical pixels are not equal, so we need to document which "pixels" each method takes (for user sanity, it should mostly be logical pixels).
- Most user events/coordinates would be in "points" or "logical pixels" or "window pixels" (or whatever one wants to call it), which shouldn't pose much of an issue for existing users (I believe just redocumtening pixels to be points and adding DPI-specific APIs is how Apple initially transitioned devs onto the iPhone 4 retina screens.)
- There should be some API to allow a stack of (image) resources at different scale factors and some logic for orbtk to pick the right one.
- DPI scale factor needs to be queryable so that raw 2D/3D canvases can correctly handle different scale factors (alternately, raw canvases can apply a scale factor at the root and just really trust the rendering API to get it right)
from orbtk.
Related Issues (20)
- [FAQ] Is this project dead? HOT 2
- Simple Example of ListView HOT 2
- Cannot run on Rust 2021 edition HOT 4
- Impossible to select the last tab after the previous last tab was closed HOT 2
- Text looks vague in macos HOT 5
- Is there a widget like TabLayout HOT 1
- About other languages HOT 5
- The Canvas example is missing
- How to solve it that undefined symbols for architecture x86_64 ?
- Hi is there a discord server for this? HOT 6
- Does not compile on Mac M1 Silicon / Arm64 architecture HOT 6
- Compilation failure: "Could not find native static library `SDL2main`" on Gentoo HOT 7
- Undefined symbols for architecture x86_64 HOT 1
- current develop branch breaks on MacOS, showing black window HOT 3
- Is this project still alive, and when can I expect the android and ios support coming out? HOT 1
- TextBlock does not show up HOT 1
- Why did you ditch developing OrbTK ? HOT 3
- orbtk sdl2-sys compiles standalone but not with orbtk
- example consider adding an explicit lifetime bound...
- Other Backends, no sdl2-dependencies possible?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orbtk.