octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #65540] getframe use wrong rect to pixel trans


From: Alexander
Subject: [Octave-bug-tracker] [bug #65540] getframe use wrong rect to pixel transformation at Retina display
Date: Sat, 30 Mar 2024 11:59:34 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?65540>

                 Summary: getframe use wrong rect to pixel transformation at
Retina display
                   Group: GNU Octave
               Submitter: aknew
               Submitted: Sat 30 Mar 2024 03:59:34 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 8.4.0
         Discussion Lock: Any
        Operating System: Mac OS
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sat 30 Mar 2024 03:59:34 PM UTC By: Alexander <aknew>
Sample code (No matter what or how you draw something, I caught this bug with
surf):

t = linspace(0,2*pi,100)';
x = cos(t); 
y = sin(t); 
plot(x,y);
[img map] = rgb2ind(frame2im(getframe(gcf)));
imwrite(img, map, 'getframe_test.png', 'png', 'WriteMode', 'overwrite');

*Expected result:* saved file with whole figure
*Actual result:* saved file with only bottom left quarter of figure

I also tried using set(gcf, 'Position', rect); and called getframe with this
rect (or part of it) and got the same result

I suppose that this behaviour based on Apple's high resolution feature
(https://developer.apple.com/library/archive/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
when rect (0,0,10,10) have 20X20 pixels at Retina displays (like mine), but
getframe thinks that rect units and pixels are the same thing and returns only
10X10 pixels. This assumption is confirmed by logging pos and size(cdata) near
line 124 into getframe.m - pos (3,4) really like size cdata divided by 2
(Actually I just add *2 at lines 118 and 121, but it is ugly kludge which
works only for my current script when I need whole figure)










    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65540>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]