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


C++ CImagePtr::getImage方法代码示例

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


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

示例1: drawMe

void CNavView::drawMe (HDC hdc) {
	if (m_currIndex == -1) {
		return;
	}

	CRect rc = getClientRect();
	xl::ui::CDCHandle dc(hdc);
	xl::ui::CDC mdc;
	mdc.CreateCompatibleDC(dc);

	xl::CScopeLock lock(m_pImageManager);
	CCachedImagePtr cachedImage = m_pImageManager->getCachedImage(m_currIndex);
	CImagePtr image = cachedImage->getThumbnailImage();
	if (image == NULL) {
		cachedImage.reset();
		return;
	}
	xl::ui::CDIBSectionPtr dib = image->getImage(0);
	lock.unlock();

	CSize szImage = image->getImageSize();

	// draw text
	CRect rcText = m_rect;
	rcText.top += border.top.width + 2;
	rcText.left += border.left.width + 2;
	COLORREF oldColor = dc.SetTextColor(RGB(255,255,255));
	dc.drawTransparentTextWithDefaultFont(m_ratio, -1, rcText, DT_LEFT);
	dc.SetTextColor(oldColor);

	int oldMode = dc.SetStretchBltMode(HALFTONE);
	if (!m_dragable) {
		CRect rcView = m_rcView;
		rcView.OffsetRect(rc.left, rc.top);
		m_dibView->attachToDC(mdc);
		BLENDFUNCTION bf = {AC_SRC_OVER, 0, 75, 0};
		dc.AlphaBlend(rcView.left, rcView.top, rcView.Width(), rcView.Height(), mdc, 0, 0, 1, 1, bf);
		m_dibView->detachFromDC(mdc);

		CRect rcImage = m_rcImage;
		rcImage.OffsetRect(rc.left, rc.top);

		dib->attachToDC(mdc);
		dc.StretchBlt(rcImage.left, rcImage.top, rcImage.Width(), rcImage.Height(), mdc, 0, 0, dib->getWidth(), dib->getHeight(), SRCCOPY);
		dib->detachFromDC(mdc);
	} else {
		CRect rcImage = m_rcImage;
		rcImage.OffsetRect(rc.left, rc.top);

		dib->attachToDC(mdc);
		int oldMode = dc.SetStretchBltMode(HALFTONE);
		dc.StretchBlt(rcImage.left, rcImage.top, rcImage.Width(), rcImage.Height(), mdc, 0, 0, dib->getWidth(), dib->getHeight(), SRCCOPY);
		dc.SetStretchBltMode(oldMode);
		dib->detachFromDC(mdc);

		CRect rcView = m_rcView;
		rcView.OffsetRect(rc.left, rc.top);
		m_dibView->attachToDC(mdc);
		BLENDFUNCTION bf = {AC_SRC_OVER, 0, 75, 0};
		dc.AlphaBlend(rcView.left, rcView.top, rcView.Width(), rcView.Height(), mdc, 0, 0, 1, 1, bf);
		m_dibView->detachFromDC(mdc);

		CRect rcEdge = rcView;
		dc.drawRectangle(rcEdge, 1, RGB(32,32,32), PS_SOLID);
		rcEdge.DeflateRect(1, 1, 1, 1);
		dc.drawRectangle(rcEdge, 1, RGB(200,200,200), PS_SOLID);
	}
	dc.SetStretchBltMode(oldMode);
}
开发者ID:cyberscorpio,项目名称:xlview,代码行数:69,代码来源:NavView.cpp


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