Home › Forums › TWAIN Classic › ICAP_BRIGHTNESS setting is ignored (?)
- This topic has 14 replies, 5 voices, and was last updated 14 years, 3 months ago by fortunece.
- AuthorPosts
Hi!
I have a problem with setting of brightness.
I set brightness to the user selected value (-1000 to 1000) then I ask it (MSG_GET).
The response of the scanner is the desired value but the brightness of the
image is always the same (default value).
If I use the user interface the setting is correct.
Thx:what model? does your code work on other devices?
.
Dear gabe!
The model is a HP ScanJet 5590P scanner.
I have not tried with other scanners, yet but I think it does not matter, because I can make the settings using the UI.Thanks!
@gabe wrote:
what model? does your code work on other devices?
.
what driver are you using? Most Hp scanners have an alternate driver on the Cd with the name Commerical in the name – look for a dir on the Cd with the work “Commercial” in the name if you aren’t using the commercial driver.
the commercial drivers have historically played nicer than the standard ones that get installed.
.
Ok, I will try it.
Maybe the driver can do anything that we can not do by programming twain interface? Or it is a bug?@gabe wrote:
what driver are you using? Most Hp scanners have an alternate driver on the Cd with the name Commerical in the name – look for a dir on the Cd with the work “Commercial” in the name if you aren’t using the commercial driver.
the commercial drivers have historically played nicer than the standard ones that get installed.
.
I have installed the Commercial driver.
Brightness capability range is the following:
Min = 256
Max = 111
Step = 127
Current = -992
Default = -1000@Zoltan Barna wrote:
Ok, I will try it.
Maybe the driver can do anything that we can not do by programming twain interface? Or it is a bug?@gabe wrote:
what driver are you using? Most Hp scanners have an alternate driver on the Cd with the name Commerical in the name – look for a dir on the Cd with the work “Commercial” in the name if you aren’t using the commercial driver.
the commercial drivers have historically played nicer than the standard ones that get installed.
.
Gabe!
The commercial driver is OK!
The return value of MSG_GET was TWON_ENUMERATION (I expected TWON_RANGE because of the WIA driver).
But, I do not still know how the User Interface sets brightness and contrast.
Any idea?Thanks!
this is where one of my favorite capabilities gets involved. that ‘commercial’ driver probably also supports a capability named enableDsUiOnly. the interesting thing here is that if you call EnableDsUiOnly then the vendor Ui will come up – just like with the standard EnableDs call. But when you ‘ok’ the ui you can call CustomDsData.Get and you’ll recieve the (almost) all of the settings in that will later look a lot like an ini file format. From there you can play around with thier Ui and see what values the Ui is using.
if this didn’t make sense post back and I’ll try to explain it better.
.
Our program need to disable the default UI. so we do the following code.
set the capability,
TwCapability capBrightness = new TwCapability(TwCap.ICAP_BRIGHTNESS, 100, TwType.Fix32);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capBrightness);
if (rc != TwRC.Success)
{
CloseSrc();
return;
}
get the capability.
TwCapability capbright = new TwCapability(TwCap.ICAP_BRIGHTNESS, TwOn.Range, TwType.Fix32, -1);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Get, capbright);
if (rc != TwRC.Success)
{
CloseSrc();
return;
}
else
{
TwRANGE arr = capbright.GetTwRange();
//TwRANGE arr = (TwRANGE)Marshal.PtrToStructure(Twain.GlobalLock(Handle), typeof(TwRANGE));
}
internal class TwRANGE{
ushort ItemType;
uint MinValue; /* Starting value in the range. */
uint MaxValue; /* Final value in the range. */
uint StepSize; /* Increment from MinValue to MaxValue. */
uint DefaultValue; /* Power-up value. */
uint CurrentValue; /* The value that is currently in effect. */
}
But I find that its
MaxValue 1000,
MinValue 64536;
Current Value 65636.
So what is the problem? I could set brightness in the Default UI, but why i can’t set in our Customized Acquire?????
And I didn’t quite understand what Zoltan Barna said that to use commercial drivers ? to use different version of twain_32.dll ?@fortunece wrote:
internal class TwRANGE{
ushort ItemType;
uint MinValue; /* Starting value in the range. */
uint MaxValue; /* Final value in the range. */
uint StepSize; /* Increment from MinValue to MaxValue. */
uint DefaultValue; /* Power-up value. */
uint CurrentValue; /* The value that is currently in effect. */
}In fact the range can be negative, from -1000 to +1000 for ICAP_BRIGHTNESS, ICAP_CONTRAST …
An application can not force the kind of container a DS will return for a MSG_GET. The code below will not ensure you will receive a Range. Always check the kind of container returned before processing it. The Container passed to the DS to fill should be empty.
TwCapability capbright = new TwCapability(TwCap.ICAP_BRIGHTNESS, TwOn.Range, TwType.Fix32, -1);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Get, capbright);
Many DS do not support constraining capabilities when the UI is displayed. If they do, MSG_GET will first need to return an Enumeration or Range.
MSG_GET to get possible values.
MSG_SET using the same container type but with only the limited values.Thanks for Thierry’s reply, yes, I change this
internal class TwRANGE{
ushort ItemType;
int MinValue; /* Starting value in the range. */
int MaxValue; /* Final value in the range. */
int StepSize; /* Increment from MinValue to MaxValue. */
int DefaultValue; /* Power-up value. */
int CurrentValue; /* The value that is currently in effect. */
}
but it still get the same result.
MaxValue 1000,
MinValue 64536;
Current Value 65636.
itemType 7
stepSize 1
defaultValue 0
do you mean that I should do some converter work?jimwatters, Thank you.
yes, when I do the MSG_GET, No matter what container I set, I just got the Container Type 6 returned.
so I use the Range Cap.And Acctually i can successfully get the ICAP_XRESOLUTION.
MaxValue 1200,
MinValue 12;
Current Value 55 //setted successfully
itemType 7
stepSize 1
defaultValue 150What’s the difference between these two capability? Do I need to use Range ContainerType to set the brightness Capa? currently all capa setting use onevalue contype.
internal class TwRANGE{
ushort ItemType;
TwFix32 MinValue; /* Starting value in the range. */
TwFix32 MaxValue; /* Final value in the range. */
int StepSize; /* Increment from MinValue to MaxValue. */
TwFix32 DefaultValue; /* Power-up value. */
TwFix32 CurrentValue; /* The value that is currently in effect. */}
Now I using this, so the capa showing correct.
MaxValue 1000,
MinValue -1000;
Current Value -800.
itemType 7
stepSize 1
defaultValue 0
but the problem is that the image scanned stay no change at all.Now I use the Twack_32.exe program.
it could set up the DPI, but not the brightness.(through the capability setting, state workflow in special menu)so i really really curious about how the default UI did this to set the brightness. waiting for the replies…..
Is that any twain version issue?
since the twain_32.dll already in the C:WINDOWS, created in Wednesday, August 04, 2004, I removed it, but when I run our program, it will automatically generated again.(I wonder why)
and the BenQ disc folder twain_32.dll created in Tuesday, October 22, 1996.- AuthorPosts