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
30
31/* RAII for GetDC/ReleaseDC */
32
34{
35 HWND hwnd;
36 HDC hdc;
37
38 DeviceContext(HWND wnd = nullptr): hwnd(wnd), hdc(GetDC(wnd))
39 {
40 }
41
43 {
44 ReleaseDC(hwnd, hdc);
45 }
46
47};
48
49/* textlayout etc. */
50
51struct 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
59static const int BYTES_PER_PIXEL = 4; /* bytes per pixel */
60
61void gdiplus_free_layout(void *layout);
62
63void UseGdiplus();
64const Gdiplus::StringFormat* GetGenericTypographic();
65void SaveBitmapToStream(Gdiplus::Bitmap &bitmap, IStream *stream, int format);
GVIO_API const char * format
Definition gvio.h:51
void gdiplus_free_layout(void *layout)
void UseGdiplus()
static const int BYTES_PER_PIXEL
const Gdiplus::StringFormat * GetGenericTypographic()
void SaveBitmapToStream(Gdiplus::Bitmap &bitmap, IStream *stream, int format)
format_type
@ FORMAT_JPEG
@ FORMAT_TIFF
@ FORMAT_NONE
@ FORMAT_BMP
@ FORMAT_GIF
@ FORMAT_EMFPLUS
@ FORMAT_EMF
@ FORMAT_PNG
@ FORMAT_METAFILE
static int layout(graph_t *g, layout_info *infop)
Definition layout.c:811
DeviceContext(HWND wnd=nullptr)
std::vector< WCHAR > text
std::unique_ptr< Gdiplus::Font > font