Пример #1
0
CzTexture CzPlatformImaging::CreateTexture(void* pixels, int width, int height, int pitch, CzImage::eFormat format, bool modifiable)
{
	if (pixels == NULL || width <= 0 || height <= 0)
		return false;

	CIwImage::Format f = toMarmImageFormat(format);
	if (f == CIwImage::FORMAT_UNDEFINED)
		return NULL;

	CIwTexture* texture = new CIwTexture();
	texture->_SetFlags( CIwTexture::NO_CHROMA_KEY_F );
	texture->SetMipMapping(false);
	texture->SetModifiable(modifiable);
	texture->CopyFromBuffer(width, height, f, pitch, (uint8*)pixels, NULL);

	return (CzTexture)texture;
}
Пример #2
0
CzTexture CzPlatformImaging::CreateTexture(CzTexture source, CzImage::eFormat format)
{
	CIwImage::Format f = toMarmImageFormat(format);
	if (f == CIwImage::FORMAT_UNDEFINED)
		return NULL;
	CIwTexture* t = static_cast<CIwTexture*>(source);

	CIwImage* image = new CIwImage();
	image->SetFormat(f);
	image->SetWidth(t->GetWidth());
	image->SetHeight(t->GetHeight());
	t->GetImage().ConvertToImage(image);

	CIwTexture* texture = new CIwTexture();
	texture->_SetFlags( CIwTexture::NO_CHROMA_KEY_F );
	texture->SetMipMapping(t->GetMipMapping());
	texture->SetFiltering(t->GetFiltering());
	texture->SetModifiable(t->GetModifiable());
	texture->CopyFromImage(image);

	delete image;

	return (CzTexture)texture;
}