Example #1
0
/////////////////////////////////////////////////////////////////////////////
// Operations
void CImageDisp::SetDib(CDib *pDib)
{
	if (m_pDib) {delete m_pDib; m_pDib=NULL;}
    m_pDib = pDib;

    if (!m_pDib) return;

	calcInitZoom();	// 처음 한 번만 실행됨


    CSize nsize(m_pDib->Width(), m_pDib->Height());

    switch (m_RefreshMode) {
      case RF_NO: 
        InvalidateRect(NULL, FALSE);
        break;
      case RF_YES:
        InvalidateRect(NULL, TRUE);
        break;
      case RF_AUTO:
        if (m_OriginalSize==nsize) InvalidateRect(NULL, FALSE);
        else InvalidateRect(NULL, TRUE);
        break;
      default:
        break;
    }

    m_OriginalSize = nsize;

}
Example #2
0
Foam::pointField Foam::polySplineEdge::intervening
(
    const pointField& otherknots,
    const label nbetweenKnots,
    const vector& fstend,
    const vector& sndend
)
{
    BSpline spl(knotlist(points_, start_, end_, otherknots), fstend, sndend);

    label nSize(nsize(otherknots.size(), nbetweenKnots));

    pointField ans(nSize);

    label N = spl.nKnots();
    scalar init = 1.0/(N - 1);
    scalar interval = (N - scalar(3))/N;
    interval /= otherknots.size() + 1;
    interval /= nbetweenKnots + 1;

    ans[0] = points_[start_];

    register scalar index(init);
    for (register label i=1; i<nSize-1; i++)
    {
        index += interval;
        ans[i] = spl.realPosition(index);
    }

    ans[nSize-1] = points_[end_];

    return ans;
}
Example #3
0
 int
 process(const tendrils&, const tendrils&, const cv::Mat& input, cv::Mat& output)
 {
   cv::Size nsize(input.size());
   nsize.width *= *factor;
   nsize.height *= *factor;
   cv::resize(input,output,nsize, *interpolation);
   return ecto::OK;
 }
Example #4
0
Foam::polySplineEdge::polySplineEdge
(
    const pointField& points,
    Istream& is
)
:
    curvedEdge(points, is),
    polyLine(pointField(0)),
    otherKnots_(is)
{
    label nInterKnots(20);
    vector fstend(is);
    vector sndend(is);

    controlPoints_.setSize(nsize(otherKnots_.size(), nInterKnots));
    distances_.setSize(controlPoints_.size());

    controlPoints_ = intervening(otherKnots_, nInterKnots, fstend, sndend);
    calcDistances();
}
Example #5
0
CLIB_API GraphTypes::IBitmap* GetIBitmapFromIPicture(IPicture* ipic)
{
	GraphTypes::IBitmap* ibmp=0;
	if (!ipic)
		return ibmp;

	CDC dc;

	{
		CClientDC dcc(0);
		dc.CreateCompatibleDC(dcc);
	}

	OLE_YSIZE_HIMETRIC height;
	OLE_XSIZE_HIMETRIC width;
	ipic->get_Height(&height);
	ipic->get_Width(&width);

	CSize nsize(width, height);
	// convert OLE size into pixels
	dc.HIMETRICtoDP(&nsize);

	void* buf;
	BITMAPINFO bmp_info; 
	bmp_info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); 
	bmp_info.bmiHeader.biWidth = nsize.cx; 
	bmp_info.bmiHeader.biHeight = nsize.cy; 
	bmp_info.bmiHeader.biPlanes = 1; 
	bmp_info.bmiHeader.biBitCount = 32; 
	bmp_info.bmiHeader.biCompression = BI_RGB; 
	bmp_info.bmiHeader.biSizeImage = 0; 
	bmp_info.bmiHeader.biXPelsPerMeter = 0; 
	bmp_info.bmiHeader.biYPelsPerMeter = 0; 
	bmp_info.bmiHeader.biClrUsed = 0; 
	bmp_info.bmiHeader.biClrImportant = 0; 

	HBITMAP hbmp=0;
	hbmp = ::CreateDIBSection( 
		dc.m_hDC, 
		&bmp_info, 
		DIB_RGB_COLORS, 
		&buf, 
		0, 
		0 
		); 

	ATLASSERT(hbmp);

	if(hbmp && dc.m_hDC)
	{
		HBITMAP oldbmp=dc.SelectBitmap(hbmp);
		HRESULT hr = ipic->Render(
			dc.m_hDC,
			0,
			nsize.cy,
			nsize.cx,
			-nsize.cy,
			0,
			0,
			width,
			height,
			0);

		ATLASSERT(SUCCEEDED(hr));
		dc.SelectBitmap(oldbmp);
		ibmp=GraphTypes::CreateIBitmap(hbmp);
	}

	return ibmp;
}