Cinder  0.9.1
Classes | Typedefs | Functions
cinder::msw Namespace Reference

Classes

class  basic_debugbuf
 
class  basic_dostream
 
struct  ComDeleter
 
class  ComIStream
 
class  ComOStream
 

Typedefs

template<typename T >
using ManagedComRef = std::shared_ptr< T >
 
template<typename T >
using ManagedComPtr = std::unique_ptr< T, ComDeleter >
 
typedef basic_dostream< char > dostream
 
typedef basic_dostream< wchar_t > wdostream
 

Functions

Surface8uRef convertHBitmap (HBITMAP hbitmap)
 
std::wstring toWideString (const std::string &utf8String)
 
std::string toUtf8String (const std::wstring &wideString)
 
vec2 toVec2 (const ::POINTFX &p)
 
void ComDelete (void *p)
 
template<typename T >
ManagedComRef< T > makeComShared (T *p)
 
template<typename T >
ManagedComPtr< T > makeComUnique (T *p)
 
void initializeCom (DWORD params=COINIT_APARTMENTTHREADED|COINIT_DISABLE_OLE1DDE)
 
Surface8u convertGdiplusBitmap (Gdiplus::Bitmap &bitmap)
 
Gdiplus::PixelFormat surfaceChannelOrderToGdiplusPixelFormat (const SurfaceChannelOrder &sco, bool premultiplied)
 
void gdiplusPixelFormatToSurfaceChannelOrder (Gdiplus::PixelFormat format, SurfaceChannelOrder *resultChannelOrder, bool *resultPremultiplied)
 
Gdiplus::Bitmap * createGdiplusBitmap (const Surface8u &surface)
 
 __declspec (thread) ComInitializer *threadComInitializer
 

Typedef Documentation

template<typename T >
using cinder::msw::ManagedComRef = typedef std::shared_ptr<T>
template<typename T >
using cinder::msw::ManagedComPtr = typedef std::unique_ptr<T, ComDeleter>

Function Documentation

Surface8uRef cinder::msw::convertHBitmap ( HBITMAP  hbitmap)

Converts a Win32 HBITMAP to a cinder::Surface8u

Note
Currently always copies the alpha channel
std::wstring cinder::msw::toWideString ( const std::string &  utf8String)

Converts a UTF-8 string into a wide string (wstring). Note that wstring is not a good cross-platform choice and this is here for interop with Windows APIs.

std::string cinder::msw::toUtf8String ( const std::wstring &  wideString)

Converts a wide string to a UTF-8 string. Note that wstring is not a good cross-platform choice and this is here for interop with Windows APIs.

vec2 cinder::msw::toVec2 ( const ::POINTFX &  p)

Converts a Win32 POINTFX fixed point point to a cinder::vec2.

void cinder::msw::ComDelete ( void *  p)

A free function designed to interact with makeComShared, calls Release() on a com-managed object.

template<typename T >
ManagedComRef<T> cinder::msw::makeComShared ( T *  p)

Creates a shared_ptr whose deleter will properly decrement the reference count of a COM object.

template<typename T >
ManagedComPtr<T> cinder::msw::makeComUnique ( T *  p)

Creates a unique_ptr whose deleter will properly decrement the reference count of a COM object.

void cinder::msw::initializeCom ( DWORD  params = COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)

Initializes COM on this thread. Uses thread local storage to prevent multiple initializations per thread.

Surface8u cinder::msw::convertGdiplusBitmap ( Gdiplus::Bitmap &  bitmap)

Copies the contents of a Gdiplus::Bitmap to a new Surface8u.

Gdiplus::PixelFormat cinder::msw::surfaceChannelOrderToGdiplusPixelFormat ( const SurfaceChannelOrder sco,
bool  premultiplied 
)

Translates a cinder::SurfaceChannelOrder into a Gdiplus::PixelFormat. Supports BGR, BGRX, BGRA. Returns PixelFormatUndefined on failure

void cinder::msw::gdiplusPixelFormatToSurfaceChannelOrder ( Gdiplus::PixelFormat  format,
SurfaceChannelOrder resultChannelOrder,
bool *  resultPremultiplied 
)

Translates a Gdiplus::PixelFormat format to a a SurfaceChannelOrder. Sets resultPremultiplied based on whether format is premultiplied.

Gdiplus::Bitmap * cinder::msw::createGdiplusBitmap ( const Surface8u surface)

Creates a Gdiplus::Bitmap which wraps a Surface8u. Requires surface to confrom to SurfaceConstraintsGdiPlus and throw SurfaceConstraintsExc if it does not. Caller is responsible for deleting the result.

cinder::msw::__declspec ( thread  )