本文整理汇总了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);
}
示例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);
}
示例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);
}