comparison scripts/image/getframe.m @ 30198:a87e5f9d5446

improve graphics toolkit rendering failure error message * __check_rendering_capability__.m: New function. * getframe.m, __opengl_print__.m: Use it. * scripts/plot/util/module.mk: Update.
author John W. Eaton <jwe@octave.org>
date Tue, 21 Sep 2021 12:30:32 -0400
parents 0a5b15007766
children 363fb10055df
comparison
equal deleted inserted replaced
30197:f692ecc135d6 30198:a87e5f9d5446
100 error ("getframe: RECT must define a region inside the figure"); 100 error ("getframe: RECT must define a region inside the figure");
101 endif 101 endif
102 pos = rect; 102 pos = rect;
103 endif 103 endif
104 104
105 if (strcmp (get (hf, "visible"), "on") 105 __check_rendering_capability__ ("getframe", hf);
106 || (strcmp (get (hf, "__graphics_toolkit__"), "qt") 106
107 && (strcmp (get (hf, "__gl_window__"), "on") 107 ## __get_frame__ requires that the figure "units" is "pixels"
108 || __have_feature__ ("QT_OFFSCREEN")))) 108 unwind_protect
109 109 units = get (hf, "units");
110 ## __get_frame__ requires that the figure "units" is "pixels" 110 set (hf, "units", "pixels");
111 unwind_protect 111 cdata = __get_frame__ (hf);
112 units = get (hf, "units"); 112 unwind_protect_cleanup
113 set (hf, "units", "pixels"); 113 set (hf, "units", units)
114 cdata = __get_frame__ (hf); 114 end_unwind_protect
115 unwind_protect_cleanup
116 set (hf, "units", units)
117 end_unwind_protect
118
119 else
120 error ("getframe: figure must be visible or qt toolkit must be used with __gl_window__ property 'on' or QT_OFFSCREEN feature available");
121 endif
122 115
123 i1 = max (floor (pos(1)), 1); 116 i1 = max (floor (pos(1)), 1);
124 i2 = min (ceil (pos(1)+pos(3)-1), columns (cdata)); 117 i2 = min (ceil (pos(1)+pos(3)-1), columns (cdata));
125 idxx = i1:i2; 118 idxx = i1:i2;
126 i1 = max (floor (pos(2)), 1); 119 i1 = max (floor (pos(2)), 1);