[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #52460] graphics_toolkit fltk fails printing u
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #52460] graphics_toolkit fltk fails printing uint8 and uint16 color images, and patch to fix |
Date: |
Sun, 19 Nov 2017 19:04:38 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0 |
URL:
<http://savannah.gnu.org/bugs/?52460>
Summary: graphics_toolkit fltk fails printing uint8 and
uint16 color images, and patch to fix
Project: GNU Octave
Submitted by: None
Submitted on: Mon 20 Nov 2017 12:04:36 AM UTC
Category: Plotting with OpenGL
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: R.S.Carmenes
Originator Email: address@hidden
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: GNU/Linux
_______________________________________________________
Details:
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.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?52460>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #52460] graphics_toolkit fltk fails printing uint8 and uint16 color images, and patch to fix,
anonymous <=