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


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

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


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

示例1: TestWinText

void TestWinText(void)
{
	BeginTests();

	ObjectsInit();

	CWinText			cWinText;
	SWinFontInstance*	psWinFont;
	Ptr<CFont>			pcFont;
	CGlyph*				pcCel;
	CImage				cDestImage;

	cWinText.Init(NULL);
	psWinFont = cWinText.Create("Fixedsys", 0, 0, FW_DONTCARE);
	pcFont = cWinText.GenerateFont(psWinFont, "Fixedsys");

	WriteImage(&pcFont->GetImage(), "Output/Fixedsys.bmp");
	AssertFile("Input/Fixedsys.bmp", "Output/Fixedsys.bmp");

	pcCel = pcFont->GetGlyph('H');
	pcCel->GetSubImage()->SetAlignment(SUB_IMAGE_ALIGNMENT_LEFT|SUB_IMAGE_ALIGNMENT_TOP);
	cDestImage.Init(pcCel->GetFullWidth(), pcCel->GetFullHeight(), pcCel->GetSourceImage());
	cDestImage.Clear();
	CImageCopier::Copy(pcCel->GetCel(), &cDestImage, 0, 0);
	WriteImage(&cDestImage, "Output/TheLetterH.png");
	cDestImage.Kill();
	AssertFile("Input/TheLetterH.png", "Output/TheLetterH.png");

	pcFont->Kill();
	cWinText.Kill();

	ObjectsKill();

	TestStatistics();
}
开发者ID:chrisjaquet,项目名称:Codaphela.Test,代码行数:35,代码来源:TestWinText.cpp

示例2: TestImageColourAccessorBytes

void TestImageColourAccessorBytes(void)
{
	CImageColourRGB		cRGB; 
	CImageColourOpacity	cAlpha;
	CImageColourCombo2	cColour;
	CChannels*			pcChannels;
	CImageAccessor*		pcAccessor;
	CImage				cImage;
	SImageColour		sDest;
	BOOL				bResult;
	char*				pvData;

	cRGB.Init(1.0f, 0.5f, 0.25f);
	cAlpha.Init(0.333f);
	cColour.Init(&cRGB, &cAlpha);

	cImage.Init(10, 10, PT_uchar,	IMAGE_DIFFUSE_GREEN,	//0x7f
									IMAGE_NORMAL_Y,		
									IMAGE_DIFFUSE_BLUE,	//0x3f
									IMAGE_OPACITY,		//0x54
									IMAGE_DIFFUSE_RED,	//0xff
									IMAGE_MASK, 
									CHANNEL_ZERO);
	cImage.Clear();

	pcAccessor = CImageAccessorCreator::Create(&cImage, PT_uchar, IMAGE_OPACITY, IMAGE_DIFFUSE_RED, IMAGE_DIFFUSE_GREEN, IMAGE_DIFFUSE_BLUE, CHANNEL_ZERO);

	sDest.Full();
	bResult = pcAccessor->MakeColour(&sDest, &cColour);
	AssertBool(TRUE, bResult);

	//Remember ints have reverse endiannes which is why the test number below looks backwarsd.
	AssertIntHex(0x3f7fff54, *(int*)((void*)sDest.c));

	pcAccessor->Set(1, 0, &sDest);
	pcAccessor->Kill();

	pcChannels = &cImage.mcChannels;

	pvData = pcChannels->GetData();

	//First pixel.  Didn't touch it.
	AssertChar(0x00, pvData[0x0]);
	AssertChar(0x00, pvData[0x1]);
	AssertChar(0x00, pvData[0x2]);
	AssertChar(0x00, pvData[0x3]);
	AssertChar(0x00, pvData[0x4]);
	AssertChar(0x00, pvData[0x5]);

	//Second pixel.
	AssertChar(0x7f, pvData[0x6]);
	AssertChar(0x00, pvData[0x7]);
	AssertChar(0x3f, pvData[0x8]);
	AssertChar(0x54, pvData[0x9]);
	AssertChar((char)0xff, pvData[0xa]);
	AssertChar(0x00, pvData[0xb]);
}
开发者ID:andrewpaterson,项目名称:Codaphela.Test,代码行数:57,代码来源:TestImageColour.cpp

示例3: TestImageColourMultiAccessor

void TestImageColourMultiAccessor(void)
{
	CImageColourNormal		cNormal;
	CImageColourOpacity		cAlpha;
	CImageColourCombo2		cColour;
	CChannels*				pcChannels;
	CImageAccessor*			pcAccessor;
	CImage					cImage;
	SImageColour			sDest;
	BOOL					bResult;

	cNormal.Init(0.7f, -0.6f, -0.5f);
	cAlpha.Init(0.333f);
	cColour.Init(&cNormal, &cAlpha);

	cImage.Init();
	cImage.BeginChange();
	cImage.AddChannel(IMAGE_DIFFUSE_GREEN, PT_uchar);
	cImage.AddChannel(IMAGE_NORMAL_Y, PT_float);
	cImage.AddChannel(IMAGE_DIFFUSE_BLUE, PT_uchar);
	cImage.AddChannel(IMAGE_OPACITY, PT_ushort);
	cImage.AddChannel(IMAGE_DIFFUSE_RED, PT_uchar);
	cImage.AddChannel(IMAGE_MASK, PT_int);
	cImage.AddChannel(IMAGE_NORMAL_Z, PT_float);
	cImage.AddChannel(IMAGE_NORMAL_X, PT_float);
	cImage.SetSize(1, 2);
	cImage.EndChange();
	cImage.Clear();

	pcAccessor = CImageAccessorCreator::Create(&cImage, IMAGE_NORMAL_X, IMAGE_NORMAL_Y, IMAGE_NORMAL_Z, IMAGE_OPACITY, CHANNEL_ZERO);

	sDest.Full();
	bResult = pcAccessor->MakeColour(&sDest, &cColour);
	AssertBool(TRUE, bResult);

	AssertFloat(0.7f, *((float*)&((sDest).c)[0x0]), 3);
	AssertFloat(-0.6f, *((float*)&((sDest).c)[0x4]), 3);
	AssertFloat(-0.5f, *((float*)&((sDest).c)[0x8]), 3);
	AssertShortHex(0x553f, *((unsigned short*)&((sDest).c)[0xc]));

	pcAccessor->Set(0, 1, &sDest);
	pcAccessor->Kill();

	pcChannels = &cImage.mcChannels;
	AssertFloat(-0.6f, *(float*)&(pcChannels->GetData()[22]), 3);
	AssertFloat( 0.7f, *(float*)&(pcChannels->GetData()[38]), 3);
	AssertFloat(-0.5f, *(float*)&(pcChannels->GetData()[34]), 3);
	AssertShortHex(0x553f, *(unsigned short*)&(pcChannels->GetData()[27]));
}
开发者ID:andrewpaterson,项目名称:Codaphela.Test,代码行数:49,代码来源:TestImageColour.cpp

示例4: TestImageColourAccessorFloats

void TestImageColourAccessorFloats(void)
{
	CImageColourNormal	cNormal;
	CChannels*			pcChannels;
	CImageAccessor*		pcAccessor;
	CImage				cImage;
	SImageColour		sDest;
	BOOL				bResult;

	cNormal.Init(0.7f, 0.6f, 0.5f);
	cImage.Init();
	cImage.BeginChange();
	cImage.AddChannel(IMAGE_DIFFUSE_GREEN, PT_uchar);
	cImage.AddChannel(IMAGE_NORMAL_Y, PT_float);
	cImage.AddChannel(IMAGE_DIFFUSE_BLUE, PT_uchar);
	cImage.AddChannel(IMAGE_OPACITY, PT_short);
	cImage.AddChannel(IMAGE_DIFFUSE_RED, PT_uchar);
	cImage.AddChannel(IMAGE_MASK, PT_int);
	cImage.AddChannel(IMAGE_NORMAL_Z, PT_float);
	cImage.AddChannel(IMAGE_NORMAL_X, PT_float);
	cImage.SetSize(1, 2);
	cImage.EndChange();
	cImage.Clear();

	pcAccessor = CImageAccessorCreator::Create(&cImage, PT_float, IMAGE_NORMAL_X, IMAGE_NORMAL_Y, IMAGE_NORMAL_Z, CHANNEL_ZERO);

	sDest.Full();
	bResult = pcAccessor->MakeColour(&sDest, &cNormal);
	AssertBool(TRUE, bResult);

	AssertFloat(0.7f, *((float*)&((sDest).c)[0x0]), 3);
	AssertFloat(0.6f, *((float*)&((sDest).c)[0x4]), 3);
	AssertFloat(0.5f, *((float*)&((sDest).c)[0x8]), 3);

	pcAccessor->Set(0, 1, &sDest);
	pcAccessor->Kill();

	pcChannels = &cImage.mcChannels;
	
	AssertFloat(0.6f, *(float*)&(pcChannels->GetData()[22]), 3);
	AssertFloat(0.7f, *(float*)&(pcChannels->GetData()[38]), 3);
	AssertFloat(0.5f, *(float*)&(pcChannels->GetData()[34]), 3);
}
开发者ID:andrewpaterson,项目名称:Codaphela.Test,代码行数:43,代码来源:TestImageColour.cpp


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