CTwainScanistor* CTwainSourceManager::OpenSource( LPCTSTR lpProductName ) { if(State != DSMOpen || OpenDSM() != 1) { return 0; } if(!lpProductName || !(*lpProductName)) { return 0; } std::auto_ptr<IEnumerator<TW_IDENTITY>> pEnumSrc(EnumSource()); if(pEnumSrc.get()) { std::string productName = T2A(lpProductName); while(pEnumSrc->MoveNext()) { if(productName == pEnumSrc->Current().ProductName) { return OpenSource(pEnumSrc->Current()); } } } return 0; }
BOOL CTwain::Acquire(int numImages /*= 1*/, BOOL bShowUI) { if (DSOpen() || OpenSource()) { TW_UINT16 nCut = 1; BOOL ret_value = SetCapability(ICAP_AUTOMATICBORDERDETECTION, nCut, TRUE); //自动裁剪 TW_UINT16 nRotate = 1; ret_value = SetCapability(ICAP_AUTOMATICDESKEW, nRotate, TRUE); //自动纠偏 #if 0 TW_UINT16 nBright = (135 - 128) / 0.125; ret_value = SetCapability(ICAP_BRIGHTNESS, nBright, TRUE); //亮度调节 TW_UINT16 nContrast = (135 - 128) / 0.125; ret_value = SetCapability(ICAP_CONTRAST, nContrast, TRUE); //对比度调节 #endif if (SetImageCount(numImages)) { if (EnableSource(bShowUI)) { return TRUE; } } } return FALSE; }
int Copy() { auto hsrc = INVALID_HANDLE_VALUE; auto hdst = INVALID_HANDLE_VALUE; LPWSTR reason = L"OpenSource"; UINT64 size; auto hr = OpenSource(hsrc, size); if (!hr) { hr = AdjustSource(hsrc, size); if (hr) return hr; reason = L"OpenDestination"; hr = OpenDest(hdst); if (!hr) { hr = AdjustDest(hdst); if (hr) return hr; reason = L"Copy"; hr = Copy(hsrc, hdst, size); } } if (hsrc!=INVALID_HANDLE_VALUE) CloseHandle(hsrc); if (hdst!=INVALID_HANDLE_VALUE) CloseHandle(hdst); if (hr) return Usage(hr, reason); return 0; }
void CSPDReaderView::OnViewSource(wxCommandEvent &evt) { wxUint32 func=GetSelectedFunction(); if(func==-1) { return; } OpenSource(func); }
int main() /*********/ { char *cmd; void (*parse_object)( void ); #if defined( _M_I86SM ) || defined( _M_I86MM ) _heapgrow(); /* grow the near heap */ #endif if( !MsgInit() ) return( EXIT_FAILURE ); cmd = AllocMem( CMD_LINE_SIZE ); getcmd( cmd ); InitOutput(); initOptions(); parseOptions( cmd ); openFiles(); InitObj(); parse_object = InitORL() ? ParseObjectORL : ParseObjectOMF; for( ;; ) { InitTables(); ModNameORL = rootName; parse_object(); if( Mod == NULL ) { break; } if( srcReqd ) { if( SrcName == NULL ) { if( CommentName != NULL ) { SrcName = CommentName; } else if( Mod->name != NULL ) { SrcName = Mod->name; } else { SrcName = rootName; } } OpenSource(); } DisAssemble(); if( Source != NULL ) { CloseTxt( Source ); } SrcName = NULL; /* if another module, get name from obj file */ } if( UseORL ) FiniORL(); CloseBin( ObjFile ); CloseTxt( Output ); MsgFini(); return( 0 ); }
/* Called to acquire images from the source. parameter numImages i the numberof images that you an handle concurrently */ BOOL CTwain::Acquire(int numImages) { if(DSOpen() || OpenSource()) { if(SetImageCount(numImages)) { if(EnableSource()) { return TRUE; } } } return FALSE; }
/** Called to acquire images from the source. parameter numImages is the number of images that you an handle concurrently */ bool TwainIface::Acquire(int numImages) { if(DSOpen() || OpenSource()) { if(SetImageCount(numImages)) { if(EnableSource()) { //ReleaseTwain(); //TW_IMAGEINFO info; //GetImageInfo(info); //GetImage(info); return true; } } } return false; }
/* Called to acquire images from the source. parameter numImages i the numberof images that you an handle concurrently */ BOOL CTwain::Acquire(int numImages, TW_UINT16 duplex, TW_UINT16 size, TW_UINT16 pixel, TW_UINT16 resolution, BOOL bShowUI, int nAutoCut) { if(DSOpen() || OpenSource()) { _bTwainContinue = TRUE; // BOOL ret_value=SetCapability(CAP_DUPLEXENABLED,duplex,TRUE); if (duplex == 1) duplex = TRUE; else duplex = FALSE; // CAP_DUPLEX BOOL ret_value = SetOneValueCapability(CAP_DUPLEXENABLED, TWTY_BOOL, duplex); //单双面扫描控制 //duplex, TRUE // ret_value = SetCapability(CAP_DUPLEX, duplex, TRUE); ret_value=SetCapability(ICAP_SUPPORTEDSIZES,size,TRUE); ret_value=SetCapability(ICAP_PIXELTYPE,pixel,TRUE); ret_value=SetResolution(ICAP_XRESOLUTION,resolution); ret_value=SetResolution(ICAP_YRESOLUTION,resolution); ret_value = SetCapability(ICAP_AUTOMATICBORDERDETECTION, nAutoCut, TRUE); //自动裁剪 TW_UINT16 nRotate = 1; ret_value = SetCapability(ICAP_AUTOMATICDESKEW, nRotate, TRUE); //自动纠偏 #if 0 TW_UINT16 nBright = (135 - 128) / 0.125; ret_value = SetCapability(ICAP_BRIGHTNESS, nBright, TRUE); //亮度调节 TW_UINT16 nContrast = (135 - 128) / 0.125; ret_value = SetCapability(ICAP_CONTRAST, nContrast, TRUE); //对比度调节 #endif if(SetImageCount(numImages)) { if (EnableSource(bShowUI)) { return TRUE; } } } return FALSE; }
// OpenFiles(): // Tests to make sure the paths are valid and opens the files. // This also generates an output and ubernull name if none are // specified. Returns an error if something went wrong. // You should call GenerateNames() before calling this function. // Overload me if you need to open more files. int CLIFileManipBase::OpenFiles() { // See if the source and output names are the same if( stricmp( source_name, output_name ) == 0 ) return CLIFILEMANIPBASE_SAME_SOURCE_AND_OUTPUT; // Open the Source File int error = OpenSource(); if( error != CLIFILEMANIPBASE_OK ) return error; // Open the Output File error = OpenOutput(); if( error != CLIFILEMANIPBASE_OK ) { CloseFiles(); return error; } return CLIFILEMANIPBASE_OK; }
void FCDProThread::run() { if ( !OpenSource(fcd_traits<Pro>::alsaDeviceName) ) { qCritical() << "FCDThread::run: cannot open FCD sound card"; return; } // TODO: fallback to original fcd m_running = true; while(m_running) { if (work(fcd_traits<Pro>::convBufSize) < 0) { break; } } CloseSource(); }
void CMainFrame::OnFileMultiopen() { OpenSource(targdir); }
void CMainFrame::OnOpensource() { OpenSource(srcdir); }