bugGNU Octave - Bugs: bug #52460, graphics_toolkit fltk fails...

 
 

bug #52460: graphics_toolkit fltk fails printing uint8 and uint16 color images, and patch to fix

Submitter:  None
Submitted:  Mon 20 Nov 2017 12:04:36 AM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  R.S.Carmenes Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.2.1
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 20 Nov 2017 12:45:32 AM UTC, comment #2: 

I grafted the change from default to stable:

  http://hg.savannah.gnu.org/hgweb/octave/rev/1ad2297f8ece

Closing report.

John W. Eaton <jwe>
Group administrator
Mon 20 Nov 2017 12:39:20 AM UTC, comment #1: 

This change was already made on the default branch here:

http://hg.savannah.gnu.org/hgweb/octave/rev/7a1097510439

I don't see why it shouldn't also go on stable before the 4.2.2 release.

John W. Eaton <jwe>
Group administrator
Mon 20 Nov 2017 12:04:36 AM UTC, original submission:  

Hello,

When using graphics_toolkit fltk, color images in uint8 or uint16 format are correctly shown on the screen but not printed (we get a black rectangle instead). However, color images in double and gray images in any format are correctly printed.

This happens with the current octave (at lease 4.2.1 and the current dev version) compiled in 32bit linux (but it is likely to affect other machines and versions too). gl2ps and fltk libraries are also current.

The following code reproduces the problem:


graphics_toolkit fltk
I=uint8(zeros(16,16,3));
for i=1:16; I(i,:,1)=i*16-1; end
for i=1:16; I(:,i,2)=i*16-1; end
for i=1:16; I(:,i,3)=[i-1:15,0:i-2]*16+15; end
imshow(I)
print test.eps


After investigating, I found this is due to an wrong type being used in gl2ps-print.cc.

The following patch solves the problem:


--- old/octave-hg-rc/libinterp/corefcn/gl2ps-print.cc   2017-11-17 23:35:32.000000000 +0100
+++ fix/octave-hg-rc/libinterp/corefcn/gl2ps-print.cc   2017-11-19 22:35:37.580823265 +0100
@@ -708,7 +708,7 @@

     OCTAVE_LOCAL_BUFFER (float, tmp_data, 3*w*h);

-    static const float maxval = std::numeric_limits<float>::max ();
+    static const float maxval = std::numeric_limits<uint8_t>::max ();

     for (int i = 0; i < 3*w*h; i++)
       tmp_data[i] = data[i] / maxval;
@@ -723,7 +723,7 @@

     OCTAVE_LOCAL_BUFFER (float, tmp_data, 3*w*h);

-    static const float maxval = std::numeric_limits<float>::max ();
+    static const float maxval = std::numeric_limits<uint16_t>::max ();

     for (int i = 0; i < 3*w*h; i++)
       tmp_data[i] = data[i] / maxval;


I hope the fix will be soon incorporated into the source tree.

Ricardo.

Anonymous

 

(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 jwe (Posted a comment)
  • -email is unavailable- added by None (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.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-11-20 jwe StatusNone Fixed
        Open/ClosedOpen Closed
        Releasedev 4.2.1

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code