有人可以解释一下 xrandr --scale 是如何工作的吗?

有人可以解释一下 xrandr --scale 是如何工作的吗?

来自文档:

              Changes the dimensions of the output picture.  If the y value is
              omitted,  the  x value will be used for both dimensions.  Values
              larger than 1 lead to a compressed screen (screen dimension big‐
              ger than the dimension of the output mode), and values less than
              1 lead to a zoom in on the output.  This option  is  actually  a
              shortcut version of the --transform option.

咱们试试吧:

当我打字时,--xrandr --output eDP 1.2x1.2屏幕会变小约 20%(这一点已验证)

当我打字时,--xrandr --output eDP 0.8x0.8屏幕变得绝对巨大,放大了 20% 以上(这伪造了文档)

当我打字时,--xrandr --output eDP 1x1它会变得更大!它正在放大。这些变换似乎是相对应用的......但如果是这种情况,那么 1x1 应该保持它完全静态?

当我打字时,--xrandr --output eDP 1.5x1.5它又变小了。但它仍然大于--scale 1.2x1.2,相对缩放的进一步证据。

当我打字时--xrandr --output eDP 1.5x1.5什么也没有发生。等等——这是否意味着这些变换不是相对应用的?

当我打字时,--xrandr --output eDP 2x2它基本上会回到原来的大小......这不是 2 倍比例! (原始尺寸为 1920x1080,缩放比例为 1 倍)。

--scale的简写也是如此--transform,其描述为:

       --transform a,b,c,d,e,f,g,h,i
              Specifies a transformation matrix to apply on the output.  A bi‐
              linear filter is selected automatically unless the --filter  pa‐
              rameter  is  also  specified.  The mathematical form corresponds
              to:
                     a b c
                     d e f
                     g h i
              The transformation is based on homogeneous coordinates. The  ma‐
              trix  multiplied by the coordinate vector of a pixel of the out‐
              put gives the transformed coordinate vector of a  pixel  in  the
              graphic  buffer.  More precisely, the vector (x y) of the output
              pixel is extended to 3 values (x y w), with 1 as the  w  coordi‐
              nate and multiplied against the matrix. The final device coordi‐
              nates of the pixel are then calculated with  the  so-called  ho‐
              mogenic  division  by  the  transformed  w coordinate.  In other
              words, the device coordinates (x' y') of the  transformed  pixel
              are:
                     x' = (ax + by + c) / w'   and
                     y' = (dx + ey + f) / w'   ,
                     with  w' = (gx + hy + i)  .
              Typically,  a  and  e  corresponds to the scaling on the X and Y
              axes, c and f corresponds to the translation on those axes,  and
              g,  h, and i are respectively 0, 0 and 1. The matrix can also be
              used to express more complex transformations  such  as  keystone
              correction,  or  rotation.   For  a rotation of an angle T, this
              formula can be used:
                     cos T  -sin T   0
                     sin T   cos T   0
                      0       0      1
              As a special argument, instead of passing a matrix, one can pass
              the  string  none,  in which case the default values are used (a
              unit matrix without filter).

因此,如果我写“xrandr --output eDP --scale 1.5x1.5”,这将创建一个变换矩阵:

M = 
  1.5  0    0
  0    1.5  0
  0    0    1

我使用 * 表示点积,(x,y) 是一些坐标

所以这等于:

w' = (0x + 0y + 1) = 1
x' = (1.5x + 0y + 1) / w' = 1.5x
y' = (0x + 1.5y + 1) / w' = 1.5y

这需要从最后一个 x,y 坐标进行线性和相对变换!可是等等,如果根据文档,比例值 > 1 应该压缩输出,这似乎实际上是在扩展输出,因为 (x,y) 被乘以 1.5。

我正在使用两个显示器,如果这意味着什么的话,我什至没有了解它如何影响另一个显示器的屏幕空间

答案1

我试图帮助你 - 昨天我读了文档,但很难理解。
我在下面画了这幅画。

x'=x cos T + y -sin T + c  | a b c
y'=x sin T + y  cos T + f  | d e f   | g=0, h=0, i=1

x 和 y(以显示器上输出模式的像素为单位)
x' 和 y'(以图形缓冲区中屏幕图像的像素为单位)

兰德尔

我有一台显示器:例如角度 10 度,比例 1.2 -> cos 10 x 1.2 = 1.1818,sin 10 x 1.2 = 0.2084

xrandr --output "DVI-D-0" --transform 1.1818,-0.2084,0,0.2084,1.1818,0,0,0,1

之后调用 xrandr 的输出xrandr

Screen 0: minimum 8 x 8, current 2270 x 1677, maximum 32767 x 32767
DVI-D-0 connected primary 2176x930+0+0 (normal left inverted right x axis y axis) 531mm x 299mm
   1920x1080     60.00*+
   1680x1050     59.95  
   1600x1200     60.00  
   1440x900      59.89  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   640x480       75.00    72.81    59.94  
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)

2176x930 必须是图形缓冲区中的图像
(2176 x cos 10 + 930 x sin 10) / 1.2 = 1920

但我不确定画中的屏幕(黄色)!

缓冲区顶部像素中的图像到显示器屏幕底部之间的距离为:
2176 x sin 10 + 1080 x 1,2=1674,
但这包括空白显示器,但如果图像超出显示器,我敢打赌这幅画是正确的。

您可以通过以下方式返回到旧设置:
xrandr --output "DVI-D-0" --transform 1,0,0,0,1,0,0,0,1

保存您打开的每个文件,有两次我崩溃了,我的显示器没有信号,因为输入错误,不得不重新启动!

相关内容