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


C++ CImage::GetDIB方法代码示例

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


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

示例1: OnEditCopy

/*
	OnEditCopy()
*/
void CWallBrowserStretchView::OnEditCopy(void)
{
	CWaitCursor cursor;
	BOOL bCopied = FALSE;

	// copia il contenuto dell'immagine nella clipboard
	if(::OpenClipboard(NULL))
	{
		if(::EmptyClipboard())
		{
			CWallBrowserDoc* pDoc = (CWallBrowserDoc*)GetDocument();
			if(pDoc)
			{
				CImage *pImage = pDoc->GetImage();
				if(pImage && pImage->GetWidth() > 0 && pImage->GetHeight() > 0)
					bCopied = ::SetClipboardData(CF_DIB,pImage->GetDIB())!=(HANDLE)NULL;
			}
		}

		::CloseClipboard();
	}

	// imposta il redo con l'ultima operazione effettuata
	if(bCopied)
		RedoPush(ID_EDIT_COPY);
}
开发者ID:code4bones,项目名称:crawlpaper,代码行数:29,代码来源:WallBrowserStretchView.cpp

示例2: UndoPop

/*
	UndoPop()
*/
BOOL CWallBrowserStretchView::UndoPop(void)
{
	BOOL bUndo = FALSE;

	if(--m_nUndoLevel >= 0)
	{
		CWallBrowserDoc* pDoc = (CWallBrowserDoc*)GetDocument();
		if(pDoc)
		{
			CImage *pImage = pDoc->GetImage();
			if(pImage && pImage->GetWidth() > 0 && pImage->GetHeight() > 0)
			{
				int index;
				CImage* pImg;

				UNDOINFO* undoinfo = m_UndoInfo.Pop(index);
				if(index >= 0 && undoinfo)
				{
					m_nRedo = undoinfo->nRedo;

					CImageFactory* pImgFactory = undoinfo->pImageFactory;
					pImg = pImgFactory->GetImage();
					HDIB hDib = pImg->GetDIB(&(undoinfo->DibInfo));
					
					if(hDib)
					{
						pImage->SetDIB(hDib,&(undoinfo->DibInfo));
						::GlobalFree(hDib);
						delete (CImageFactory*)undoinfo->pImageFactory;
						delete undoinfo;
						bUndo = TRUE;
					}
					else
					{
						delete (CImageFactory*)undoinfo->pImageFactory;
						delete undoinfo;
					}
				}
				else
					::MessageBeep(MB_ICONEXCLAMATION);
			}
		}
	}
	else
		m_nUndoLevel++;

	CWnd* pWnd = AfxGetMainWnd();
	if(pWnd)
	{
		pWnd->SendMessage(WM_EDIT_UNDO,UndoEnabled(),0L);
		pWnd->SendMessage(WM_EDIT_REDO,RedoEnabled(),0L);
	}

	return(bUndo);
}
开发者ID:code4bones,项目名称:crawlpaper,代码行数:58,代码来源:WallBrowserStretchView.cpp

示例3: UndoPush

/*
	UndoPush()
*/
BOOL CWallBrowserStretchView::UndoPush(int nID)
{
	BOOL bUndo = FALSE;

	if(++m_nUndoLevel <= MAX_STACK_SIZE)
	{
		// salva il contenuto dell'immagine nello stack per l'undo
		CWallBrowserDoc* pDoc = (CWallBrowserDoc*)GetDocument();
		if(pDoc)
		{
			CImage *pImage = pDoc->GetImage();
			if(pImage && pImage->GetWidth() > 0 && pImage->GetHeight() > 0)
			{
				CImage* pImg;
				CImageFactory* pImgFactory = new CImageFactory();
				char szLibraryName[_MAX_PATH+1];
				strcpy(szLibraryName,pImage->GetLibraryName());
				pImg = pImgFactory->Create(szLibraryName,sizeof(szLibraryName));
				DIBINFO DibInfo;
				DibInfo.nPerspective = 0;

				HDIB hDib = pImage->GetDIB(&DibInfo);
				if(hDib)
				{
					pImg->SetDIB(hDib,&DibInfo);
					::GlobalFree(hDib);
					
					UNDOINFO* undoinfo = new UNDOINFO;
					undoinfo->pImageFactory = pImgFactory;
					undoinfo->DibInfo.nPerspective = DibInfo.nPerspective;
					undoinfo->nRedo = nID;
					int nLevel = m_UndoInfo.Push(undoinfo);
					if(nLevel!=-1)
						bUndo = TRUE;
				}
				else
				{
					delete pImgFactory;
				}
			}
		}
	}
	else
		m_nUndoLevel--;

	CWnd* pWnd = AfxGetMainWnd();
	if(pWnd)
	{
		pWnd->SendMessage(WM_EDIT_UNDO,UndoEnabled(),0L);
		pWnd->SendMessage(WM_EDIT_REDO,FALSE,0L);
	}

	return(bUndo);
}
开发者ID:code4bones,项目名称:crawlpaper,代码行数:57,代码来源:WallBrowserStretchView.cpp


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