Forum Replies Created
- AuthorPosts
Well since twacker is returning it as a range, they’re fine. Just like when my code requests them as a range. The problem showed up when requesting as an enumeration and twacker doesn’t return them as an enumeration.
Torin
Re-reading the spec helped since pixels per TWUN_PIXELS is meaningless.
Torin
Wow. Amazing how different devices can be. What I’m trying to do is find the very largest image size in pixels that a device will provide. Yep, first thought is to get ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH. Unfortunately, at least with the Fujitsu it is returning different values depending on the X/Y Resolution. So I figured I’d enumerate the X/Y Resolutions to find the maximum, set to the maximum, then get the physical height/width. Using Twacker, I can see that the Fujitsu returns bad value when trying to set the resolution with units set to pixels, but if I set units back to the inches that it defaults to, then set the resolutions it works fine. With the Lanier, it will allow me to set the units to pixels, then set the resolutions. What is the point of a spec/standard if no one is going to follow it? 🙂
Torin
Looks like Twacker receives it as a range even when I set it to enumeration or array.
Torin
The device I’m currently using is a Fujitsu fi-4340C, but I also saw similar behavior with a Lanier LD118D.
Torin
Switching to getting a TW_RANGE appears to do what I want (as I only wanted the max and min). Is there documentation that explains how to interpret the results when using TW_ARRAY or TW_ENUMERATION?
Thanks
Torin
Hard to say if it is correct or not. I have to think my code is correct because the first two values I get back are 800 and 600, and both of these are available in the data source’s UI. The following is the code where I’m enumerating the ICAP_YRESOLUTION values.
TW_CAPABILITY twCapability;
memset(&twCapability, 0, sizeof(twCapability));
twCapability.Cap = ICAP_YRESOLUTION;
twCapability.ConType = TWON_ENUMERATION;
if ((Status = m_Twain.GetCapability(&twCapability)) != STATUS_SUCCESS)
{
return Status;
}
double dLargest = 0.0;
pTW_ENUMERATION pEnum = reinterpret_cast(::GlobalLock(twCapability.hContainer));
if (pEnum->ItemType != TWTY_FIX32)
{
::GlobalUnlock(twCapability.hContainer);
throw STATUS_NSTWAIN_UNSUPPORTED_DATA_TYPE;
}
else
{
double dTemp = 0.0;
pTW_FIX32 pFixResolution = reinterpret_cast(pEnum->ItemList);
TW_FIX32 FixResolution = { 0 };
TW_UINT32 uiItemCounter = 0;
for (uiItemCounter = 0; uiItemCounter < pEnum->NumItems; uiItemCounter++, pFixResolution++)
{
FixResolution = (*pFixResolution);
dTemp = static_cast(FixResolution.Whole) + (static_cast (FixResolution.Frac) / 65536.0);
if (dTemp > dLargest)
{
dLargest = dTemp;
}
}
}
::GlobalUnlock(twCapability.hContainer);
Due note, the negative and tiny values are seen in the FixResolution structure long before I do the conversion in to dTemp.
Thanks,
Torin
The reason I ask is because I have a device where I set the units to pixels, then ask for the x and y resolutions, as well as ICAP_PHYSICALHEIGHT and ICAP_PHYSICALWIDTH. With the resolutions, I’m getting back an enumeration of 50 Fix32 values, some of which are negative, and some are REALLY small. Surely I’m missing something here right?
Thanks,
Torin
- AuthorPosts