当前位置: 首页>>代码示例>>C++>>正文


C++ CDib类代码示例

本文整理汇总了C++中CDib的典型用法代码示例。如果您正苦于以下问题:C++ CDib类的具体用法?C++ CDib怎么用?C++ CDib使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CDib类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetEvent

void CVisionTab::updateDepthStream()
{
	if(WAIT_OBJECT_0 == WaitForSingleObject(kinect.m_dFrameReadyEvent, 0))
	{

	if(pBufDepth == NULL && pDepth != NULL) {
		pBufDepth = pDepth->CopyCDib();
		SetEvent(m_GetDimgEvent);
	}

	if(pDepth != NULL) {delete pDepth; pDepth=NULL;}

	CDib *pDibDepth = kinect.getCDibDepthImage()->CopyCDib();
	pDepth = pDibDepth->CopyCDib();
	
	
	if(pDibDepth) {
		// Display update
		if(clip) {
			CDib *pDepth = pDibDepth->ClipCDib(m_ClipRect);	// memory leak when using median filter... 
			m_DispDepth.SetDib(pDepth);

		} else {
			m_DispDepth.SetDib(pDibDepth->CopyCDib());
		}

		delete pDibDepth;
	}

	}
}
开发者ID:HoomanLee,项目名称:HT_RTS,代码行数:31,代码来源:VisionTab.cpp

示例2: Copy

void CDib::Copy(const CDib& dib, UINT nBitCount)
{
	if( &dib != this)
	{
		Empty();
		if( !dib.IsNull() )
		{
		
			int height = dib.GetHeight();
			int width = dib.GetWidth();
			Create(width, height, nBitCount);

			if( nBitCount <= 8)
			{
				CPalette palette;
				dib.CreatePaletteFromImage(palette);
				SetPalette( palette );
				//MakePalette();
			}

			for(int i=0; i<width; i++)
			{
				for(int j=0; j<height; j++)
				{
					SetPixel(i,j, dib.GetPixel(i, j) );
				}
			}
		}
	}
}
开发者ID:RNCan,项目名称:WeatherBasedSimulationFramework,代码行数:30,代码来源:CDib.cpp

示例3: CDib

/*
*--------------------------------------------------------------------------------
*  函数名	: MergeDib
*  功能		: 将窗口内的图像与指定图像融合
*  参数		: CDib* pDib	-	画布图像,融合于此DIB之上
*  算法		: 先隐藏按钮,然后将窗口内的图像抓取下来,再将此DIB与参数DIB融合
*--------------------------------------------------------------------------------
*/
BOOL CFloatDibWnd::MergeDib(CDib * pDib)
{	
	CDib* newDib = new CDib();
	
	// 隐藏全部形变按钮
	if(g_createBtn)
    	HideAllButton();

	CRect rcSelf, rcParent;
	GetWindowRect(&rcSelf);
	::GetWindowRect(m_hParentWnd, &rcParent);

	// 抓取浮动窗口客户区图像
	newDib->Create(GetSafeHwnd(), CRect(0, 0, rcSelf.Width(), rcSelf.Height()) );

	// 计算起点座标
	int xStart, yStart;

	// 减 2 是因为边框占两个像素
	xStart = rcSelf.left - rcParent.left - 2;
	yStart = rcSelf.top - rcParent.top - 2;

	pDib->MergeDib(newDib->GetHandle(), CPoint(xStart, yStart));

	delete newDib;
	return TRUE;
}
开发者ID:obabywawa,项目名称:UPIM,代码行数:35,代码来源:FloatDibWnd.cpp

示例4: CDib

BOOL CSpermView::WriteImageToDisk(int i, CFile *pFile)
{
	CDib *pDib = new CDib(m_lpBMIH[i], m_lpImage[i]);
	BOOL ret = pDib->SaveDibFile(pFile);
	delete pDib, pDib = NULL;
	return ret;
}
开发者ID:niepp,项目名称:sperm-x,代码行数:7,代码来源:SpermView.cpp

示例5: ASSERT

ERMsg CDib::SaveImage(const CString& filePath, REFGUID guidFileType, int bpp)const
{
	ASSERT( guidFileType != GUID_NULL || !UtilWin::GetFileExtension(filePath).IsEmpty() );
	ERMsg message;

	if( bpp == -1)
	{
		bpp = GetBPP();
	}
	else if( bpp != GetBPP())
	{
		CDib dib;
		dib.Copy( *this, bpp);
		return dib.SaveImage(filePath, guidFileType);
	}

	

	if( FAILED(Save(filePath, guidFileType)))
	{
		CString error;
		error.FormatMessage(IDS_BSC_UNABLE_OPEN_WRITE, filePath );
		message.ajoute( UtilWin::ToUTF8(error) );
	}

	return message;
}
开发者ID:RNCan,项目名称:WeatherBasedSimulationFramework,代码行数:27,代码来源:CDib.cpp

示例6: CopyRect

VOID CDibUtil::CopyRect(CDib& src, CDib& dest, const CRect rect)
{
	// TODO: The validation of rect in source and destination
	// images should be checked
	for (LONG y = rect.top; y <= rect.bottom; ++y)
		for (LONG x = rect.left; x <= rect.right; ++x)
			dest.WritePixel(x, y, src.GetPixel(x, y));
}
开发者ID:microdog,项目名称:DigitalImageProcessingCourseProject,代码行数:8,代码来源:DibUtil.cpp

示例7: Subtract

VOID CDibUtil::Subtract(CDib& imgA, CDib& imgB, CDib& dest)
{
	dest.CopyDib(&imgA);
	CSize imageSize = imgA.GetDimensions();

	for (LONG y = 0; y != imageSize.cy; ++y)
		for (LONG x = 0; x != imageSize.cx; ++x)
		{
			dest.WritePixel(x, y, RGBSUB(imgA.GetPixel(x, y), imgB.GetPixel(x, y)));
		}
}
开发者ID:microdog,项目名称:DigitalImageProcessingCourseProject,代码行数:11,代码来源:DibUtil.cpp

示例8: GetDepthImage

CDib* CVisionTab::GetDepthClipImage(RECT *pRect)
{
	CDib* pTmp;
	CDib* pDib;
	
	if(WAIT_OBJECT_0 == WaitForSingleObject(m_GetDimgEvent, INFINITE))
		pTmp = GetDepthImage();
	if(pTmp) pDib = pTmp->ClipCDib(pRect);
	delete pTmp; pTmp=NULL;

	return pDib;
}
开发者ID:HoomanLee,项目名称:HT_RTS,代码行数:12,代码来源:VisionTab.cpp

示例9: AfxThrowResourceException

BOOL CGelDoc::LoadSample(LPCTSTR pszFilename)
{
	CFile file;
	CDib* pDib = NULL;

	TRY
	{
		if (!file.Open(pszFilename, CFile::modeRead | CFile::shareDenyNone))
			AfxThrowResourceException();

		pDib = new CDib();
		pDib->LoadDib(&file); // throws
		pDib->DeleteDib();
		delete pDib;
		pDib = NULL;

		// If we got this far, go for the gusto and replace our sample.

		delete m_pUntransformed;
		file.Seek(0L, CFile::begin);
		m_pUntransformed = new CDib(&file);

		delete m_pTransformed;
		file.Seek(0L, CFile::begin);
		m_pTransformed = new CDib(&file);

		delete m_pSelection;
		file.Seek(0L, CFile::begin);
		m_pSelection = new CDib(&file);

		file.Close();
	}
	CATCH_ALL(e)
	{
		if (pDib)
			delete pDib;

		if (file.m_hFile)
			file.Close();

		return FALSE;
	}
	END_CATCH_ALL

	ApplyGel();
	ApplySelection();
	CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
	if (pFrame)
		pFrame->UpdateSample();

	return TRUE;
}
开发者ID:AlleyCat1976,项目名称:Meridian59_103,代码行数:52,代码来源:GelDoc.cpp

示例10: ASSERT

/*
*--------------------------------------------------------------------------------
*  成员函数名   : OnPaint() 
*  功能描述     : 绘制窗体或窗体尺寸发生改变时重画窗体
*  算法			: 透明显示位图,透明色为 g_stuPaintSet.tranCol
*  附加说明		: 窗口缩放时图像并不改变,而是在显示时改变复制位图,然后缩放显示
*--------------------------------------------------------------------------------
*/
void CFloatDibWnd::OnPaint() 
{
	ASSERT(m_pDib);

	CRect rect;
	GetClientRect(&rect);

	// 用当前图像创建一个临时位图,对它进行缩放显示,以防失真
	CDib *pTmpDib = m_pDib->Clone();
	pTmpDib->ChangeImageSize(rect.Width(), rect.Height()); 
	pTmpDib->DisplayTransparent(GetDC(), 0, 0, g_stuPaintSet.tranCol);
	delete pTmpDib;

	CWnd::OnPaint();
}
开发者ID:obabywawa,项目名称:UPIM,代码行数:23,代码来源:FloatDibWnd.cpp

示例11: GetBitmapDC

BOOL CDib::GetBitmapDC(LPCSTR filename,HDC screenDC,HDC& hdc)
{
	CDib dib;
	LPCDibinfo bit;

	bit = dib.GetBitmap(filename);
	hdc = CreateCompatibleDC(screenDC);
	HBITMAP bitmap = CreateCompatibleBitmap(screenDC,bit->DI_Width,bit->DI_Height);
	SelectObject(hdc,bitmap);
	SetDIBitsToDevice(hdc,0,0,bit->DI_Width,bit->DI_Height,0,0,0,bit->DI_Height,bit->DI_Bitmap,bit->DI_BitmapInfo,DIB_RGB_COLORS);
	DeleteObject(bitmap);
	bit->DI_Release();

	return TRUE;
}
开发者ID:ShawnKim79,项目名称:2003_Summer,代码行数:15,代码来源:Dibinfo.cpp

示例12: Graying

VOID CDibUtil::Graying(CDib& src, CDib& dest)
{
	dest.CopyDib(&src);
	CSize imageSize = src.GetDimensions();

	RGBQUAD color;
	for (LONG y = 0; y != imageSize.cy; ++y)
		for (LONG x = 0; x != imageSize.cx; ++x)
		{
			color = src.GetPixel(x, y);
			color.rgbRed = color.rgbGreen = color.rgbBlue
				= GRAYING(color.rgbRed, color.rgbGreen, color.rgbBlue);
			dest.WritePixel(x, y, color);
		}
}
开发者ID:microdog,项目名称:DigitalImageProcessingCourseProject,代码行数:15,代码来源:DibUtil.cpp

示例13: Binaryzation

VOID CDibUtil::Binaryzation(CDib& src, CDib& dest, BYTE threshold)
{
	dest.CopyDib(&src);
	CSize imageSize = src.GetDimensions();
	
	RGBQUAD color;
	for (LONG y = 0; y != imageSize.cy; ++y)
		for (LONG x = 0; x != imageSize.cx; ++x)
		{
			color = src.GetPixel(x, y);
			color.rgbRed = color.rgbGreen = color.rgbBlue
				= (GRAYING(color.rgbRed, color.rgbGreen, color.rgbBlue) < threshold) ? 0x00 : 0xFF;
			dest.WritePixel(x, y, color);
		}
}
开发者ID:microdog,项目名称:DigitalImageProcessingCourseProject,代码行数:15,代码来源:DibUtil.cpp

示例14: while

void CDibMgr::RemoveAllDibs()
{
	// Delete all dibs from our collection...

	POSITION pos = m_collDibs.GetHeadPosition();

	while (pos)
	{
		CDib* pDib = (CDib*)m_collDibs.GetNext(pos);
		ASSERT(pDib && pDib->IsValid());

		delete pDib;
	}

	m_collDibs.RemoveAll();
}
开发者ID:rickyharis39,项目名称:nolf2,代码行数:16,代码来源:dibmgr.cpp

示例15: ASSERT

CDib* CDibMgr::AddDib(const char* sFile, DWORD flags)
{
	// Sanity checks...

	ASSERT(IsValid());
	ASSERT(sFile);


	// Get an hDC to our window...

	HDC hDC = GetDC(FALSE);


	// Set the global hInst in case we are trying to load a res...

	s_hInst = m_hInst;


	// Create and init a new dib...

	CDib* pDib = new CDib();

	if (!pDib->Init(sFile, hDC, flags))
	{
		ReleaseDC(hDC);
		delete pDib;
		return(NULL);
	}


	// Add the new dib to our collection...

	POSITION pos = m_collDibs.AddTail(pDib);

	pDib->SetPos(pos);


	// Clean up...

	ReleaseDC(hDC);


	// All done...

	return(pDib);
}
开发者ID:rickyharis39,项目名称:nolf2,代码行数:46,代码来源:dibmgr.cpp


注:本文中的CDib类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。