26 #if defined (HAVE_CONFIG_H)
30 #include <QApplication>
42 qreal h1, s1, v1, h2, s2,
v2;
44 col1.getHsvF (&h1, &s1, &v1);
45 col2.getHsvF (&h2, &s2, &
v2);
47 return QColor::fromHsvF (h1, s1*fs, v1 + fv*(
v2 - v1));
53 QRect geom = QGuiApplication::primaryScreen ()->availableGeometry ();
55 width = geom.width ();
56 height = geom.height ();
65 const QScreen *actual_screen =
nullptr;
66 QRect actual_screen_geom = QRect ();
67 int intersected_area_max = 0;
69 const int area_actual_geometry
70 = actual_geometry.width () * actual_geometry.height ();
73 foreach (
const QScreen *screen, QGuiApplication::screens())
75 QRect screen_geom = screen->availableGeometry ();
76 intersection = screen_geom.intersected (actual_geometry);
77 if (! intersection.isEmpty ())
79 int area = intersection.width () * intersection.height ();
80 if (area > intersected_area_max)
82 actual_screen = screen;
83 actual_screen_geom = screen->availableGeometry ();
84 if (area == area_actual_geometry)
86 intersected_area_max = area;
93 if (actual_screen ==
nullptr)
95 actual_geometry = default_geometry;
103 int agx1, agy1, agx2, agy2;
104 actual_geometry.getCoords (&agx1, &agy1, &agx2, &agy2);
105 int isx1, isy1, isx2, isy2;
106 intersection.getCoords (&isx1, &isy1, &isx2, &isy2);
109 if ((agx1 == isx1) && (agx2 != isx2))
110 isx1 = isx1 - agx2 + isx2;
111 if ((agx1 != isx1) && (agx2 == isx2))
112 isx2 = isx2 + agx2 - isx2;
113 if ((agy1 == isy1) && (agy2 != isy2))
114 isy1 = isy1 - agy2 + isy2;
115 if ((agy1 != isy1) && (agy2 == isy2))
116 isy2 = isy2 + agy2 - isy2;
120 actual_geometry = actual_screen_geom.intersected (
121 QRect (QPoint (isx1,isy1), QPoint (isx2,isy2)));
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
OCTGUI_API void get_screen_geometry(int &width, int &height)
OCTGUI_API QColor interpolate_color(const QColor &col1, const QColor &col2, double fs, double fv)
OCTGUI_API void adjust_to_screen(QRect &actual_geometry, const QRect &default_geometry)
const octave_char_matrix & v2