Graphviz
13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
gvplugin_gdiplus.h
Go to the documentation of this file.
1
/*************************************************************************
2
* Copyright (c) 2011 AT&T Intellectual Property
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* https://www.eclipse.org/legal/epl-v10.html
7
*
8
* Contributors: Details at https://graphviz.org
9
*************************************************************************/
10
11
#pragma once
12
13
#include <memory>
14
#include <vector>
15
16
#include <windows.h>
17
#include <gdiplus.h>
18
19
typedef
enum
{
20
FORMAT_NONE
,
21
FORMAT_METAFILE
,
22
FORMAT_BMP
,
23
FORMAT_EMF
,
24
FORMAT_EMFPLUS
,
25
FORMAT_GIF
,
26
FORMAT_JPEG
,
27
FORMAT_PNG
,
28
FORMAT_TIFF
29
}
format_type
;
30
31
/* RAII for GetDC/ReleaseDC */
32
33
struct
DeviceContext
34
{
35
HWND
hwnd
;
36
HDC
hdc
;
37
38
DeviceContext
(HWND wnd =
nullptr
):
hwnd
(wnd),
hdc
(GetDC(wnd))
39
{
40
}
41
42
~DeviceContext
()
43
{
44
ReleaseDC(
hwnd
,
hdc
);
45
}
46
47
};
48
49
/* textlayout etc. */
50
51
struct
Layout
52
{
53
std::unique_ptr<Gdiplus::Font>
font
;
54
std::vector<WCHAR>
text
;
55
56
Layout
(
char
*fontname,
double
fontsize,
char
*
string
);
57
};
58
59
static
const
int
BYTES_PER_PIXEL
= 4;
/* bytes per pixel */
60
61
void
gdiplus_free_layout
(
void
*
layout
);
62
63
void
UseGdiplus
();
64
const
Gdiplus::StringFormat*
GetGenericTypographic
();
65
void
SaveBitmapToStream
(Gdiplus::Bitmap &bitmap, IStream *stream,
int
format
);
format
GVIO_API const char * format
Definition
gvio.h:51
gdiplus_free_layout
void gdiplus_free_layout(void *layout)
Definition
gvtextlayout_gdiplus.cpp:60
UseGdiplus
void UseGdiplus()
Definition
gvplugin_gdiplus.cpp:44
BYTES_PER_PIXEL
static const int BYTES_PER_PIXEL
Definition
gvplugin_gdiplus.h:59
GetGenericTypographic
const Gdiplus::StringFormat * GetGenericTypographic()
Definition
gvplugin_gdiplus.cpp:55
SaveBitmapToStream
void SaveBitmapToStream(Gdiplus::Bitmap &bitmap, IStream *stream, int format)
format_type
format_type
Definition
gvplugin_gdiplus.h:19
FORMAT_JPEG
@ FORMAT_JPEG
Definition
gvplugin_gdiplus.h:26
FORMAT_TIFF
@ FORMAT_TIFF
Definition
gvplugin_gdiplus.h:28
FORMAT_NONE
@ FORMAT_NONE
Definition
gvplugin_gdiplus.h:20
FORMAT_BMP
@ FORMAT_BMP
Definition
gvplugin_gdiplus.h:22
FORMAT_GIF
@ FORMAT_GIF
Definition
gvplugin_gdiplus.h:25
FORMAT_EMFPLUS
@ FORMAT_EMFPLUS
Definition
gvplugin_gdiplus.h:24
FORMAT_EMF
@ FORMAT_EMF
Definition
gvplugin_gdiplus.h:23
FORMAT_PNG
@ FORMAT_PNG
Definition
gvplugin_gdiplus.h:27
FORMAT_METAFILE
@ FORMAT_METAFILE
Definition
gvplugin_gdiplus.h:21
layout
static int layout(graph_t *g, layout_info *infop)
Definition
layout.c:811
DeviceContext
Definition
gvplugin_gdiplus.h:34
DeviceContext::hdc
HDC hdc
Definition
gvplugin_gdiplus.h:36
DeviceContext::hwnd
HWND hwnd
Definition
gvplugin_gdiplus.h:35
DeviceContext::~DeviceContext
~DeviceContext()
Definition
gvplugin_gdiplus.h:42
DeviceContext::DeviceContext
DeviceContext(HWND wnd=nullptr)
Definition
gvplugin_gdiplus.h:38
Layout
Definition
gvplugin_gdiplus.h:52
Layout::text
std::vector< WCHAR > text
Definition
gvplugin_gdiplus.h:54
Layout::font
std::unique_ptr< Gdiplus::Font > font
Definition
gvplugin_gdiplus.h:53
plugin
gdiplus
gvplugin_gdiplus.h
Generated by
1.9.8