Evan's Blog
EvanZhu0721 / 公开仓库

SBMS

镜像已同步

SBMS complete the calculation rules for the default logical desktop topology relationship and the physical dimensions of the displays in the Windows multi-screen collaboration system.

上游 GitHub
READ-ONLY MIRROR

README、源码与 Release 已保存到本站;源码视图固定到 commit a37d6c4b。

main/ root / docs
a37d6c4b· 固定源码快照
docs/geometry.md2.4 KB
预览
1# Geometry API
2
3The public types in `src/geometry.rs` are the single source of truth for
4virtual-display sizing and pointer-coordinate conversion. A frontend should
5persist `SizingRequest`, call `SizingRequest::calculate`, and pass the request
6through the existing mapping path. It should not calculate or persist a derived
7display mode itself.
8
9## Sizing
10
11```rust
12pub struct DisplayGeometry {
13 pub native_pixels: PixelSize,
14 pub physical: PhysicalMeasurement,
15 pub aspect_ratio: Option<AspectRatio>,
16 pub rotation: Rotation,
17}
18
19pub struct SizingRequest {
20 pub reference: DisplayGeometry,
21 pub target: DisplayGeometry,
22 pub strategy: SizingStrategy,
23 pub alignment: u32,
24 pub preferred_refresh_millihz: Option<u32>,
25}
26
27pub enum SizingStrategy {
28 MatchPhysicalSize,
29 RoundedScale,
30 IntegerScale,
31}
32```
33
34`reference` describes the display whose apparent pixel density should be
35matched. `target` describes the physical display that receives the mirror.
36Physical size may be supplied as width and height in millimetres or as a
37diagonal; an explicit aspect ratio can be supplied when a diagonal is used.
38
39`SizingRequest::calculate()` returns:
40
41```rust
42pub struct SizingResult {
43 pub virtual_mode: PixelSize,
44 pub oriented_target: PixelSize,
45 pub scale_x: f64,
46 pub scale_y: f64,
47 pub preferred_refresh_millihz: Option<u32>,
48}
49```
50
51The alignment must be a power of two from 1 through 256. Measurements must be
52finite and positive. A preferred refresh rate, when present, must be non-zero.
53The session gate accepts dimensions from 1 through 16384 and refresh rates up
54to 1000 Hz.
55
56## Mapping path
57
58```text
59SizingRequest::calculate
60 -> SizingResult.virtual_mode
61 -> VirtualMode
62 -> protected v5 session gate
63 -> IDD monitor and target mode
64 -> Windows display source
65 -> GPU renderer
66```
67
68The mode is fixed before the software display device is created. Changing it
69requires stopping and starting the mapping session.
70
71## Pointer coordinates
72
73`CoordinateTransform::stretch(target, source, rotation)` builds the transform
74shared by the renderer input path. `map_target_point` maps a physical target
75point to the corresponding virtual-desktop point and returns `None` outside the
76target rectangle.
77
78```rust
79let transform = CoordinateTransform::stretch(target_rect, source_rect, rotation)?;
80let source_point = transform.map_target_point(target_point);
81```
82
83The transform supports 0, 90, 180 and 270 degree rotation.
84