Skip to content
Vinjn Zhang edited this page May 12, 2013 · 1 revision

load jpg from memory#

unsigned char* image_data;

// fill up array here

Buffer buffer( image_data, length );
mLivePixels = Surface( loadImage( DataSourceBuffer::create(buffer), ImageSource::Options(), "jpg" ) );

makeComShared

//! A free function designed to interact with makeComShared
void ComDelete( void *p )
{
	if( p ) {
		IUnknown *unknown = reinterpret_cast<IUnknown*>( p );
		unknown->Release();
	}
}

//! Creates a shared_ptr whose deleter will properly decrement the reference count of a COM object
template<typename T>
inline std::shared_ptr<T> makeComShared( T *p )
{ return std::shared_ptr<T>( p, &ComDelete ); }

CATCH_EXCEPTION

#define CATCH_EXCEPTION( ExceptionType ) \
	catch ( ExceptionType& e ){\
	console() << #ExceptionType << e.what() << std::endl;}

// Usage
try
{
	audio::SourceRef src = audio::load( loadAsset( filename ) );
}
CATCH_EXCEPTION( AssetLoadExc )
CATCH_EXCEPTION( audio::IoException )

QuickTime

http://www.filibeto.org/unix/macos/lib/dev/documentation/QuickTime/Conceptual/QT7-1_Update_Guide/QT7-1_Update_Guide.pdf
QTDirect3DTextureContextCreate
QuickTime sucks in Windows, don't use it!!
Clone this wiki locally