本文整理汇总了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;
}