blob: 647f479a6b1525cf43d749a042b8efdde15acaaf [file] [log] [blame]
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +02001/* vi:set ts=8 sts=4 sw=4 noet: */
2/*
3 * Author: MURAOKA Taro <koron.kaoriya@gmail.com>
4 *
5 * Contributors:
6 * - Ken Takata
7 *
8 * Copyright (C) 2013 MURAOKA Taro <koron.kaoriya@gmail.com>
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
16extern "C" {
17#endif
18
19typedef struct DWriteContext DWriteContext;
20
21typedef 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
53void DWrite_Init(void);
54void DWrite_Final(void);
55
56DWriteContext *DWriteContext_Open(void);
57void DWriteContext_BeginDraw(DWriteContext *ctx);
58void DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, RECT *rect);
59void DWriteContext_SetFont(DWriteContext *ctx, HFONT hFont);
60void 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);
71void DWriteContext_EndDraw(DWriteContext *ctx);
72void DWriteContext_Close(DWriteContext *ctx);
73
74void DWriteContext_SetRenderingParams(
75 DWriteContext *ctx,
76 const DWriteRenderingParams *params);
77
78DWriteRenderingParams *DWriteContext_GetRenderingParams(
79 DWriteContext *ctx,
80 DWriteRenderingParams *params);
81
82#ifdef __cplusplus
83}
84#endif
85#endif/*GUI_DWRITE_H*/