# Cinder

# cinder::msw Namespace Reference

## Classes
class | ComOStream
| Wraps a cinder::OStream with a COM IStream. More...
class | basic_debugbuf
class | basic_dostream
## Typedefs
typedef basic_dostream< char > | dostream
typedef basic_dostream< wchar_t > | wdostream
## Functions
Surface8u | convertHBitmap (HBITMAP hbitmap)
Vec2f | toVec2f (const ::POINTFX &p)
| Converts a Win32 POINTFX fixed point point to a cinder::Vec2f.
void | ComDelete (void *p)
| A free function designed to interact with makeComShared.
template<typename T >
shared_ptr< T > | makeComShared (T *p)
| Creates a shared_ptr whose deleter will properly decrement the reference count of a COM object.
void | initializeCom (DWORD params=COINIT_APARTMENTTHREADED|COINIT_DISABLE_OLE1DDE)
| Initializes COM on this thread. Uses Boost's thread local storage to prevent multiple initializations per thread.
Surface8u | convertGdiplusBitmap (Gdiplus::Bitmap &bitmap, bool premultiplied)
Gdiplus::PixelFormat | surfaceChannelOrderToGdiplusPixelFormat (const SurfaceChannelOrder &sco, bool premultiplied)
| Translates a cinder::SurfaceChannelOrder into a Gdiplus::PixelFormat Supports BGR, BGRX, BGRA. Returns PixelFormatUndefined on failure.
Gdiplus::Bitmap * | createGdiplusBitmap (const Surface8u &surface, bool premultiplied)
## Variables
boost::thread_specific_ptr < ComInitializer > | threadComInitializer

## Typedef Documentation

typedef basic_dostream<char> cinder::msw::dostream

typedef basic_dostream<wchar_t> cinder::msw::wdostream

## Function Documentation

Surface8u cinder::msw::convertHBitmap | ( | HBITMAP | hbitmap | ) |

Converts a Win32 HBITMAP to a cinder::Surface8u

Note:
  Currently always copies the alpha channel

Vec2f cinder::msw::toVec2f | ( | const ::POINTFX & | p | ) |

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

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

A free function designed to interact with makeComShared.

template<typename T >

shared_ptr<T> cinder::msw::makeComShared | ( | T * | p | ) |

Creates a shared_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 Boost's thread local storage to prevent multiple initializations per thread.

Surface8u cinder::msw::convertGdiplusBitmap | ( | Gdiplus::Bitmap & | bitmap,
|  | bool | premultiplied |
| ) |  |  |

Copies the contents of a Gdiplus::Bitmap. premultiplied determines whether the result should be premultiplied by alpha

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.

Gdiplus::Bitmap * cinder::msw::createGdiplusBitmap | ( | const Surface8u & | surface,
|  | bool | premultiplied |
| ) |  |  |

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

## Variable Documentation

boost::thread_specific_ptr<ComInitializer> cinder::msw::threadComInitializer