bugGNU Octave - Bugs: bug #65187, getframe doesn't capture uiXXX...

 
 

bug #65187: getframe doesn't capture uiXXX objects

Submitter:  Rik <rik5>
Submitted:  Sat 20 Jan 2024 11:08:40 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * stable Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 24 Jan 2024 08:15:20 PM UTC, comment #2: 

I think QScreen::grabWindow won't work because it does what it says : grab screen pixels.

Among the several warnings in Qt's doc I see :


The grabWindow() function grabs pixels from the screen, not from the window, i.e. if there is another window partially or entirely over the one you grab, you get pixels from the overlying window, too. The mouse cursor is generally not grabbed.


We want to get a specific window's pixels whether or not this window is at the front (and not covered by another one). We even want to be able to grab invisible figure pixels.

I think a way to get widgets drawn is to have them first rendered onto a suitable pixel based QPaintDevice, using QWidget::render method, capture pixel values and then let our OpenGL renderer draw those pixels before we recapture them with the current method.

Pantxo Diribarne <pantxo>
Group Member
Sat 20 Jan 2024 11:37:41 PM UTC, comment #1: 

If someone is interested in working on this project, I think it should be fairly easy to do for the Qt graphics figure windows by using the


QPixmap QScreen::grabWindow(WId window = 0, int x = 0, int y = 0, int width = -1, int height = -1)


function.  The QScreen object and WId (window ID) can be found using the QWidget object corresponding to Octave's Figure (or maybe Canvas) object.

It looks like we currently ask the OpenGL renderer to generate a figure.  So I think that explains why the UI objects are not included in the image that getframe returns.

John W. Eaton <jwe>
Group administrator
Sat 20 Jan 2024 11:08:40 PM UTC, original submission:  

Code to reproduce:


figure (1)
demo uitable 1
F = getframe (gcf);
figure (2)
imshow (F.cdata);


It's also not possible to print uiXXX objects, but that's probably a different issue.  I'm not too worried about it because Matlab is removing support for printing uiXXX objects in a future release.  However, they do say that one workaround is getframe() and that isn't possible with Octave.

Rik <rik5>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-24 pantxo StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-54b4.
    Corresponding source code