Kann jemand bitte erklären, wie xrandr --scale funktioniert?

Kann jemand bitte erklären, wie xrandr --scale funktioniert?

Aus den Dokumenten:

              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.

Lass es uns versuchen:

Wenn ich tippe, --xrandr --output eDP 1.2x1.2wird der Bildschirm um etwa 20 % kleiner (das stimmt)

Wenn ich tippe, --xrandr --output eDP 0.8x0.8wird der Bildschirm absolut riesig, weit mehr als 20 % vergrößert (das verfälscht die Dokumentation)

Wenn ich tippe, --xrandr --output eDP 1x1wird es noch größer! Es wird herangezoomt. Diese Transformationen werden anscheinend relativ angewendet ... aber wenn das der Fall ist, sollte 1x1 es dann völlig statisch halten?

Wenn ich tippe, --xrandr --output eDP 1.5x1.5wird es wieder kleiner.aber es ist immer noch größer als--scale 1.2x1.2, ein weiterer Beweis für relative Skalierung.

Wenn ich tippe, --xrandr --output eDP 1.5x1.5passiert nichts. Moment – ​​bedeutet das, dass diese Transformationen nicht relativ angewendet werden?

Wenn ich tippe, --xrandr --output eDP 2x2wird es grundsätzlich auf seine native Größe zurückgesetzt … die nicht der 2-fachen Skalierung entspricht! (Die Originalgröße beträgt 1920 x 1080 bei 1-facher Skalierung.)

Dies --scaleist eine Abkürzung von --transform, die wie folgt beschrieben wird:

       --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).

Wenn ich also `xrandr --output eDP --scale 1.5x1.5 schreibe, würde dies eine Transformationsmatrix wie folgt erstellen:

M = 
  1.5  0    0
  0    1.5  0
  0    0    1

wobei ich * verwende, um das Skalarprodukt zu bezeichnen, und (x,y) einige Koordinaten sind

Das wäre also gleich:

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

Dies erfordert meines Wissens eine lineare und relative Transformation der letzten x,y-Koordinaten! Aber Moment,wenn laut Dokumentation Skalenwerte > 1Kompressedie Ausgaben, es scheint, als würden die Ausgaben tatsächlich erweitert, da (x,y) mit 1,5 multipliziert wird.

Ich verwende zwei Monitore, falls das etwas bedeutet. Ich gehe nicht einmal darauf ein, wie sich dies auf den Bildschirmbereich des anderen Monitors auswirkt.

Antwort1

Ich versuche, Ihnen zu helfen – gestern habe ich die Dokumentation gelesen und sie war schwer zu verstehen.
Ich habe das folgende Bild gemacht.

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 und y in Pixeln des Ausgabemodus auf Ihrem Monitor
x' und y' in Pixeln des Bildschirmbilds im Grafikpuffer

xrandr

Ich habe einen Monitor: zB Winkel 10 Grad, Maßstab 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

Ausgabe des anschließenden Aufrufs von xrandrxrandr

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 muss Bild im Grafikpuffer sein
(2176 x cos 10 + 930 x sin 10) / 1,2 = 1920

aber ich bin mir nicht sicher, was den Bildschirm (gelb) auf dem Gemälde angeht!

Der Abstand zwischen dem oberen Pixel des Bilds im Puffer und dem unteren Pixel des Monitorbildschirms beträgt:
2176 x sin 10 + 1080 x 1,2 = 1674,
allerdings einschließlich des leeren Monitors. Wenn das Bild jedoch über den Monitor hinausragt, würde ich wetten, dass das Gemälde richtig ist.

Sie können die alten Einstellungen wiederherstellen mit:
xrandr --output "DVI-D-0" --transform 1,0,0,0,1,0,0,0,1

Speichern Sie alle geöffneten Dateien. Zweimal ist mein Monitor abgestürzt, hatte aufgrund einer falschen Eingabe kein Signal und musste neu starten!

verwandte Informationen