CImagePtr CopyImage(const CImagePtr &image_ptr)
	{
		nstring name("copy_");
		name.append(image_ptr->GetResName());

		CImagePtr image = CImageManager::GetSingelton().CreateNewImage(name, nstring("manual"),
			image_ptr->GetBits(), image_ptr->GetWidth(), image_ptr->GetHeight(), 
			image_ptr->GetDepth(), image_ptr->GetPixelFormat());

		return image;
	}
示例#2
0
void CTexture::AddSubTexture(CImagePtr & image, nova::nUInt32 level, nInt32 face,
	nova::nUInt32 xoff, nova::nUInt32 yoff, nova::nUInt32 zoff)
{
	if(!isReady)
		throw NOVA_EXP("CTexture::CreateTexture - resource not created!", BAD_OPERATION);

	CTextureSurfaceListPtr plane = GetSurfaceList(face);
	CHardwarePixelBufferPtr surface = plane->GetSurface(level);

	CMemoryBuffer lock = surface->Lock(xoff, yoff, zoff,
		image->GetWidth(), image->GetHeight(), image->GetDepth(), HWB_DYNAMIC);

	image->GetBits().CopyTo(lock, image->GetBits().GetBufferSize(), 0);
	surface->Unlock(lock);


	for(nova::nUInt32 i = 0; i < GetListenersCount(); i++)
	{
		CTextureListener * lis =
			dynamic_cast<CTextureListener *>(GetListener(i));
		lis->AddSubTextureListener(this);
	}
}