Skip to content

Instantly share code, notes, and snippets.

@makotokato
makotokato / colorglyph.cpp
Created March 10, 2014 03:16
Draw Color Glyph with DirectWrite 1.2
void DrawGlyphRun(ID2D1RenderTarget* target, IDWriteFactory factory, IDWriteFont* fontFace, ID2D1Brush* defaultBrush, DWRITE_GLYPH_RUN* glyphRun)
{
bool isColor = false;
IDWriteColorGlyphRunEnumerator* colorLayer;
IDWriteFont2* fontFace2;
fontFace->QueryInterface(reinterpret_cast<IDWriteFontFace2**>(&fontFace2));
if (fontFace2->IsColorFont()) {
IDWriteFactory2* factory2;
factory->QueryIntarface(reinterpret_cast<IDWriteFactory2**>(&factory2));
@rmw
rmw / hash.rb
Created May 16, 2012 13:50
Extend Ruby Hash with method to return a recursive OpenStruct
class Hash
# options:
# :exclude => [keys] - keys need to be symbols
def to_ostruct_recursive(options = {})
convert_to_ostruct_recursive(self, options)
end
private
def convert_to_ostruct_recursive(obj, options)
result = obj