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


C++ VisualGraphics::clipPixelData方法代码示例

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


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

示例1: createARGBImagePixels

PixelColor* VisualTextureContainer::createARGBImagePixels(bool debug) {
	
	PixelColor* pixelBuffer = NULL;
	
	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	
	if (debug == true) {
		pixelBuffer = VisualColorTools::createARGBCheckPixels(this->textureRect.width, this->textureRect.height);
		return pixelBuffer;
	}
	
	theVisualGraphics->enableTexturing(this->useRectExtension);
	theVisualGraphics->bindTexture(this->textureName, this->useRectExtension);
	theVisualGraphics->setPixelStorageParams();
	
	uint16 format = kGL_BGRA;
	uint16 type;
	
	// GL_BGRA/GL_UNSIGNED_BYTE and GL_BGRA/GL_UNSIGNED_INT_8_8_8_8_REV are equivalent on little endian machines
	
	if (this->useRectExtension == false) {
		
		pixelBuffer = (PixelColor*)malloc(this->textureRect.width * this->textureRect.height * sizeof(PixelColor));
		
		type = kGL_UNSIGNED_BYTE;
		theVisualGraphics->getPixelsOfCurrentTexture(this->useRectExtension, format, type, &(pixelBuffer));
		
#if __BIG_ENDIAN__
		VisualColorTools::convertInterleavedPixels1234To4321(pixelBuffer, this->textureRect.width * this->textureRect.height);
#endif

		if ((this->textureRect.width != this->imageRect.width) || (this->textureRect.height != this->imageRect.height)) {
			// copy actual image pixel data out of texture pixel data
			Pixel topLeftPosition;
			topLeftPosition.x = 0;
			topLeftPosition.y = 0;
			TopLeftPositionedPixelRect clipRect;
			clipRect.topLeftPixel = topLeftPosition;
			clipRect.pixelRect = this->imageRect;
			PixelColor* clippedPixelData = theVisualGraphics->clipPixelData(pixelBuffer, this->textureRect, clipRect);
			free(pixelBuffer);
			pixelBuffer = clippedPixelData;
		}

	} else {
		
		pixelBuffer = (PixelColor*)malloc(this->imageRect.width * this->imageRect.height * sizeof(PixelColor));
		
		type = kGL_UNSIGNED_INT_8_8_8_8_REV;
		theVisualGraphics->getPixelsOfCurrentTexture(this->useRectExtension, format, type, &pixelBuffer);
	}
	
	theVisualGraphics->disableTexturing(this->useRectExtension);
	
	return pixelBuffer;
}
开发者ID:LupusDei,项目名称:8LU-DSP,代码行数:56,代码来源:VisualTextureContainer.cpp


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