• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ VisualGraphics类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetDlgItem

void CDisplayResolutionPane::OnSelchangeCombo1() {
	char str[32];
	CComboBox* pCB = (CComboBox*) GetDlgItem(IDC_COMBO1);

	pCB->GetLBText(pCB->GetCurSel(), str);

	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	UInt16 horizontalPixels;
	UInt16 verticalPixels;
	UInt16 bitsPerPixel;
	UInt16 refreshRate;
	theVisualGraphics->matchDisplayResolutionShowStrWithPrefs(str, horizontalPixels, verticalPixels, bitsPerPixel, refreshRate);

	VisualDataStore::setPreferenceValueInt(VisualConfiguration::kFullscreenWidth, horizontalPixels);
	VisualDataStore::setPreferenceValueInt(VisualConfiguration::kFullscreenHeight, verticalPixels);
	VisualDataStore::setPreferenceValueInt(VisualConfiguration::kFullscreenBitsPerPixel, bitsPerPixel);
	VisualDataStore::setPreferenceValueInt(VisualConfiguration::kFullscreenRefreshRate, refreshRate);
	
	VisualDataStore::storePreferences();
	
	UInt16 minBitsPerPixel = 24;
	UInt16 maxBitsPerPixel = 32;
	VisualDataStore::setPreferredDisplayResolution(minBitsPerPixel, maxBitsPerPixel, bitsPerPixel, horizontalPixels, verticalPixels);

}
开发者ID:Room1337,项目名称:projectM-update,代码行数:25,代码来源:DisplayResolutionPane.cpp


示例2:

VisualTextureContainer::VisualTextureContainer(UInt32 anImageWidth, UInt32 anImageHeight, bool useRectExtensionBool) {
	textureIsSet = false;
	textureName = 0;
	imageWidth = anImageWidth;
	imageHeight = anImageHeight;
	useRectExtension = useRectExtensionBool;
	if (useRectExtensionBool == false) {
		VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
		textureWidth = theVisualGraphics->power2Ceiling(imageWidth);
		textureHeight = theVisualGraphics->power2Ceiling(imageHeight);
		textureLogicalWidth = (double)imageWidth / (double)textureWidth;
		textureLogicalHeight = (double)imageHeight / (double)textureHeight;
	} else {
		textureWidth = imageWidth;
		textureHeight = imageHeight;
		textureLogicalWidth = (double)textureWidth;
		textureLogicalHeight = (double)textureHeight;
	}
	pixelFormat = kGL_BGRA;
#if __BIG_ENDIAN__
	dataType = kGL_UNSIGNED_INT_8_8_8_8_REV;
#else
#if TARGET_OS_WIN
	dataType = kGL_UNSIGNED_BYTE;
#else
	dataType = kGL_UNSIGNED_INT_8_8_8_8;
#endif
#endif
	pixelBuffer = NULL;
}
开发者ID:alexpaulzor,项目名称:projectm,代码行数:30,代码来源:VisualTextureContainer.cpp


示例3: releaseTextureData

void VisualTextureContainer::releaseTextureData() {
	if (this->aTextureIsSet) {
		VisualTextureContainer::textureRefCountMap[this->textureName]--;
		if (VisualTextureContainer::textureRefCountMap[this->textureName] == 0) {
			VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
			theVisualGraphics->deleteTextures(1, &(this->textureName));
			this->textureName = 0;
			this->aTextureIsSet = false;
		}
	}
}
开发者ID:LupusDei,项目名称:8LU-DSP,代码行数:11,代码来源:VisualTextureContainer.cpp


示例4: sizeof

void VisualTextureContainer::resample(const PixelRect& pixelRect) {
	
	PixelColor* pixels = this->createARGBImagePixels();
	PixelColor* pixelsOut = (PixelColor*)malloc(pixelRect.width * pixelRect.height * sizeof(PixelColor));
	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	uint16 aPixelFormat = kGL_RGBA;
	uint16 dataTypeIn = kGL_UNSIGNED_BYTE;
	uint16 dataTypeOut = dataTypeIn;
	theVisualGraphics->resample(aPixelFormat, this->imageRect.width, this->imageRect.height, dataTypeIn, pixels, pixelRect.width, pixelRect.height, dataTypeOut, &pixelsOut);
	free(pixels);

	this->initWithARGBPixelData(pixelsOut, pixelRect.width, pixelRect.height);
	free(pixelsOut);

}
开发者ID:LupusDei,项目名称:8LU-DSP,代码行数:15,代码来源:VisualTextureContainer.cpp


示例5: free

OSStatus VisualTextureContainer::initWithURL(VisualString& anURL) {

	this->releaseTextureData();
	if (this->pixelBuffer != NULL) {
		free(this->pixelBuffer);
		this->pixelBuffer = NULL;
	}

	OSStatus osStatus = noErr;
	
	CFURLRef imageURL = CFURLCreateWithString(kCFAllocatorDefault, anURL.getCharactersPointer(), NULL);
	CGImageSourceRef imageSource = CGImageSourceCreateWithURL(imageURL, NULL);
	CGImageRef imageRef = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL);
	this->imageWidth = CGImageGetWidth(imageRef);
	this->imageHeight = CGImageGetHeight(imageRef);
	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	this->useRectExtension = theVisualGraphics->canUseTextureRectExtension();
	if (this->useRectExtension == false) {
		this->textureWidth = theVisualGraphics->power2Ceiling(this->imageWidth);
		this->textureHeight = theVisualGraphics->power2Ceiling(this->imageHeight);
	} else {
		this->textureWidth = this->imageWidth;
		this->textureHeight = this->imageHeight;
	}
	CGContextRef context = theVisualGraphics->createBitmapContext(this->textureWidth, this->textureHeight);

	CGContextTranslateCTM(context, 0.0, (float)this->textureHeight + (float)(this->textureHeight - this->imageHeight));
	CGContextScaleCTM(context, 1.0, -1.0);

	CGRect rect = CGRectMake(0, (this->textureHeight - this->imageHeight), this->imageWidth, this->imageHeight);
	CGContextDrawImage(context, rect, imageRef);

	this->pixelBuffer = static_cast<UInt32*>(CGBitmapContextGetData(context));

	this->textureName = theVisualGraphics->getNextFreeTextureName();
	this->textureIsSet = true;
	VisualTextureContainer::textureRefCountMap[this->textureName] = 1;
	theVisualGraphics->copyARGBBitmapDataToTexture(this->textureName, this->textureWidth, this->textureHeight, this->useRectExtension, this->pixelFormat, this->dataType, const_cast<const UInt32**>(&(this->pixelBuffer)));

	CGContextRelease(context);
	if (this->pixelBuffer) {
		free(this->pixelBuffer);
		this->pixelBuffer = NULL;
	}
	CGImageRelease(imageRef);

	if (this->useRectExtension == false) {
		this->textureLogicalWidth = (double)this->imageWidth / (double)this->textureWidth;
		this->textureLogicalHeight = (double)this->imageHeight / (double)this->textureHeight;
	} else {
		this->textureLogicalWidth = (double)this->textureWidth;
		this->textureLogicalHeight = (double)this->textureHeight;
	}

	return osStatus;

}
开发者ID:alexpaulzor,项目名称:projectm,代码行数:57,代码来源:VisualTextureContainer.cpp


示例6: initWithARGBPixelData

bool VisualTextureContainer::initWithARGBPixelData(PixelColor* argbPixels, size_t imageWidth, size_t imageHeight, bool debug) {
	
	bool success = true;
	
	this->imageRect.width = imageWidth;
	this->imageRect.height = imageHeight;
	
	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	this->useRectExtension = theVisualGraphics->canUseTextureRectExtension();
	if (this->useRectExtension == false) {
		this->textureRect.width = theVisualGraphics->power2Ceiling(this->imageRect.width);
		this->textureRect.height = theVisualGraphics->power2Ceiling(this->imageRect.height);
	} else {
		this->textureRect.width = this->imageRect.width;
		this->textureRect.height = this->imageRect.height;
	}
	
	this->textureName = theVisualGraphics->getNextFreeTextureName();
	this->aTextureIsSet = true;
	VisualTextureContainer::textureRefCountMap[this->textureName] = 1;
	
	success = theVisualGraphics->copyARGBBitmapDataToTexture(this->textureName, this->imageRect.width, this->imageRect.height, this->useRectExtension, const_cast<const uint32**>(&(argbPixels)), debug);
	
	if (this->useRectExtension == false) {
		this->logicalSize.width = (double)this->imageRect.width / (double)this->textureRect.width;
		this->logicalSize.height = (double)this->imageRect.height / (double)this->textureRect.height;
	} else {
		this->logicalSize.width = (double)this->textureRect.width;
		this->logicalSize.height = (double)this->textureRect.height;
	}
	
	return success;
}
开发者ID:LupusDei,项目名称:8LU-DSP,代码行数:33,代码来源:VisualTextureContainer.cpp


示例7: graphicsDoSupportTextureRectExtension

uint8 graphicsDoSupportTextureRectExtension() {
	VisualGraphics* theVisualGraphics = NULL;
	theVisualGraphics = VisualGraphics::getInstance();
	return (theVisualGraphics->canUseTextureRectExtension());
}
开发者ID:LupusDei,项目名称:8LU-DSP,代码行数:5,代码来源:VisualDispatch.cpp


示例8: copyARGBBitmapDataToTexture

bool copyARGBBitmapDataToTexture(uint32 textureNumber, uint32 imageWidth, uint32 imageHeight, bool canUseRectExtension, uint32** bitmapData) {
	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	return theVisualGraphics->copyARGBBitmapDataToTexture(textureNumber, imageWidth, imageHeight, canUseRectExtension, const_cast<const uint32**>(bitmapData));
}
开发者ID:LupusDei,项目名称:8LU-DSP,代码行数:4,代码来源:VisualDispatch.cpp


示例9: sprintf

void VisualTextureContainer::applyConvolutionFilter(const VisualConvolutionFilter& aConvolutionFilter) {
	
	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();

	uint16 dataType;
	uint16 pixelFormat = kGL_BGRA;
	// BGRA on intel machines and ARGB on ppc
#if TARGET_OS_WIN
	dataType = kGL_UNSIGNED_BYTE;
#else
#if __BIG_ENDIAN__
	dataType = kGL_UNSIGNED_INT_8_8_8_8_REV;
#else
	dataType = kGL_UNSIGNED_INT_8_8_8_8;
#endif
#endif
	
	if (theVisualGraphics->doesSupportGLConvolutionFilter()) {
		
		int prevReadBuffer = theVisualGraphics->getCurrentColorBufferForPixelReadingOperations();
		theVisualGraphics->setColorBufferForPixelReadingOperations(kGL_BACK_COLOR_BUFFER);
		
		int prevDrawBuffer = theVisualGraphics->getCurrentColorBufferForPixelDrawingOperations();
		theVisualGraphics->setColorBufferForPixelDrawingOperations(kGL_BACK_COLOR_BUFFER);
		
		uint32* prevPixels = NULL;
		
		char errStr[512];
		
		uint8 numberOfBytesPerChannel = 0;
		uint8 numberOfChannels = 0; // channel == color resp. alpha channel
		uint8 numberOfBytesPerPixel = 0;
		uint32 numberOfBytesPerRow = 0;
		if ((pixelFormat == kGL_RGBA) || (pixelFormat == kGL_BGRA)) {
			numberOfChannels = 4;
		} else {
			sprintf(errStr, "unknown format %d in file: %s (line: %d) [%s])", pixelFormat, __FILE__, __LINE__, __FUNCTION__);
			writeLog(errStr);
			return;
		}
		
		if ((dataType == kGL_UNSIGNED_INT_8_8_8_8_REV) || (dataType == kGL_UNSIGNED_INT_8_8_8_8) || (dataType == kGL_UNSIGNED_BYTE)) {
			numberOfBytesPerChannel = 1; // // 1 byte (== 8 bits) per color/channel
		} else {
			sprintf(errStr, "unknown type %d in file: %s (line: %d) [%s])", dataType, __FILE__, __LINE__, __FUNCTION__);
			writeLog(errStr);
			return;
		}
		
		numberOfBytesPerPixel = numberOfBytesPerChannel * numberOfChannels;
		numberOfBytesPerRow = numberOfBytesPerPixel * this->textureRect.width;
		
		// read previous pixels
		if ((pixelFormat == kGL_RGBA) || (pixelFormat == kGL_BGRA)) {
			prevPixels = (uint32*)calloc((numberOfBytesPerRow / numberOfBytesPerPixel) * this->textureRect.height, numberOfBytesPerPixel);
		}
		VisualCamera aCamera;
		aCamera.setOrthographicProjection();
		theVisualGraphics->readPixels(aCamera.getMaxLeftCoord(), aCamera.getMaxBottomCoord(), this->textureRect.width, this->textureRect.height, &prevPixels, pixelFormat, dataType, aCamera);
		
		PixelColor* pixels = NULL;
		pixels = this->createARGBImagePixels();
		if (pixels == NULL) {
			sprintf(errStr, "pixels == NULL in file: %s (line: %d) [%s])", __FILE__, __LINE__, __FUNCTION__);
			writeLog(errStr);
			return;
		}

		theVisualGraphics->drawPixels(&pixels, aCamera.getMaxLeftCoord(), aCamera.getMaxBottomCoord(), this->imageRect.width, this->imageRect.height, pixelFormat, dataType, &aConvolutionFilter);
		
		free(pixels);
		pixels = NULL;
		
		BottomLeftPositionedPixelRect clipRect;
		clipRect.bottomLeftPixel.x = 0;
		clipRect.bottomLeftPixel.y = 0;
		clipRect.pixelRect.width = this->textureRect.width;
		clipRect.pixelRect.height = this->textureRect.height;
		
		theVisualGraphics->enableTexturing(this->useRectExtension);
		theVisualGraphics->copyFramebufferToTexture(this->textureName, this->useRectExtension, clipRect, pixelFormat, dataType);
		theVisualGraphics->disableTexturing(this->useRectExtension);
		
		// restore previous pixels
		theVisualGraphics->drawPixels(&prevPixels, aCamera.getMaxLeftCoord(), aCamera.getMaxBottomCoord(), this->textureRect.width, this->textureRect.height, pixelFormat, dataType);
		
		free(prevPixels);
		
		theVisualGraphics->setColorBufferForPixelDrawingOperations(prevDrawBuffer);
		theVisualGraphics->setColorBufferForPixelReadingOperations(prevReadBuffer);
		
	} else {
		
		PixelColor* pixels = this->createARGBImagePixels();		
		PixelColor* filteredPixels = NULL;
		aConvolutionFilter.applyToPixelData(pixels, this->imageRect.width, this->imageRect.height, pixelFormat, dataType, &filteredPixels);
		free(pixels);
		pixels = NULL;
		bool success = false;
		const PixelColor* constFilteredPixels = const_cast<const PixelColor*>(filteredPixels);
//.........这里部分代码省略.........
开发者ID:LupusDei,项目名称:8LU-DSP,代码行数:101,代码来源:VisualTextureContainer.cpp


示例10: copyBitmapDataToTexture

OSStatus copyBitmapDataToTexture(UInt32 textureNumber, UInt32 width, UInt32 height, bool canUseRectExtension, UInt16 format, UInt16 dataType, UInt32** bitmapData) {
	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	return theVisualGraphics->copyARGBBitmapDataToTexture(textureNumber, width, height, canUseRectExtension, format, dataType, const_cast<const UInt32**>(bitmapData));
}
开发者ID:alexpaulzor,项目名称:projectm,代码行数:4,代码来源:VisualDispatch.cpp


示例11: sprintf

UInt32* VisualTextureContainer::getRectPixels(const UInt16 format, const UInt16 type) {

	UInt32* pixels = NULL;
	UInt32* prevPixels = NULL;

	char errStr[512];
	
	double scaleFactor = 1.0;

	UInt8 numberOfBytesPerChannel = 0;
	UInt8 numberOfChannels = 0; // channel == color resp. alpha channel
	UInt8 numberOfBytesPerPixel = 0;
	UInt32 numberOfBytesPerRow = 0;
	if ((format == kGL_RGBA) || (format == kGL_BGRA)) {
		numberOfChannels = 4;
	} else {
		sprintf(errStr, "unknown format %d in file: %s (line: %d) [%s])", format, __FILE__, __LINE__, __FUNCTION__);
		writeLog(errStr);
		return pixels;
	}
	
	if ((type == kGL_UNSIGNED_INT_8_8_8_8_REV) || (type == kGL_UNSIGNED_INT_8_8_8_8) || (type == kGL_UNSIGNED_BYTE)) {
		numberOfBytesPerChannel = 1; // // 1 byte (== 8 bits) per color/channel
	} else {
		sprintf(errStr, "unknown type %d in file: %s (line: %d) [%s])", type, __FILE__, __LINE__, __FUNCTION__);
		writeLog(errStr);
		return pixels;
	}
	
	numberOfBytesPerPixel = numberOfBytesPerChannel * numberOfChannels;
	numberOfBytesPerRow = numberOfBytesPerPixel * this->textureWidth;

	VisualStageBox stageBox;

	VisualStagePosition position;
	position.horizontalAlignment = kLeftAligned;
	position.verticalAlignment = kBottomAligned;
	stageBox.setVisualStagePosition(position);

	stageBox.setContentPixelWidth(this->getImageWidth());
	stageBox.setContentPixelHeight(this->getImageHeight());

	VertexChain aVertexChain;
	Vertex* topLeftFrontVertex = new Vertex;
	topLeftFrontVertex->vertexPosition.xPos = stageBox.getLeftCoord() * scaleFactor;
	topLeftFrontVertex->vertexPosition.yPos = stageBox.getTopCoord() * scaleFactor;
	topLeftFrontVertex->vertexPosition.zPos = stageBox.getFrontPosition();
	topLeftFrontVertex->vertexColor.r = 1.0f;
	topLeftFrontVertex->vertexColor.g = 1.0f;
	topLeftFrontVertex->vertexColor.b = 1.0f;
	topLeftFrontVertex->vertexColor.a = 1.0f;
	topLeftFrontVertex->texCoordPosition.sPos = 0.0f;
	topLeftFrontVertex->texCoordPosition.tPos = this->getTextureLogicalHeight();
	aVertexChain.push_back(topLeftFrontVertex);

	Vertex* bottomLeftFrontVertex = new Vertex;
	bottomLeftFrontVertex->vertexPosition.xPos = stageBox.getLeftCoord() * scaleFactor;
	bottomLeftFrontVertex->vertexPosition.yPos = stageBox.getBottomCoord() * scaleFactor;
	bottomLeftFrontVertex->vertexPosition.zPos = stageBox.getFrontPosition();
	bottomLeftFrontVertex->vertexColor.r = 1.0f;
	bottomLeftFrontVertex->vertexColor.g = 1.0f;
	bottomLeftFrontVertex->vertexColor.b = 1.0f;
	bottomLeftFrontVertex->vertexColor.a = 1.0f;
	bottomLeftFrontVertex->texCoordPosition.sPos = 0.0f;
	bottomLeftFrontVertex->texCoordPosition.tPos = 0.0f;
	aVertexChain.push_back(bottomLeftFrontVertex);

	Vertex* bottomRightFrontVertex = new Vertex;
	bottomRightFrontVertex->vertexPosition.xPos = stageBox.getRightCoord() * scaleFactor;
	bottomRightFrontVertex->vertexPosition.yPos = stageBox.getBottomCoord() * scaleFactor;
	bottomRightFrontVertex->vertexPosition.zPos = stageBox.getFrontPosition();
	bottomRightFrontVertex->vertexColor.r = 1.0f;
	bottomRightFrontVertex->vertexColor.g = 1.0f;
	bottomRightFrontVertex->vertexColor.b = 1.0f;
	bottomRightFrontVertex->vertexColor.a = 1.0f;
	bottomRightFrontVertex->texCoordPosition.sPos = this->getTextureLogicalWidth();
	bottomRightFrontVertex->texCoordPosition.tPos = 0.0f;
	aVertexChain.push_back(bottomRightFrontVertex);

	Vertex* topRightFrontVertex = new Vertex;
	topRightFrontVertex->vertexPosition.xPos = stageBox.getRightCoord() * scaleFactor;
	topRightFrontVertex->vertexPosition.yPos = stageBox.getTopCoord() * scaleFactor;
	topRightFrontVertex->vertexPosition.zPos = stageBox.getFrontPosition();
	topRightFrontVertex->vertexColor.r = 1.0f;
	topRightFrontVertex->vertexColor.g = 1.0f;
	topRightFrontVertex->vertexColor.b = 1.0f;
	topRightFrontVertex->vertexColor.a = 1.0f;
	topRightFrontVertex->texCoordPosition.sPos = this->getTextureLogicalWidth();
	topRightFrontVertex->texCoordPosition.tPos = this->getTextureLogicalHeight();
	aVertexChain.push_back(topRightFrontVertex);

	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	
	// read previous pixels
	if ((format == kGL_RGBA) || (format == kGL_BGRA)) {
		prevPixels = (UInt32*)calloc((numberOfBytesPerRow / numberOfBytesPerPixel) * this->textureHeight, numberOfBytesPerPixel);
	}
	theVisualGraphics->readPixels(stageBox.getLeftCoord(), stageBox.getBottomCoord(), this->textureWidth, this->textureHeight, &prevPixels, format, type);

	// draw current texture
//.........这里部分代码省略.........
开发者ID:alexpaulzor,项目名称:projectm,代码行数:101,代码来源:VisualTextureContainer.cpp


示例12: createCheckPixels

UInt32* createCheckPixels(UInt32 width, UInt32 height) {
	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	return theVisualGraphics->createARGBCheckPixels(width, height);
}
开发者ID:alexpaulzor,项目名称:projectm,代码行数:4,代码来源:VisualDispatch.cpp


示例13: initWithFramebuffer

bool VisualTextureContainer::initWithFramebuffer(const BottomLeftPositionedPixelRect& clipRect) {
	
	bool success = true;

	uint16 dataType;
	uint16 pixelFormat = kGL_BGRA;
	// BGRA on intel machines and ARGB on ppc
#if TARGET_OS_WIN
	dataType = kGL_UNSIGNED_BYTE;
#else
#if __BIG_ENDIAN__
	dataType = kGL_UNSIGNED_INT_8_8_8_8_REV;
#else
	dataType = kGL_UNSIGNED_INT_8_8_8_8;
#endif
#endif
	
	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	
	this->releaseTextureData();
	
	this->textureName = theVisualGraphics->getNextFreeTextureName();
	this->aTextureIsSet = true;
	VisualTextureContainer::textureRefCountMap[this->textureName] = 1;
	this->useRectExtension = theVisualGraphics->canUseTextureRectExtension();
	
	int prevReadBuffer = theVisualGraphics->getCurrentColorBufferForPixelReadingOperations();
	theVisualGraphics->setColorBufferForPixelReadingOperations(kGL_BACK_COLOR_BUFFER);
	
	int prevDrawBuffer = theVisualGraphics->getCurrentColorBufferForPixelDrawingOperations();
	theVisualGraphics->setColorBufferForPixelDrawingOperations(kGL_BACK_COLOR_BUFFER);
	
	theVisualGraphics->enableTexturing(this->useRectExtension);
	theVisualGraphics->copyFramebufferToTexture(this->textureName, this->useRectExtension, clipRect, pixelFormat, dataType);
	theVisualGraphics->disableTexturing(this->useRectExtension);
	
	theVisualGraphics->setColorBufferForPixelDrawingOperations(prevDrawBuffer);
	theVisualGraphics->setColorBufferForPixelReadingOperations(prevReadBuffer);
	
	this->imageRect.width = clipRect.pixelRect.width;
	this->imageRect.height = clipRect.pixelRect.height;
	
	this->useRectExtension = theVisualGraphics->canUseTextureRectExtension();
	if (this->useRectExtension == false) {
		this->textureRect.width = theVisualGraphics->power2Ceiling(this->imageRect.width);
		this->textureRect.height = theVisualGraphics->power2Ceiling(this->imageRect.height);
	} else {
		this->textureRect.width = this->imageRect.width;
		this->textureRect.height = this->imageRect.height;
	}
	
	return success;
}
开发者ID:LupusDei,项目名称:8LU-DSP,代码行数:53,代码来源:VisualTextureContainer.cpp


示例14: CFStringCreateWithCString

void OptionsDialog::show() {
	int aLastTabIndex;
	OSStatus err;

	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	theVisualGraphics->evaluateFullscreenDisplayResolution();
	
	aLastTabIndex = VisualDataStore::getPreferenceValueInt(VisualConfiguration::kPreferencePane);
	if (aLastTabIndex == 0) {
		aLastTabIndex = 1;
	}

	if (theOptionsDialog->optionsDialogWindow == NULL) {
	
		// find the bundle to load the nib inside of it
		IBNibRef nibRef;
		CFStringRef pluginName;
		pluginName = CFStringCreateWithCString(kCFAllocatorDefault, VisualConfiguration::kVisualPluginDomainIdentifier, kCFStringEncodingWindowsLatin1);
		CFBundleRef thePlugin = CFBundleGetBundleWithIdentifier(pluginName);
		err = CreateNibReferenceWithCFBundle(thePlugin, CFSTR("VisualOptions"), &nibRef);
		if (err != noErr) {
			writeLog("CreateNibReferenceWithCFBundle failed in OptionsDialog->show");
			return;
		}
		CreateWindowFromNib(nibRef, CFSTR("OptionsDialog"), &(theOptionsDialog->optionsDialogWindow));
		if (err != noErr) {
			writeLog("CreateWindowFromNib failed in OptionsDialog->show");
			return;
		}
		DisposeNibReference(nibRef);
		CFRelease(pluginName);
		
		// tab control
		GetControlByID(theOptionsDialog->optionsDialogWindow, &theOptionsDialog->tabControlID, &theOptionsDialog->tabControl);

		// display resolution menu pop up control
		err = GetControlByID(theOptionsDialog->optionsDialogWindow, &theOptionsDialog->displayResolutionMenuControlID, &(theOptionsDialog->displayResolutionPopUpControl));
		if (err != noErr) {
			writeLog("GetControlByID failed in OptionsDialog->show");
			return;
		}

		UInt32 count;
		MenuAttributes displayResolutionMenuAttributes = (MenuAttributes)NULL;
		err = CreateNewMenu(131, displayResolutionMenuAttributes, &(theOptionsDialog->displayResolutionMenu));
		if (err != noErr) {
			writeLog("CreateNewMenu failed in OptionsDialog->show");
			return;
		}

		CFStringRef displayResolutionShowStr;
		count = 0;
		char str[32];
		UInt8 isSelected = 0;
		
		while(theVisualGraphics->getNextAvailableDisplayResolution(str, &isSelected)) {
			displayResolutionShowStr = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%s"), str);
			err = AppendMenuItemTextWithCFString(theOptionsDialog->displayResolutionMenu, displayResolutionShowStr, 0, 0, NULL);
			if (err != noErr) {
				writeLog("Error while appending menu item");
			}
			count++;
			if (isSelected == 1) {
				theOptionsDialog->displayResolutionMenuSelectedIdx = count;
			}
			CFRelease(displayResolutionShowStr);
		}
		SetControlPopupMenuHandle(theOptionsDialog->displayResolutionPopUpControl, theOptionsDialog->displayResolutionMenu);
		SetControl32BitMaximum(theOptionsDialog->displayResolutionPopUpControl, count);
		
		InstallWindowEventHandler(theOptionsDialog->optionsDialogWindow, NewEventHandlerUPP(optionsDialogWindowHandler), 1, &windowCloseEvent, NULL, NULL);
		InstallWindowEventHandler(theOptionsDialog->optionsDialogWindow, NewEventHandlerUPP(optionsDialogControlHandler), 1, &controlHitEvent, NULL, NULL);
		
	}
	
	if (theOptionsDialog->displayResolutionMenuSelectedIdx == -1) {
		theOptionsDialog->displayResolutionMenuSelectedIdx = 1; // first menuItem is default
	}
	SetControl32BitValue(theOptionsDialog->displayResolutionPopUpControl, theOptionsDialog->displayResolutionMenuSelectedIdx);
	
	SetControl32BitValue(theOptionsDialog->tabControl, aLastTabIndex);
	theOptionsDialog->showSelectedPaneOfTabControl();
	
	ShowWindow(theOptionsDialog->optionsDialogWindow);
	SelectWindow(theOptionsDialog->optionsDialogWindow);

}
开发者ID:alexpaulzor,项目名称:projectm,代码行数:87,代码来源:OptionsDialog.cpp


示例15: switch

bool VisualTextureContainer::initWithStyledString(VisualStyledString& styledString) {
	
	this->releaseTextureData();
	
    bool success = true;
	
	const VisualString* aVisualString = &(styledString);
	VisualStringStyle& stringStyle = styledString.getStyle();
	if (aVisualString->getNumberOfCharacters() == 0) {
		return false;
	}
	
	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	uint32 maxPixelWidth = theVisualGraphics->getCanvasPixelWidth();
	uint32 maxPixelHeight = theVisualGraphics->getCanvasPixelHeight();
	
	this->textureName = theVisualGraphics->getNextFreeTextureName();
	this->aTextureIsSet = true;
	VisualTextureContainer::textureRefCountMap[this->textureName] = 1;
	this->useRectExtension = theVisualGraphics->canUseTextureRectExtension();
	
#if TARGET_OS_MAC
	char alignmentStr[32];	
	switch (stringStyle.horizontalAlignment) {
		case (kLeftAligned):
			strcpy(alignmentStr, "left");
			break;
		case(kCenterAligned):
			strcpy(alignmentStr, "center");
			break;
		case(kRightAligned):
			strcpy(alignmentStr, "right");
			break;
		default:
			break;
	}
	
	success = getDimensionsOfCocoaStringBitmap((void*)aVisualString, (void*)&stringStyle, &(this->imageRect.width), &(this->imageRect.height), maxPixelWidth, maxPixelHeight, alignmentStr);
	if (!success) {
		return success;
	}
	
	if (this->useRectExtension == false) {
		this->textureRect.width = theVisualGraphics->power2Ceiling(this->imageRect.width);
		this->textureRect.height = theVisualGraphics->power2Ceiling(this->imageRect.height);
	} else {
		this->textureRect.width = this->imageRect.width;
		this->textureRect.height = this->imageRect.height;
	}
	
	PixelColor* pixelBuffer = (uint32*)calloc(this->textureRect.width * this->textureRect.height, sizeof(uint32));
	
	success = getCocoaStringBitmapData((void*)&styledString, this->textureRect.width, this->textureRect.height, alignmentStr, &(pixelBuffer));
	
	success = theVisualGraphics->copyARGBBitmapDataToTexture(this->textureName, this->textureRect.width, this->textureRect.height, this->useRectExtension, const_cast<const uint32**>(&(pixelBuffer)));
	
#endif
	
#if TARGET_OS_WIN
	
	wchar_t* stringValueRef = (wchar_t*)(styledString.getCharactersPointer());
	uint8 red = (uint8)(stringStyle.fontColor.r * 255.0f);
	uint8 green = (uint8)(stringStyle.fontColor.g * 255.0f);
	uint8 blue = (uint8)(stringStyle.fontColor.b * 255.0f);

	if (!stringValueRef) {
		success = false;
		return success;
	}
	
	success = theVisualGraphics->makeTextureOfStringWin(stringValueRef, styledString.getNumberOfCharacters(), this->textureName, this->textureRect.width, this->textureRect.height, this->imageRect.width, this->imageRect.height, stringStyle.fontNameStr, (uint16)stringStyle.fontSize, red, green, blue, stringStyle.horizontalAlignment, maxPixelWidth, maxPixelHeight);
	
#endif
	
	if (this->useRectExtension == false) {
		this->logicalSize.width = (double)this->imageRect.width / (double)this->textureRect.width;
		this->logicalSize.height = (double)this->imageRect.height / (double)this->textureRect.height;
	} else {
		this->logicalSize.width = (double)this->textureRect.width;
		this->logicalSize.height = (double)this->textureRect.height;
	}
	
	return success;
}
开发者ID:LupusDei,项目名称:8LU-DSP,代码行数:84,代码来源:VisualTextureContainer.cpp


示例16: memcpy

bool VisualTextureContainer::initWithEncodedData(const char* const bufferData, size_t size) {
	
	bool success = true;
	bool debug = false;
	
	this->releaseTextureData();
	
	uint32* aPixelBuffer = NULL;
	
#if TARGET_OS_WIN
	
	HGLOBAL hGlobal = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_NODISCARD, (SIZE_T)size);
	if (!hGlobal)
		return false;
	
	BYTE* pDest = (BYTE*)::GlobalLock(hGlobal);
	
	memcpy(pDest, bufferData, size);
	
	::GlobalUnlock(hGlobal);
	
	IStream* pStream = NULL;
	if (::CreateStreamOnHGlobal(hGlobal, FALSE, &pStream) != S_OK)
		return false;
	
	Gdiplus::Bitmap* bitmap = Gdiplus::Bitmap::FromStream(pStream);
	bitmap->RotateFlip(Gdiplus::RotateNoneFlipY);
	
	this->imageRect.width = bitmap->GetWidth();
	this->imageRect.height = bitmap->GetHeight();
	
	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	this->useRectExtension = theVisualGraphics->canUseTextureRectExtension();
	if (this->useRectExtension == false) {
		this->textureRect.width = theVisualGraphics->power2Ceiling(this->imageRect.width);
		this->textureRect.height = theVisualGraphics->power2Ceiling(this->imageRect.height);
	} else {
		this->textureRect.width = this->imageRect.width;
		this->textureRect.height = this->imageRect.height;
	}
	
	aPixelBuffer = (uint32*)malloc(this->imageRect.width * this->imageRect.height * sizeof(uint32));
	Gdiplus::Rect rect(0, 0, this->imageRect.width, this->imageRect.height);
	Gdiplus::BitmapData* bitmapData = new Gdiplus::BitmapData;
	
	bitmapData->Width = this->imageRect.width;
	bitmapData->Height = this->imageRect.height;
	bitmapData->Stride = sizeof(uint32) * bitmapData->Width;
	bitmapData->PixelFormat = PixelFormat32bppARGB;
	bitmapData->Scan0 = (VOID*)aPixelBuffer;
	
	Gdiplus::Status status = Gdiplus::Ok;
	status = bitmap->LockBits(&rect, Gdiplus::ImageLockModeRead | Gdiplus::ImageLockModeUserInputBuf, PixelFormat32bppPARGB, bitmapData);
	
#endif
	
#if TARGET_OS_MAC
	
	CFDataRef dataRef = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, (UInt8*)bufferData, (CFIndex)size, kCFAllocatorDefault);
	
	CFDictionaryRef options = NULL;
	CGImageSourceRef imageSourceRef = CGImageSourceCreateWithData(dataRef, options);
	
	CGImageRef imageRef = CGImageSourceCreateImageAtIndex(imageSourceRef, 0, options);
	
	this->imageRect.width = CGImageGetWidth(imageRef);
	this->imageRect.height = CGImageGetHeight(imageRef);
	
	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	this->useRectExtension = theVisualGraphics->canUseTextureRectExtension();
	if (this->useRectExtension == false) {
		this->textureRect.width = theVisualGraphics->power2Ceiling(this->imageRect.width);
		this->textureRect.height = theVisualGraphics->power2Ceiling(this->imageRect.height);
	} else {
		this->textureRect.width = this->imageRect.width;
		this->textureRect.height = this->imageRect.height;
	}
	
	CGContextRef contextPtr = theVisualGraphics->createBitmapContext(this->imageRect.width, this->imageRect.height);
	
	CGContextTranslateCTM(contextPtr, 0, this->imageRect.height);
	CGContextScaleCTM(contextPtr, 1.0f, -1.0f);
	
	CGRect rect = CGRectMake(0, 0, this->imageRect.width, this->imageRect.height);
	CGContextDrawImage(contextPtr, rect, imageRef);
	
	aPixelBuffer = static_cast<uint32*>(CGBitmapContextGetData(contextPtr));
#endif
	
	PixelColor* interleavedARGBColorPixelBuffer = NULL;
	
	if (debug == true) {
		interleavedARGBColorPixelBuffer = VisualColorTools::createARGBCheckPixels(this->textureRect.width, this->textureRect.height);
	} else {
		interleavedARGBColorPixelBuffer = static_cast<PixelColor*>(aPixelBuffer);
	}
	success = this->initWithARGBPixelData(interleavedARGBColorPixelBuffer, this->imageRect.width, this->imageRect.height);
	
#if TARGET_OS_MAC
	CGContextRelease(contextPtr);
//.........这里部分代码省略.........
开发者ID:LupusDei,项目名称:8LU-DSP,代码行数:101,代码来源:VisualTextureContainer.cpp


示例17: initWithFramebuffer

OSStatus VisualTextureContainer::initWithFramebuffer(UInt32 xPos, UInt32 yPos, UInt32 width, UInt32 height) {
	
	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();

	this->releaseTextureData();

	this->textureName = theVisualGraphics->getNextFreeTextureName();
	this->textureIsSet = true;
	VisualTextureContainer::textureRefCountMap[this->textureName] = 1;
	this->useRectExtension = theVisualGraphics->canUseTextureRectExtension();

	int prevReadBuffer = theVisualGraphics->getCurrentColorBufferForPixelReadingOperations();
	theVisualGraphics->setColorBufferForPixelReadingOperations(kGL_BACK_COLOR_BUFFER);

	int prevDrawBuffer = theVisualGraphics->getCurrentColorBufferForPixelDrawingOperations();
	theVisualGraphics->setColorBufferForPixelDrawingOperations(kGL_BACK_COLOR_BUFFER);

	theVisualGraphics->enableTexturing(this->useRectExtension);
	theVisualGraphics->copyFramebufferToTexture(this->textureName, this->useRectExtension, xPos, yPos, width, height, this->pixelFormat, this->dataType);
	theVisualGraphics->disableTexturing(this->useRectExtension);

	theVisualGraphics->setColorBufferForPixelDrawingOperations(prevDrawBuffer);
	theVisualGraphics->setColorBufferForPixelReadingOperations(prevReadBuffer);


	return noErr;
}
开发者ID:alexpaulzor,项目名称:projectm,代码行数:27,代码来源:VisualTextureContainer.cpp


示例18: monitorRenderMessageProcess

void monitorRenderMessageProcess() {
	
	static float framesPerSecond = 0.0f;
	static uint16 frameCount = 0;
	uint32 elapsedMilliseconds = 0;
	uint32 remainingMilliseconds = 0;
	VisualPlayerState* theVisualPlayerState = NULL;
	VisualGraphics* theVisualGraphics = NULL;
	uint8 playState;
	char cStr64[64];
	
	theVisualPlayerState = VisualPlayerState::getInstance();
	
    elapsedMilliseconds = VisualTiming::getElapsedMilliSecsSinceReset("fps");
    
    if (elapsedMilliseconds > 1000) {
        framesPerSecond = (float)frameCount / (float)elapsedMilliseconds * 1000.0f;
        frameCount = 0;
        VisualTiming::resetTimestamp("fps");
    }
	frameCount++;
    
    sprintf(cStr64, "%.2f",  framesPerSecond);
    setProcessInfo("FramesPerSecond", cStr64);
	
	theVisualGraphics = VisualGraphics::getInstance();
	
	setProcessInfo("RendererName",theVisualGraphics->getRendererName());
	
	setProcessInfo("RendererVendor",theVisualGraphics->getRendererVendor());
	
	setProcessInfo("RendererVersion",theVisualGraphics->getRendererVersion());
	
	sprintf(cStr64, "%#x", theVisualGraphics->getGLVersion());
	setProcessInfo("GLVersion", cStr64);
	
	sprintf(cStr64, "%ld", theVisualGraphics->getMaxTextureSize());
	setProcessInfo("Maximum Texture Size", cStr64);
	
	// screen measurements
	PixelRect screenRect = theVisualGraphics->getScreenRect();
	sprintf(cStr64, "width: %d, height: %d, refreshRate: %d", screenRect.width, screenRect.height, theVisualGraphics->getRefreshRateOfScreen());
	setProcessInfo("Screen", cStr64);
	
	sprintf(cStr64, "%d", theVisualGraphics->getBitsPerPixelOfScreen());
	setProcessInfo("BitsPerPixel", cStr64);
	
	sprintf(cStr64, "%d", theVisualGraphics->getCanvasPixelHeight());
	setProcessInfo("CanvasPixelHeight", cStr64);
	
	sprintf(cStr64, "%d", theVisualGraphics->getCanvasPixelWidth());
	setProcessInfo("CanvasPixelWidth", cStr64);
	
	BottomLeftPositionedPixelRect theCanvasRect;
	theCanvasRect = theVisualGraphics->getCanvasRect();
	sprintf(cStr64, "bottom: %d, left: %d", theCanvasRect.bottomLeftPixel.y, theCanvasRect.bottomLeftPixel.x);
	setProcessInfo("CanvasRectTopLeft", cStr64);
	sprintf(cStr64, "width: %d, height: %d", theCanvasRect.pixelRect.width, theCanvasRect.pixelRect.height);
	setProcessInfo("CanvasRectWidthHeight", cStr64);
	
	/*
	 sprintf(cStr64, "top: %.2f, left: %.2f", theVisualGraphics->getMaxTopCoordOfCanvas(), theVisualGraphics->getMaxLeftCoordOfCanvas());
	 setProcessInfo("CoordMaxTopLeft", cStr64);
	 sprintf(cStr64, "bottom: %.2f, right: %.2f", theVisualGraphics->getMaxBottomCoordOfCanvas(), theVisualGraphics->getMaxRightCoordOfCanvas());
	 setProcessInfo("CoordMaxBottomRight", cStr64);
	 sprintf(cStr64, "near: %.2f, far: %.2f", theVisualGraphics->getMaxNearCoordOfCanvas(), theVisualGraphics->getMaxFarCoordOfCanvas());
	 setProcessInfo("CoordMaxNearFar", cStr64);
	 */
	
	BottomLeftPositionedPixelRect bottomLeftPositionedPixelRect = theVisualGraphics->getViewportRect();
	sprintf(cStr64, "bottom: %d, left: %d, width: %d, height: %d",  bottomLeftPositionedPixelRect.bottomLeftPixel.y, bottomLeftPositionedPixelRect.bottomLeftPixel.x, bottomLeftPositionedPixelRect.pixelRect.width, bottomLeftPositionedPixelRect.pixelRect.height);
	setProcessInfo("ViewportRect", cStr64);
	
	playState = theVisualPlayerState->getAudioPlayState();
	switch (playState) {
		case kAudioIsPlaying:
			sprintf(cStr64, "kAudioIsPlaying");
			break;
		case kAudioPlayStarted:
			sprintf(cStr64, "kAudioPlayStarted");
			break;		
		case kAudioPlayResumed:
			sprintf(cStr64, "kAudioPlayResumed");
			break;
		case kAudioPlayPaused:
			sprintf(cStr64, "kAudioPlayPaused");
			break;
		case kAudioIsNotPlaying:
			sprintf(cStr64, "kAudioIsNotPlaying");
			break;
		default:
			sprintf(cStr64, "unknown");
	}
	setProcessInfo("AudioPlayState", cStr64);
	
	elapsedMilliseconds = theVisualPlayerState->getElapsedAudioTime();
	sprintf(cStr64, "%d", elapsedMilliseconds);
	setProcessInfo("TrackTimeElapsed", cStr64);
	
	remainingMilliseconds = theVisualPlayerState->getRemainingAudioTime();
//.........这里部分代码省略.........
开发者ID:LupusDei,项目名称:8LU-DSP,代码行数:101,代码来源:VisualDispatch.cpp


示例19: draw

void VisualImage::draw(const VertexChain* const aVertexChain, bool debug) {
	VisualGraphics* theVisualGraphics = VisualGraphics::getInstance();
	theVisualGraphics->drawTexture(this->visualTextureContainer->getTextureName(), aVertexChain, this->visualTextureContainer->getUseRectExtension(), this->blendMode, debug);
}
开发者ID:LupusDei,项目名称:8LU-DSP,代码行数:4,代码来源:VisualImage.cpp


示例20: GetEventClass

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VisualLeakDetector类代码示例发布时间:2022-05-31
下一篇:
C++ VisualEffectInstance类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap