InputStream *FilterFactory::Create(const char *pName, const Dictionary *pParms, InputStream *pSource)
{
	int nPredictor, nColors, nBitsPerComponent, nColumns;

	if (strcmp(pName, "ASCIIHexDecode") == 0 || strcmp(pName, "AHx") == 0)
		pSource = new ASCIIHexDecodeFilter(pSource);
	else if (strcmp(pName, "ASCII85Decode") == 0 || strcmp(pName, "A85") == 0)
		pSource = new ASCII85DecodeFilter(pSource);
	else if (strcmp(pName, "LZWDecode") == 0 || strcmp(pName, "LZW") == 0)
		assert(false);
	else if (strcmp(pName, "FlateDecode") == 0 || strcmp(pName, "Fl") == 0)
	{
		pSource = new FlateDecodeFilter(pSource);
		nPredictor = GetParm(pParms, "Predictor", 1);
		if (nPredictor != 1)
		{
			nColors = GetParm(pParms, "Colors", 1);
			nBitsPerComponent = GetParm(pParms, "BitsPerComponent", 8);
			nColumns = GetParm(pParms, "Columns", 1);
			assert(false);
			pSource = new PredictorFilter(pSource, nColors, nBitsPerComponent, nColumns);
		}
	}
	else if (strcmp(pName, "RunLengthDecode") == 0 || strcmp(pName, "RL") == 0)
		assert(false);
	else if (strcmp(pName, "CCITTFaxDecode") == 0 || strcmp(pName, "CCF") == 0)
		assert(false);
	else if (strcmp(pName, "DCTDecode") == 0 || strcmp(pName, "DCT") == 0)
		assert(false);
	else
	{
		printf("%s\n", pName);
		assert(false);  //not implemented
	}
	return pSource;
}
Exemple #2
0
char * WEXPORT WResStr::formats( char * buf, unsigned len, unsigned id, ... ) {
/*****************************************************************************/

    WResStr         format( id );
    const char *    fmts = format;
    const char *    parm;
    size_t          src = 0;
    size_t          dest = 0;
    bool            done = false;

    len = len;
    while( !done ) {
        assert( dest < len );

        switch( fmts[src] ) {
        case '%':
            src++;
            if( fmts[src] == '%' ) {  // escaped % (%%)
                buf[dest] = fmts[src];
            } else {
                va_list     args;

                va_start( args, id );
                parm = GetParm( fmts[src], args );

                assert( strlen( parm ) + dest < len );

                strcpy( buf + dest, parm );
                dest += strlen( parm );
                dest--;                     // it will be incremented at bottom

                va_end( args );
            }
            break;
        case '\0':
            done = true;
            // fall through
        default:
            buf[dest] = fmts[src];
        }

        src++;
        dest++;
    }

    return( buf );
}
Exemple #3
0
BOOL CMainDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO: 在此添加额外的初始化代码
	this->m_ctl_vedio.GetClientRect(&(this->m_VedioRect));
	this->m_ctl_image.GetClientRect(&(this->m_ImageRect));
	this->m_ctl_photo.GetClientRect(&(this->m_PhotoRect));

	//m_PicEditStatus = false;
	//this->m_Factor_Radio = PICZOOM_RADIO;
  
	if( m_VMRCap.EnumDevices()>0 )
	{
		m_VMRCap.InitMaxDPI(0,m_ctl_vedio.GetSafeHwnd());
		this->m_VMRRect.SetRect(0,0,m_VMRCap.m_nWidth,m_VMRCap.m_nHeight);
		CString title,title1;
		this->m_sxtgp.GetWindowText(title1);
		title.Format(_T("%s(%d*%d)"),title1,m_VMRCap.m_nWidth,m_VMRCap.m_nHeight);
		this->m_sxtgp.SetWindowText(title.GetBuffer());
	}

	//m_pWidth = 201;
	//m_pHeight = 201;
	if (!GetParm())
	{
		m_pWidth = 201;
		m_pHeight = 201;
		m_DefScale = 50;
	}

	m_CutRect.left = (m_ImageRect.Width() - m_pWidth)/2;
	m_CutRect.top = (m_ImageRect.Height() - m_pHeight)/2;
	m_CutRect.right = m_CutRect.left + m_pWidth;
	m_CutRect.bottom = m_CutRect.top + m_pHeight;

	SetDlgItemInt(IDC_EDIT_WIDTH,m_pWidth,1);
	SetDlgItemInt(IDC_EDIT_HEIGHT,m_pHeight,1);


	//UpdateData(false);

	return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
}
Exemple #4
0
void CMainDlg::OnBnClickedSet()
{
	//CString m_sFilename;

	CDlgSet dialog;

	if (IDOK == dialog.DoModal())
	{
		if (GetParm()){
			m_CutRect.left = (m_ImageRect.Width() - m_pWidth)/2;
			m_CutRect.top = (m_ImageRect.Height() - m_pHeight)/2;
			m_CutRect.right = m_CutRect.left + m_pWidth;
			m_CutRect.bottom = m_CutRect.top + m_pHeight;
			SetDlgItemInt(IDC_EDIT_WIDTH,m_pWidth,1);
			SetDlgItemInt(IDC_EDIT_HEIGHT,m_pHeight,1);
		}
	}

	DrawPicture();
}
//=============================================================================
// GetOpt - подпрограмма чтения параметров из INI-файла
//=============================================================================
void GetOpt (char *INIname)
{
#ifndef CONFIG_LS
char *pBfr;
#endif
//-----------------------------------------------------------------------------
// Copy the Window position info from a private INI into OS2.INI
//-----------------------------------------------------------------------------
  hini = PrfOpenProfile(hab, INIname); // Open private profile
  if ( hini )
    {
#ifndef CONFIG_LS
    if ( PrfQueryProfileSize(hini, APPNAME, WINPOS, &ulSize) )
      {
      pBfr = calloc(ulSize, L1);
      PrfQueryProfileData(hini, APPNAME, WINPOS, pBfr, &ulSize);
      PrfWriteProfileData(HINI_USERPROFILE, APPNAME, WINPOS, pBfr, ulSize);
      free(pBfr);
      }
#endif
//-----------------------------------------------------------------------------
// Restore Options from INI file
//-----------------------------------------------------------------------------
    GetParm(AUTORUN, AutoRun);
    GetParm(AUTOLOG, AutoLog);
    GetParm(COMMONLOG, CommonLog);
    GetParm(INTERVAL, Interval);
    GetParm(BASEIND, BaseInd);
    GetParm(USEDNS, useDNS);
    GetParm(USEOTHD, useOTHD);
    GetParm(PINGTO, pingtv.tv_sec);
    GetParm(ARPTO, ArpWait);
    GetParm(TCPTO, TcpWait);
    GetParm(NUMPING, NumPing);
    GetParm(PINGSTART, PingStart);
    GetParm(PINGSTOP, PingStop);
    GetParm(NBACT, NBact);
    GetParm(NBACTP, NBactP);
    GetParm(NBADRSET, NBadrSet);
    GetParm(NBADRM, NBadrM);
#ifdef CONFIG_LS
    GetParm(NUMIPADR, NumIPadr);
    GetParm(ADDRINFO, AddrInfoIP);
    GetParm(IPINTERVAL, Interv);
    GetParm(HOSTINT, HostInt);
#else
    GetParm(NUMIPADR, TempNumIPadr);
    GetParm(ADDRINFO, TempAddrInfo);
    GetParm(IPINTERVAL, TempInterv);
    GetParm(HOSTINT, TempHostInt);
    GetParm(VERTSPLITBAR, VertSplitBar);
#endif
#ifndef DAEMON
    if ( PrfQueryProfileSize(hini, APPNAME, INITFONT, &DataLen) )
      if ( DataLen == sizeof(FONTDLG) )
        {
        PrfQueryProfileData(hini, APPNAME, INITFONT, &pfdFontdlg, &DataLen);
        sprintf(FontCntnr, "%d.%s", FIXEDINT(pfdFontdlg.fxPointSize),
                                    pfdFontdlg.fAttrs.szFacename);
#ifndef CONFIG_LS
        FontSetFl = FALSE;
#endif
        }
    GetParm(INITFONTNAME, InitFont);
#endif
    PrfCloseProfile(hini);   // Close private profile
    }
//-----------------------------------------------------------------------------
// Check (and correct) parameters
//-----------------------------------------------------------------------------
  Interval = ( Interval > L60 ) ? L60 : Interval;
  Interval = ( Interval < L5 ) ? L5 : Interval;
  Interval = ( Interval / L5 ) * L5;

  BaseInd = ( BaseInd > BaseARP ) ? BaseLS : BaseInd;

  pingtv.tv_sec = ( pingtv.tv_sec > L10) ? L10 : pingtv.tv_sec;
  pingtv.tv_sec = ( pingtv.tv_sec < L1 ) ? L1 : pingtv.tv_sec;

  if ( ArpWait <= L15 )
    {
    ArpWait = ( ArpWait < L3 ) ? L3 : ArpWait;
    ArpWait = ( ArpWait / L3 ) * L3;
    }
  else
    {
    ArpWait = ( ArpWait > L90 ) ? L90 : ArpWait;
    ArpWait = ( ArpWait < L30 ) ? L30 : ArpWait;
    ArpWait = ( ArpWait / L15 ) * L15;
    }

  TcpWait = ( TcpWait > L100 ) ? L100 : TcpWait;
  TcpWait = ( TcpWait < L10 ) ? L10 : TcpWait;
  TcpWait = ( TcpWait / L10 ) * L10;
}