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


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

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


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

示例1: OnEraseBkgnd

//绘画背景
BOOL CLayeredDialog::OnEraseBkgnd(CDC * pDC)
{
	//获取位置
	CRect rcClient;
	GetClientRect(&rcClient);

	//建立缓冲
	CImage ImageBuffer;
	ImageBuffer.Create(rcClient.Width(),rcClient.Height(),32);

	if ( ImageBuffer.IsNull() ) return TRUE;

	//创建 DC
	CImageDC BufferDC(ImageBuffer);
	CDC * pBufferDC=CDC::FromHandle(BufferDC);

	//设置缓冲
	pBufferDC->SetBkMode(TRANSPARENT);

	//绘画背景
	m_ImageBack.DrawImage(pBufferDC,0,0);

	OnDrawClientArea(pBufferDC,rcClient.Width(),rcClient.Height());

	//绘画界面
	pDC->BitBlt(0,0,rcClient.Width(),rcClient.Height(),pBufferDC,0,0,SRCCOPY);

	return TRUE;
}
开发者ID:HuugY,项目名称:MFC_Project,代码行数:30,代码来源:LayeredWindow.cpp

示例2: save

DLLEXP bool save(WCHAR *fn)
{
	CImage ci;
	ci.Create(g_snap_width,g_snap_height,32,0);
	BitBlt(ci.GetDC(),0,0,g_snap_width,g_snap_height,g_memdc.m_hDC,0,0,SRCCOPY);
	return SUCCEEDED(ci.Save(fn));
}
开发者ID:bbsdkjdx,项目名称:dcop,代码行数:7,代码来源:llkdll.cpp

示例3: DrawFaceOffLine

//绘画头像
VOID CFaceItemControl::DrawFaceOffLine(CDC * pDC, INT nXPos, INT nYPos, INT nWidth, INT nHeight, DWORD dwCustomFace[FACE_CX*FACE_CY])
{
	//创建位图
	CImage ImageCustomFace;
	ImageCustomFace.Create(FACE_CX,FACE_CY,32);

	//获取数据
	INT nImagePitch=ImageCustomFace.GetPitch();
	LPBYTE cbBitCustomFace=(LPBYTE)ImageCustomFace.GetBits();

	//创建区域
	for (INT nYImagePos=0;nYImagePos<FACE_CY;nYImagePos++)
	{
		for (INT nXImagePos=0;nXImagePos<FACE_CX;nXImagePos++)
		{
			//设置颜色
			DWORD dwImageTarget=nYImagePos*nImagePitch+nXImagePos*4L;
			COLORREF crImageTarget=dwCustomFace[nYImagePos*FACE_CX+nXImagePos];

			//提取颜色
			BYTE cbColorR=GetRValue(crImageTarget);
			BYTE cbColorG=GetGValue(crImageTarget);
			BYTE cbColorB=GetBValue(crImageTarget);
			BYTE cbColorGray=(BYTE)(cbColorR*0.30+cbColorG*0.59+cbColorB*0.11);

			//设置颜色
			*(COLORREF *)(cbBitCustomFace+dwImageTarget)=RGB(cbColorGray,cbColorGray,cbColorGray);
		}
	}

	//绘画界面
	ImageCustomFace.Draw(pDC->m_hDC,nXPos,nYPos,nWidth,nHeight);

	return;
}
开发者ID:cyrillic7,项目名称:CPFrom,代码行数:36,代码来源:faceitemcontrol.cpp

示例4: DrawFaceNormal

//绘画头像
VOID CFaceItemControl::DrawFaceNormal(CDC * pDC, INT nXPos, INT nYPos, INT nWidth, INT nHeight, DWORD dwCustomFace[FACE_CX*FACE_CY])
{
	//创建位图
	CImage ImageCustomFace;
	ImageCustomFace.Create(FACE_CX,FACE_CY,32);

	//获取数据
	INT nImagePitch=ImageCustomFace.GetPitch();
	LPBYTE cbBitCustomFace=(LPBYTE)ImageCustomFace.GetBits();

	//创建区域
	for (INT nYImagePos=0;nYImagePos<FACE_CY;nYImagePos++)
	{
		for (INT nXImagePos=0;nXImagePos<FACE_CX;nXImagePos++)
		{
			//设置颜色
			DWORD dwImageTarget=nYImagePos*nImagePitch+nXImagePos*4L;
			*(COLORREF *)(cbBitCustomFace+dwImageTarget)=dwCustomFace[nYImagePos*FACE_CX+nXImagePos];
		}
	}

	//绘画界面
	ImageCustomFace.Draw(pDC->m_hDC,nXPos,nYPos,nWidth,nHeight);

	return;
}
开发者ID:cyrillic7,项目名称:CPFrom,代码行数:27,代码来源:faceitemcontrol.cpp

示例5: LoadRichEditImage

//处理图片
bool CRichEditMessage::LoadRichEditImage(HINSTANCE hInstance, UINT uResourceID, CDataObject&ImageDataObject)
{
	//加载图片
	CBitImage ImageFile;
	ImageFile.LoadFromResource(hInstance,uResourceID);

	//失败判断
	if (ImageFile.IsNull()==true)
	{
		ASSERT(FALSE);
		return false;
	}

	//创建表情
	CImage ImageRichEdit;
	ImageRichEdit.Create(ImageFile.GetWidth(),ImageFile.GetHeight(),32);

	//绘画表情
	CDC * pDC=CDC::FromHandle(ImageRichEdit.GetDC());
	pDC->FillSolidRect(0,0,ImageFile.GetWidth(),ImageFile.GetHeight(),m_crFillColor);
	ImageFile.TransDrawImage(pDC,0,0,RGB(255,0,255));

	//设置图片
	ImageRichEdit.ReleaseDC();
	ImageDataObject.SetImage(ImageRichEdit.Detach());

	return true;
}
开发者ID:lonyzone,项目名称:oathx-ogrex-editor,代码行数:29,代码来源:RichEditMessage.cpp

示例6: DrawClientArea

void CBaseDialog::DrawClientArea( CDC*pDC,int nWidth,int nHeight )
{
	//创建缓冲
	CImage ImageBuffer;
	ImageBuffer.Create(nWidth,nHeight,32);

	//变量定义
	CDC * pBufferDC=CDC::FromHandle(ImageBuffer.GetDC());

	pBufferDC->FillSolidRect(1,0,nWidth-2,nHeight,RGB(234,238,244));

	if ( CHECK_IMAGE(m_pImageBack) )
	{
		m_pImageBack->DrawImage(pBufferDC,0,0,nWidth-1,nHeight-1);
	}
 
	if ( CHECK_IMAGE(m_pShadow) )
	{
		m_pShadow->DrawImage(pBufferDC,0,0,nWidth-1,nHeight-1);
	}

	DrawView(pBufferDC,nWidth-2,nHeight);

	pBufferDC->SetBkMode(TRANSPARENT);
	pBufferDC->SelectObject(RenderEngine->GetDeaultFont());
	pBufferDC->SetTextColor(RGB(255,255,255));

	//绘画界面
	pDC->BitBlt(0,0,nWidth,nHeight,pBufferDC,0,0,SRCCOPY);

	//清理资源
	ImageBuffer.ReleaseDC();
}
开发者ID:HuugY,项目名称:MFC_Project,代码行数:33,代码来源:BaseDialog.cpp

示例7: DrawFaceItem

//绘画头像
VOID CFaceItemSelectWnd::DrawFaceItem(CDC * pDC, WORD wIndex, INT nXPos, INT nYPos, bool bHover)
{
	//获取对象
	ASSERT(CFaceItemControl::GetInstance()!=NULL);
	IFaceItemControl * pIFaceItemControl=CFaceItemControl::GetInstance();

	//创建缓冲
	CImage ImageBuffer;
	ImageBuffer.Create(FRAME_WIDTH+FACE_CX,FRAME_HEIGHT+FACE_CY,32);

	//绘画背景
	CDC * pBufferDC=CDC::FromHandle(ImageBuffer.GetDC());
	pBufferDC->FillSolidRect(0,0,FRAME_WIDTH+FACE_CX,FRAME_HEIGHT+FACE_CY,CR_BACK_FRAME);

	//绘画框架
	BYTE cbFrameKind=(bHover==true)?ITEM_FRAME_HOVER:ITEM_FRAME_NORMAL;
	pIFaceItemControl->DrawFaceItemFrame(pBufferDC,FRAME_WIDTH/2,FRAME_HEIGHT/2,cbFrameKind);

	//绘画头像
	pIFaceItemControl->DrawFaceNormal(pBufferDC,FRAME_WIDTH/2,FRAME_HEIGHT/2,wIndex);

	//绘画界面
	pDC->BitBlt(nXPos,nYPos,FRAME_WIDTH+FACE_CX,FRAME_HEIGHT+FACE_CY,pBufferDC,0,0,SRCCOPY);

	//清理资源
	ImageBuffer.ReleaseDC();

	return;
}
开发者ID:Michael-Z,项目名称:qipai-game,代码行数:30,代码来源:FaceSelectControl.cpp

示例8: InitExpressItem

//输入解释
void CExpressionItem::InitExpressItem(LPCTSTR pszChineseName, LPCTSTR pszTrancelate, UINT uIDResource)
{
	//设置变量
	m_uImageID=uIDResource;
	lstrcpyn(m_szTrancelate,pszTrancelate,CountArray(m_szTrancelate));
	lstrcpyn(m_szChineseName,pszChineseName,CountArray(m_szChineseName));
	m_wTranceLength=lstrlen(m_szTrancelate);

	//加载图片
	CSkinImage ImageFile;
	ImageFile.LoadFromResource(GetModuleHandle(CLIENT_SHARE_DLL_NAME),uIDResource);

	//创建表情
	CImage ImageExpression;
	ASSERT(ImageFile.GetWidth()==EP_PIC_WHIDE);
	ASSERT(ImageFile.GetHeight()==EP_PIC_HIGHT);
	ImageExpression.Create(EP_PIC_WHIDE,EP_PIC_HIGHT,32);

	//绘画表情
	CDC * pDC=CDC::FromHandle(ImageExpression.GetDC());
	pDC->FillSolidRect(0,0,EP_PIC_WHIDE,EP_PIC_HIGHT,COLOR_CHAR_BK);
	ImageFile.AlphaDrawImage(pDC,0,0,RGB(255,0,255));

	//设置图片
	ImageExpression.ReleaseDC();
	m_ImageDataObject.SetImage(ImageExpression.Detach());

	return;
};
开发者ID:codercold,项目名称:whgame,代码行数:30,代码来源:Expression.cpp

示例9: SaveAsImage

void CChartCtrl::SaveAsImage(const TChartString& strFilename, 
							 const CRect& rect,
							 int nBPP,
							 REFGUID guidFileType)
{
	//AFX_MANAGE_STATE(AfxGetStaticModuleState()); 

	CImage chartImage;
	CRect chartRect = rect;
	if (chartRect.IsRectEmpty())
	{
		GetClientRect(&chartRect);
	}
    
	chartImage.Create(chartRect.Width(), chartRect.Height(), nBPP);
	CDC newDC;
	newDC.Attach(chartImage.GetDC());

	DrawBackground(&newDC, chartRect);
	chartRect.DeflateRect(3,3);
	DrawChart(&newDC, chartRect);

	newDC.Detach();
	chartImage.Save(strFilename.c_str(), guidFileType);
	chartImage.ReleaseDC();
}
开发者ID:sprindy,项目名称:multi-chartctrl-dll,代码行数:26,代码来源:ChartCtrl.cpp

示例10: OnFileSaveAs

void CTreepadView::OnFileSaveAs()
{
	if (!tree.size()) {
		return;
	}
	BOOL isOpen = FALSE;
	CString defaultDir = L"D:\\Treepad\\Iteration";
	CString filter = L"PNG File (*.png)||";
	CString fileName = L"image1.png";         //默认打开的文件名
	CFileDialog openFileDlg(isOpen, L"png", fileName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, filter, NULL);
	INT_PTR result = openFileDlg.DoModal();
	CString filePath = defaultDir + "\\" + fileName;
	if (result == IDOK) {
		filePath = openFileDlg.GetPathName();
		CRect rcBk;
		GetClientRect(&rcBk);
		CDC* pDC = GetDC();
		CImage Image;
		Image.Create(rcBk.Width(), rcBk.Height(), 24);
		::BitBlt(Image.GetDC(), 0, 0, rcBk.Width(), rcBk.Height(), pDC->m_hDC, 0, 0, SRCCOPY);
		Image.Save(filePath);
		Image.ReleaseDC();
		Image.Destroy();
	}
	// TODO: 在此添加命令处理程序代码
}
开发者ID:chipon,项目名称:Treepad,代码行数:26,代码来源:TreepadView.cpp

示例11: OnSrtpEnvironmentbrdf

void CChildView::OnSrtpEnvironmentbrdf()
{
	CWaitCursor wait;//在函数执行过程中使鼠标图标变成等待图标
	int newX = 256, newY = 256;
	CImage tmpimg;
	tmpimg.Create(newX, newY, 24, 0);
	float NoV, roughness;
	float* res = new float[2];
	for (int x = 0; x < newX; x++){
		NoV = x*1.0f / newX;
		for (int y = 0; y < newY; y++){
			roughness = y*2.0f / newY;
			IntegrateBRDF(res, roughness, NoV);
			tmpimg.SetPixelRGB(x, y, (byte)(res[0] * 255), (byte)(res[1] * 255), 0);
		}
	}
	delete[] res;
	imgOriginal.Destroy();
	imgOriginal.Create(newX, newY, tmpimg.GetBPP());//根据新的大小建立CImage,GetBPP是获取其大小
	for (int x = 0; x < newX; x++){
		for (int y = 0; y < newY; y++){
			imgOriginal.SetPixel(x, y, tmpimg.GetPixel(x, y));
		}
	}
	tmpimg.Destroy();
	//刷新显示图像
	Invalidate();
	UpdateWindow();
}
开发者ID:Sylvanuszhy,项目名称:IBL,代码行数:29,代码来源:naiveIBL.cpp

示例12: OnOK

//确定函数
VOID CDlgCustomFace::OnOK()
{
	//连接判断
	bool bConnect=false;

	//系统模式
	if (m_cbMode==MM_SYSTEM)
	{
		CGlobalUserInfo * pGlobalUserInfo=CGlobalUserInfo::GetInstance();
		bConnect=(pGlobalUserInfo->GetGlobalUserData()->wFaceID!=m_wFaceID);
	}

	//自定模式
	if (m_cbMode==MM_CUSTOM)
	{
		//创建缓冲
		CImage ImageCustomFace;
		ImageCustomFace.Create(FACE_CX,FACE_CY,32);

		//创建 DC
		CImageDC BufferDC(ImageCustomFace);
		m_FaceItemCustomWnd.DrawEditImage(CDC::FromHandle(BufferDC),0,0,FACE_CX,FACE_CY);

		//获取数据
		INT nImagePitch=ImageCustomFace.GetPitch();
		LPBYTE cbBitCustomFace=(LPBYTE)ImageCustomFace.GetBits();

		//创建区域
		for (INT nYImagePos=0;nYImagePos<FACE_CY;nYImagePos++)
		{
			for (INT nXImagePos=0;nXImagePos<FACE_CX;nXImagePos++)
			{
				//设置颜色
				DWORD dwImageTarget=nYImagePos*nImagePitch+nXImagePos*4L;
				m_CustomFaceInfo.dwCustomFace[nYImagePos*FACE_CX+nXImagePos]=*(COLORREF *)(cbBitCustomFace+dwImageTarget);
			}
		}

		//设置变量
		bConnect=true;
		m_CustomFaceInfo.dwDataSize=sizeof(m_CustomFaceInfo);
	}

	//激活任务
	if (bConnect==true)
	{
		//控件控制
		EnableControl(false);

		//激活任务
		m_MissionManager.AvtiveMissionItem(this,false);

		return;
	}

	__super::OnOK();
}
开发者ID:cyrillic7,项目名称:CPFrom,代码行数:58,代码来源:DlgCustomFace.cpp

示例13: OnEraseBkgnd

//绘制背景
BOOL CImageEditorControl::OnEraseBkgnd(CDC * pDC)
{
	//获取大小
	CRect rcClient;
	GetClientRect(&rcClient);

	//创建缓冲
	CImage ImageBuffer;
	ImageBuffer.Create(rcClient.Width(),rcClient.Height(),32);

	//变量定义
	HDC hBufferDC=ImageBuffer.GetDC();
	CDC * pBufferDC=CDC::FromHandle(hBufferDC);

	//绘画背景
	pBufferDC->FillSolidRect(&rcClient,RGB(255,255,255));

	//绘画图像
	if (m_ImageSource.IsNull()==false)
	{
		//加载图片
		CPngImage ImageEditGray;
		ImageEditGray.LoadImage(GetModuleHandle(AVATAR_CONTROL_DLL_NAME),TEXT("FACE_EDIT_GRAY"));

		//设置环境
		pBufferDC->SetStretchBltMode(HALFTONE);

		//绘画图片
		m_ImageSource.StretchBlt(hBufferDC,(rcClient.Width()-m_SizeTarget.cx)/2,(rcClient.Height()-m_SizeTarget.cy)/2,
			m_SizeTarget.cx,m_SizeTarget.cy,0,0,m_SizeSource.cx,m_SizeSource.cy);

		//绘画蒙图
		ImageEditGray.DrawImage(pBufferDC,(rcClient.Width()-m_SizeTarget.cx)/2,(rcClient.Height()-m_SizeTarget.cy)/2,
			m_SizeTarget.cx,m_SizeTarget.cy,0,0,ImageEditGray.GetWidth(),ImageEditGray.GetHeight());

		//绘画图片
		m_ImageSource.StretchBlt(hBufferDC,m_rcImageSelect.left,m_rcImageSelect.top,m_rcImageSelect.Width(),m_rcImageSelect.Height(),
			m_SizeSource.cx*(m_rcImageSelect.left-(rcClient.Width()-m_SizeTarget.cx)/2)/m_SizeTarget.cx,
			m_SizeSource.cy*(m_rcImageSelect.top-(rcClient.Height()-m_SizeTarget.cy)/2)/m_SizeTarget.cy,
			m_SizeSource.cx*m_rcImageSelect.Width()/m_SizeTarget.cx,m_SizeSource.cy*m_rcImageSelect.Height()/m_SizeTarget.cy);

		//绘画框架
		DrawLineFrame(pBufferDC);
	}

	//绘画界面
	pDC->BitBlt(0,0,rcClient.Width(),rcClient.Height(),pBufferDC,0,0,SRCCOPY);

	//清理资源
	ImageBuffer.ReleaseDC();

	return TRUE;
}
开发者ID:Michael-Z,项目名称:qipai-game,代码行数:54,代码来源:ImageEditorControl.cpp

示例14: CreateImage

LPIMAGE CreateImage(
    LPSTR       szName,         // image filename
    LPFRAME     lpFrame,        // frame - if NULL, use lpObject
    LPOBJECT    lpObject,       // object list pointer - if NULL, use lpFrame
    LPCMDLIST   lpCmdList,      // command processing list
    ITEMID      FileType,       // image file type - IDN_TIFF, etc.
    ITEMID      DataType,       // image data type - IDC_SAVECT, etc.
    int         DocumentType,   // bitwise document type, normal, fastbits, lowres
    LPSTR       ImageName)      // name used for internal use only
/***********************************************************************/
{
	CImage *pNewImage;
	BOOL fSuccess;

	ASSERT((lpFrame != NULL) || (lpObject != NULL));

	TRY
	{
		pNewImage = new CImage(DataType, szName, lpCmdList, FileType, DocumentType, ImageName);
	}
	CATCH_ALL(e)
	{
		Message(IDS_EMEMALLOC);
		return(NULL);
	}
	END_CATCH_ALL

	if (lpObject)
 		fSuccess = pNewImage->Create(lpObject);
	else
 		fSuccess = pNewImage->Create(lpFrame);

	if (!fSuccess)
	{
	 	delete pNewImage;
		pNewImage = NULL;
	}

	return( pNewImage );
}
开发者ID:,项目名称:,代码行数:40,代码来源:

示例15: ExportTexturePage

void ExportTexturePage(int nPage)
{
	//
	// This is where texture is converted from paletted BGR5A1 to BGRA8
	// Also saving to LEVEL_texture/PAGE_*
	//

	texdata_t* page = &g_pageDatas[nPage];

	if(!page->data)
		return;		// NO DATA

	CImage img;
	uint* color_data = (uint*)img.Create(FORMAT_RGBA8, 256,256,1,1);

	memset(color_data, 0, img.GetSliceSize());

	int clut = max(page->numPalettes, g_texPages[nPage].numDetails);

	for(int i = 0; i < g_texPages[nPage].numDetails; i++, clut++)
	{
		int ox = g_texPages[nPage].details[i].x;
		int oy = g_texPages[nPage].details[i].y;
		int w = g_texPages[nPage].details[i].w;
		int h = g_texPages[nPage].details[i].h;

		char* name = g_textureNamesData + g_texPages[nPage].details[i].texNameOffset;
		
		/*
		Msg("Texture detail %d (%s) [%d %d %d %d]\n", i,name,
														g_texPages[nPage].details[i].x,
														g_texPages[nPage].details[i].y,
														g_texPages[nPage].details[i].w,
														g_texPages[nPage].details[i].h);
		*/
		for(int y = oy; y < oy+h; y++)
		{
			for(int x = ox; x < ox+w; x++)
			{
				ubyte clindex = page->data[y*256 + x];

				TVec4D<ubyte> color = bgr5a1_ToRGBA8( page->clut[i].colors[clindex] );

				color_data[y*256 + x] = *(uint*)(&color);
			}
		}
	}

	Msg("Writing texture %s/PAGE_%d.tga\n", g_levname_texdir.c_str(), nPage);

	img.SaveTGA(varargs("%s/PAGE_%d.tga", g_levname_texdir.c_str(), nPage));
}
开发者ID:SoapyMan,项目名称:driver_psx_level,代码行数:52,代码来源:driver_level.cpp


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