1 /* vi:set ts=8 sts=4 sw=4 noet: */ 2 /* 3 * Author: MURAOKA Taro <[email protected]> 4 * 5 * Contributors: 6 * - Ken Takata 7 * 8 * Copyright (C) 2013 MURAOKA Taro <[email protected]> 9 * THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. 10 */ 11 12 #ifndef GUI_DWRITE_H 13 #define GUI_DWRITE_H 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 typedef struct DWriteContext DWriteContext; 20 21 typedef struct DWriteRenderingParams { 22 float gamma; 23 float enhancedContrast; 24 float clearTypeLevel; 25 /* 26 * pixelGeometry: 27 * 0 - DWRITE_PIXEL_GEOMETRY_FLAT 28 * 1 - DWRITE_PIXEL_GEOMETRY_RGB 29 * 2 - DWRITE_PIXEL_GEOMETRY_BGR 30 */ 31 int pixelGeometry; 32 /* 33 * renderingMode: 34 * 0 - DWRITE_RENDERING_MODE_DEFAULT 35 * 1 - DWRITE_RENDERING_MODE_ALIASED 36 * 2 - DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC 37 * 3 - DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL 38 * 4 - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL 39 * 5 - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC 40 * 6 - DWRITE_RENDERING_MODE_OUTLINE 41 */ 42 int renderingMode; 43 /* 44 * antialiasMode: 45 * 0 - D2D1_TEXT_ANTIALIAS_MODE_DEFAULT 46 * 1 - D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE 47 * 2 - D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE 48 * 3 - D2D1_TEXT_ANTIALIAS_MODE_ALIASED 49 */ 50 int textAntialiasMode; 51 } DWriteRenderingParams; 52 53 void DWrite_Init(void); 54 void DWrite_Final(void); 55 56 DWriteContext *DWriteContext_Open(void); 57 void DWriteContext_BeginDraw(DWriteContext *ctx); 58 void DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, RECT *rect); 59 void DWriteContext_SetFont(DWriteContext *ctx, HFONT hFont); 60 void DWriteContext_DrawText( 61 DWriteContext *ctx, 62 HDC hdc, 63 const WCHAR* text, 64 int len, 65 int x, 66 int y, 67 int w, 68 int h, 69 int cellWidth, 70 COLORREF color); 71 void DWriteContext_EndDraw(DWriteContext *ctx); 72 void DWriteContext_Close(DWriteContext *ctx); 73 74 void DWriteContext_SetRenderingParams( 75 DWriteContext *ctx, 76 const DWriteRenderingParams *params); 77 78 DWriteRenderingParams *DWriteContext_GetRenderingParams( 79 DWriteContext *ctx, 80 DWriteRenderingParams *params); 81 82 #ifdef __cplusplus 83 } 84 #endif 85 #endif/*GUI_DWRITE_H*/ 86