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


C++ ImageAttributes::SetColorKey方法代码示例

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


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

示例1: draw

VOID Balls::draw(Graphics *graphics, Image *images[]) const
{ 
	ImageAttributes imAttr;
	imAttr.SetColorKey(COLOR_KEY, COLOR_KEY);
	for(size_t i = 0; i < NUMBER_OF_BALLS; i++)
		graphics->DrawImage(images[i], Rect(static_cast<INT>(points_[i].getX()) - RShari, static_cast<INT>(points_[i].getY()) - RShari, 2 * RShari, 2 * RShari), 0, 0, 2 * RShari, 2 * RShari, Unit::UnitPixel, &imAttr, 0); 
}
开发者ID:MyLibh,项目名称:Billiards,代码行数:7,代码来源:Balls.cpp

示例2: draw

VOID Cue::draw(Graphics *pGraphics, Pen &rPen, Image &rCue) const
{	
	auxiliaryLine_.draw((ball_ - auxiliaryLine_).getX(), (ball_ - auxiliaryLine_).getY(), pGraphics, rPen, static_cast<ARGB>(Color::Gray));

	rPen.SetColor(static_cast<ARGB>(Color::Gray));
	rPen.SetWidth(3);
	pGraphics->DrawEllipse(&rPen, static_cast<INT>(mouse_.getX() - RShari), static_cast<INT>(mouse_.getY() - RShari), RShari * 2, RShari * 2);

	pGraphics->TranslateTransform(static_cast<REAL>(ball_.getX()), static_cast<REAL>(ball_.getY()));
	pGraphics->RotateTransform(angle_); 
	
	ImageAttributes imAttr;
	imAttr.SetColorKey(COLOR_KEY, COLOR_KEY);		
	pGraphics->DrawImage(&rCue, Rect(static_cast<INT>(-884 - force_ * 8), static_cast<INT>(-20 / 2), 884 * 2, 20), 0, 0, 884 * 2, 20, Unit::UnitPixel, &imAttr, 0);

	pGraphics->ResetTransform();
}
开发者ID:MyLibh,项目名称:Billiards,代码行数:17,代码来源:Cue.cpp

示例3: AppendPNG

/// 加入一张图片,图片横向分成几帧,带关键色
/// @param[in]		const wchar_t	pszFileName*		图片文件名(Unicode)
/// @param[in]		int				nCutInHor			横向分成几帧
void CWndAnimate::AppendPNG(const wchar_t *pszFileName, COLORREF clrKey, int nCutInHor)
{
	Image *img = NULL;

	img = InitImageFromPkg(pszFileName);


	if (NULL == img)
	{
		return;
	}

	if (img->GetWidth()<=0 || img->GetHeight()<=0)
	{
		return;
	}

	ImageAttributes ima;
	ima.SetColorKey(Color(0, GetRValue(clrKey), GetGValue(clrKey), GetBValue(clrKey)), 
		Color(255, GetRValue(clrKey), GetGValue(clrKey), GetBValue(clrKey)));
	for (int i=0; i<nCutInHor; ++i)
	{
		CMemdc memDC;
		memDC.Create(GetDC()->GetSafeHdc(), img->GetWidth()/nCutInHor, img->GetHeight());

		/// 绘图
		Graphics grac(memDC.GetCompatibleDC());
		grac.DrawImage(img, Rect(0, 0, memDC.GetWidth(), memDC.GetHeight()),
			img->GetWidth()/nCutInHor*i, 0, img->GetWidth()/nCutInHor, img->GetHeight(), UnitPixel, &ima);
		grac.ReleaseHDC(memDC.GetCompatibleDC());

		m_FrameList.push_back(memDC);
		m_nFrameCount ++;
	}	

	delete img;
	img = NULL;
}
开发者ID:lincoln56,项目名称:robinerp,代码行数:41,代码来源:WndAnimate.cpp

示例4: InitImageAttributes

// ***************************************************************
//		InitImageAttributes()
// ***************************************************************
void TilesDrawer::InitImageAttributes(TileManager* manager, ImageAttributes& attr)
{
	attr.SetWrapMode(WrapModeTileFlipXY);

	if (!manager->IsBackground())
	{
		Gdiplus::ColorMatrix m = ImageHelper::CreateMatrix(manager->contrast,
			manager->brightness,
			manager->saturation,
			manager->hue,
			0.0f, RGB(255, 255, 255), false, manager->get_Alpha() / 255.0f);

		attr.SetColorMatrix(&m);

		if (manager->useTransparentColor)
		{
			Gdiplus::Color color(GetRValue(manager->transparentColor),
								 GetGValue(manager->transparentColor),
								 GetBValue(manager->transparentColor));

			attr.SetColorKey(color, color);
		}
	}
}
开发者ID:liuzhumei,项目名称:MapWinGIS,代码行数:27,代码来源:TilesDrawer.cpp


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