TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

Capability Negotiation – TW_IMAGELAYOUT, TW_FRAMES

Forums › TWAIN Classic › Capability Negotiation – TW_IMAGELAYOUT, TW_FRAMES

  • This topic has 0 replies, 1 voice, and was last updated 11 years, 5 months ago by karlhoover.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • August 27, 2009 at 6:52 pm #22531 Reply
    karlhoover
    Participant
    • Topics - 1
    • Replies - 0
    • Total Posts - 1

    Hi!

    I’m putting Twain 2.0 support into our microscope software. It is working fine and I want to release the software soon. HOWEVER, I’ve got one problem which has so far been insurmountable. If I use the camera’s proprietary GUI and pick a capture size smaller than the full sensor, I have not been able to clear this selection back to the full sensor using the Twain API. I can GET, SET, RESET the image layout. Indeed the frame inside the layout is correctly setup for the entire sensor. For at least one of the cameras, the ICAP_(X,Y)RESOLUTION also shows be the correct full size of the sensor. I’m expliciting setting the layout with MSG_SET so according to chapter 4 of the specification I should be able to subsequently do MSG_GETCURRENT for the TW_FRAME. But any attempt to GETCURRENT, GET, SET, RESET, for the TW_FRAME give me an 11 (TWCC_SEQERROR). When I go ahead and get the image, I also see that that the layout is the entire sensor, but the IMAGEINFO and the image size embedded in the image header are the old image capture size.

    Any insight into this problem would be appreciated. Below is a little fragment of the code where I’m having the problem…. (the part where I try to do GETCURRENT of the TW_FRAME)

    Karl Hoover
    Programmer
    UCSF

    P.S. ALL the calls work except for those pertaining to TW_FRAME:

    TW_FIX32 xresolution, yresolution;
    float xr, yr;
    t_CAPABILITY _cap;
    bool succ;
    memset(&_cap, 0, sizeof(TW_CAPABILITY));
    _cap.Cap = ICAP_XRESOLUTION;
    succ = GetCapability_TWAIN(_cap, &xresolution, sizeof(TW_FIX32));
    xr = TwainSpecUtilities::FIX32ToFloat(xresolution);
    memset(&_cap, 0, sizeof(TW_CAPABILITY));
    _cap.Cap = ICAP_YRESOLUTION;
    succ = GetCapability_TWAIN(_cap, &yresolution, sizeof(TW_FIX32));
    yr = TwainSpecUtilities::FIX32ToFloat(yresolution);
    succ = ResetCapability(ICAP_XRESOLUTION);
    succ = ResetCapability(ICAP_YRESOLUTION);
    memset(&_cap, 0, sizeof(TW_CAPABILITY));
    // twain spec says ‘resolution’ is pixels / pixel unit but also states that ‘many sources like to put the maximum number of pixels here’
    _cap.Cap = ICAP_XRESOLUTION;
    succ = GetCapability_TWAIN(_cap, &xresolution, sizeof(TW_FIX32));
    if (succ)
    succ = set_CapabilityOneValue(ICAP_XRESOLUTION, xresolution);
    xr = TwainSpecUtilities::FIX32ToFloat(xresolution);

    memset(&_cap, 0, sizeof(TW_CAPABILITY));
    _cap.Cap = ICAP_YRESOLUTION;
    succ = GetCapability_TWAIN(_cap, &yresolution, sizeof(TW_FIX32));
    if(succ)
    succ = set_CapabilityOneValue(ICAP_YRESOLUTION, yresolution);
    yr = TwainSpecUtilities::FIX32ToFloat(yresolution);

    succ = ResetCapability(ICAP_FRAMES);

    TW_IMAGELAYOUT layout0;
    memset(&layout0,0, sizeof(layout0));
    succ = TwainCall(&appId_, &source_, DG_IMAGE, DAT_IMAGELAYOUT, MSG_GET,(TW_MEMREF)&layout0);
    if(!succ)
    {
    pcamera_->LogMessage(“source is not Twain-compliant: not able to retrieve layout”);
    }
    else
    {
    succ = TwainCall(&appId_, &source_, DG_IMAGE, DAT_IMAGELAYOUT, MSG_SET,(TW_MEMREF)&layout0);
    if(succ)
    {
    TW_FRAME f;
    memset(&f, 0, sizeof(f));
    memset(&_cap, 0, sizeof(TW_CAPABILITY));
    _cap.Cap = ICAP_FRAMES;
    succ = GetCapability_TWAIN(_cap, &f, sizeof(f), MSG_GETCURRENT );
    const char* perror = “source is not Twain-compliant: not able to get current frame”;
    if(!succ) pcamera_->LogMessage(perror);
    OutputDebugString(succ ? “get reset frame n” : perror);
    }
    }

  • Author
    Posts
Viewing 1 post (of 1 total)
Reply To: Capability Negotiation – TW_IMAGELAYOUT, TW_FRAMES
Your information:




Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • EPSON V600 TWAIN and WIA on Windows 10
  • When and how to use WaitForEvents command ?
  • Problem enumerating list of installed scanners in windows server 2012
  • Failed to create TWAIN progress! Error code is 1260.
  • To get the list of scanners from javascript client side (browser)
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy • Privacy Tools • Copyright © 2021 TWAIN Working Group • by iHwy, LLC • Log in

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.