blob: 9c98c4ce0dfc82d7cd50e2d9fa6d4ae224213082 [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
Bram Moolenaard7ccc4d2017-11-26 14:29:32 +01007 * - Yasuhiro Matsumoto
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +02008 *
9 * Copyright (C) 2013 MURAOKA Taro <koron.kaoriya@gmail.com>
10 * THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
11 */
12
13#ifndef GUI_DWRITE_H
14#define GUI_DWRITE_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20typedef struct DWriteContext DWriteContext;
21
22typedef struct DWriteRenderingParams {
23 float gamma;
24 float enhancedContrast;
25 float clearTypeLevel;
26 /*
27 * pixelGeometry:
28 * 0 - DWRITE_PIXEL_GEOMETRY_FLAT
29 * 1 - DWRITE_PIXEL_GEOMETRY_RGB
30 * 2 - DWRITE_PIXEL_GEOMETRY_BGR
31 */
32 int pixelGeometry;
33 /*
34 * renderingMode:
35 * 0 - DWRITE_RENDERING_MODE_DEFAULT
36 * 1 - DWRITE_RENDERING_MODE_ALIASED
37 * 2 - DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC
38 * 3 - DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL
39 * 4 - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL
40 * 5 - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC
41 * 6 - DWRITE_RENDERING_MODE_OUTLINE
42 */
43 int renderingMode;
44 /*
45 * antialiasMode:
46 * 0 - D2D1_TEXT_ANTIALIAS_MODE_DEFAULT
47 * 1 - D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE
48 * 2 - D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE
49 * 3 - D2D1_TEXT_ANTIALIAS_MODE_ALIASED
50 */
51 int textAntialiasMode;
52} DWriteRenderingParams;
53
54void DWrite_Init(void);
55void DWrite_Final(void);
56
57DWriteContext *DWriteContext_Open(void);
Bram Moolenaar92467d32017-12-05 13:22:16 +010058void DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, const RECT *rect);
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +020059void DWriteContext_SetFont(DWriteContext *ctx, HFONT hFont);
60void DWriteContext_DrawText(
61 DWriteContext *ctx,
Bram Moolenaar92467d32017-12-05 13:22:16 +010062 const WCHAR *text,
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +020063 int len,
64 int x,
65 int y,
66 int w,
67 int h,
68 int cellWidth,
Bram Moolenaard7ccc4d2017-11-26 14:29:32 +010069 COLORREF color,
70 UINT fuOptions,
Bram Moolenaar92467d32017-12-05 13:22:16 +010071 const RECT *lprc,
72 const INT *lpDx);
73void DWriteContext_FillRect(DWriteContext *ctx, const RECT *rc, COLORREF color);
74void DWriteContext_DrawLine(DWriteContext *ctx, int x1, int y1, int x2, int y2,
75 COLORREF color);
76void DWriteContext_SetPixel(DWriteContext *ctx, int x, int y, COLORREF color);
Bram Moolenaard7ccc4d2017-11-26 14:29:32 +010077void DWriteContext_Flush(DWriteContext *ctx);
Bram Moolenaarb5a7a8b2014-08-06 14:52:30 +020078void DWriteContext_Close(DWriteContext *ctx);
79
80void DWriteContext_SetRenderingParams(
81 DWriteContext *ctx,
82 const DWriteRenderingParams *params);
83
84DWriteRenderingParams *DWriteContext_GetRenderingParams(
85 DWriteContext *ctx,
86 DWriteRenderingParams *params);
87
88#ifdef __cplusplus
89}
90#endif
91#endif/*GUI_DWRITE_H*/