sane-project-website/old-archive/1998-04/0304.html

125 wiersze
6.3 KiB
HTML

<!-- received="Mon Apr 27 22:34:09 1998 PDT" -->
<!-- sent="Tue, 28 Apr 1998 01:33:20 -0400 (EDT)" -->
<!-- name="Matto Marjanovic" -->
<!-- email="maddog@mir.com" -->
<!-- subject="Re: Two *other* problems with xscanimage" -->
<!-- id="m0yU316-000J3NC@yoo-hoo.ai.mit.edu" -->
<!-- inreplyto="Two *other* problems with xscanimage" -->
<title>sane-devel: Re: Two *other* problems with xscanimage</title>
<h1>Re: Two *other* problems with xscanimage</h1>
<b>Matto Marjanovic</b> (<a href="mailto:maddog@mir.com"><i>maddog@mir.com</i></a>)<br>
<i>Tue, 28 Apr 1998 01:33:20 -0400 (EDT)</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#304">[ date ]</a><a href="index.html#304">[ thread ]</a><a href="subject.html#304">[ subject ]</a><a href="author.html#304">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0305.html">Hugo van der Kooij: "Re: Two *other* problems with xscanimage"</a>
<li> <b>Previous message:</b> <a href="0303.html">Rob Fargher: "Re: Re[2]: Re[2]: gtk_tooltips"</a>
<li> <b>Maybe in reply to:</b> <a href="0278.html">Matto Marjanovic: "Two *other* problems with xscanimage"</a>
<!-- nextthread="start" -->
<li> <b>Next in thread:</b> <a href="0305.html">Hugo van der Kooij: "Re: Two *other* problems with xscanimage"</a>
<li> <b>Reply:</b> <a href="0305.html">Hugo van der Kooij: "Re: Two *other* problems with xscanimage"</a>
<!-- reply="end" -->
</ul>
<!-- body="start" -->
From: <a href="mailto:Oliver.Rauch@Wolfsburg.DE">Oliver.Rauch@Wolfsburg.DE</a><br>
<p>
<i> &gt; b) ___Gamma Curve data is corrupted.___</i><br>
<i> &gt; When turning on table-based gamma correction (and thus instantiating the</i><br>
<i> &gt; gamma curve widget), the following happen:</i><br>
<i> &gt; o correct values are read from the (microtek) backend, so far so good.</i><br>
<i> &gt; o immediately after the call to gtk_curve_set_gamma in curve_new(),</i><br>
<i> &gt; a call to gtk_curve_get_gamma reveals the correct values were </i><br>
<i> &gt; written to the widget.</i><br>
<i> &gt; o sometime later (when the event loop updates/displays the widget, I</i><br>
<i> &gt; imagine), xscanimage declares</i><br>
I already have seen this, too. I hope I will find the time to take a closer<br>
look at it soon!<br>
<p>
<p>
Hi Oliver, et al.,<br>
<p>
For no good reason, I went poking at this with gdb (well, at least I'm<br>
learning how to use gdb), and made some discoveries. The problem is in<br>
the widgets, not xscanimage. Someone who knows more about GTK widget<br>
programming will need to take over from here....<br>
<p>
When xscanimage runs, the corruption to the gamma curve widget happens<br>
during the call to gtk_widget_show(notebook) at the end of vector_new()<br>
["gtkglue.c"]. Here are before and after snapshots of the Curve:<br>
<p>
BEFORE:<br>
<p>
$36 = {graph = {widget = {object = {klass = 0x809b578, flags = 67328, <br>
ref_count = 1, object_data = 0x8087690}, private_flags = 0, <br>
state = 0 '\000', saved_state = 0 '\000', name = 0x0, style = 0x8084368, <br>
requisition = {width = 262, height = 262}, allocation = {x = -1, y = -1, <br>
width = 1, height = 1}, window = 0x0, parent = 0x809b308}, <br>
draw_data = 0x0}, cursor_type = 132, min_x = 0, max_x = 255, min_y = 0, <br>
max_y = 255, pixmap = 0x0, curve_type = GTK_CURVE_TYPE_FREE, height = 255, <br>
grab_point = -1, last = 0, num_points = 256, point = 0x809ba48, <br>
num_ctlpoints = 2, ctlpoint = 0x809ba30}<br>
<p>
AFTER:<br>
<p>
$37 = {graph = {widget = {object = {klass = 0x809b578, flags = 329664, <br>
ref_count = 1, object_data = 0x8095660}, private_flags = 0, <br>
state = 0 '\000', saved_state = 0 '\000', name = 0x0, style = 0x809d5f8, <br>
requisition = {width = 262, height = 262}, allocation = {x = -1, y = -1, <br>
width = 1, height = 1}, window = 0x809d3d8, parent = 0x809b308}, <br>
draw_data = 0x0}, cursor_type = 132, min_x = 0, max_x = 255, min_y = 0, <br>
max_y = 255, pixmap = 0x809d960, curve_type = GTK_CURVE_TYPE_FREE, <br>
height = -5, grab_point = -1, last = 0, num_points = -5, point = 0x809d540, <br>
num_ctlpoints = 2, ctlpoint = 0x809ba30}<br>
<p>
<p>
Note how "height" and "num_points" are now the unlikely values of -5, and<br>
the "point" vector has moved.<br>
<p>
The basic problem is that "allocation.width" and "allocation.height" are 1,1<br>
and not 262,262. The chain of events (I believe) is: [in "gtk/gtkcurve.c"]<br>
<p>
gtk_curve_graph_events() is called for either a CONFIGURE or EXPOSE event,<br>
and subsequently calls gtk_curve_draw() with the width and height taken<br>
from the "allocation", as:<br>
width = w-&gt;allocation.width - RADIUS * 2;<br>
height = w-&gt;allocation.height - RADIUS * 2;<br>
i.e. -5 and -5<br>
<p>
gtk_curve_draw() sees the requested width,height (-5,-5) doesn't match what<br>
was loaded into it (256,256), and calls gtk_curve_interpolate(), which then<br>
generates screwy numbers.<br>
<p>
<p>
SO: Perhaps gtk_curve_graph_events() should use the curve's "requisition"<br>
instead of its "allocation" to calculate those width and height.<br>
Perhaps in an earlier incarnation of GTK, the curve widget got 'allocated'<br>
earlier or something.<br>
I don't really know what design issues are involved here.<br>
<p>
<p>
Whatever the solution is, I'd love to hear it, just to get some more insights<br>
into the workings of GTK.<br>
<p>
Hope this is a good head-start,<br>
-matt m.<br>
<p>
<p>
<pre>
--
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0305.html">Hugo van der Kooij: "Re: Two *other* problems with xscanimage"</a>
<li> <b>Previous message:</b> <a href="0303.html">Rob Fargher: "Re: Re[2]: Re[2]: gtk_tooltips"</a>
<li> <b>Maybe in reply to:</b> <a href="0278.html">Matto Marjanovic: "Two *other* problems with xscanimage"</a>
<!-- nextthread="start" -->
<li> <b>Next in thread:</b> <a href="0305.html">Hugo van der Kooij: "Re: Two *other* problems with xscanimage"</a>
<li> <b>Reply:</b> <a href="0305.html">Hugo van der Kooij: "Re: Two *other* problems with xscanimage"</a>
<!-- reply="end" -->
</ul>