wxMaxima
Loading...
Searching...
No Matches
SvgBitmap.h
Go to the documentation of this file.
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2019 Gunter Königsmann <wxMaxima@physikbuch.de>
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation; either version 2 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15//
16// You should have received a copy of the GNU General Public License
17// along with this program; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19//
20// SPDX-License-Identifier: GPL-2.0+
21
29#ifndef SVGBITMAP_H
30#define SVGBITMAP_H
31
32#include "precomp.h"
33#include <wx/bitmap.h>
34#include <wx/bmpbndl.h>
35
42class SvgBitmap: public wxBitmap
43{
44public:
51 SvgBitmap(wxWindow *window, const unsigned char *data, const size_t len, int width = 640, int height = 480);
52 SvgBitmap(wxWindow *window, const unsigned char *data, const std::size_t len, wxSize siz);
53 SvgBitmap(SvgBitmap &&) = delete;
54 SvgBitmap &operator=(SvgBitmap &&o) noexcept;
55
57 const SvgBitmap& SetSize(int width, int height);
59 const SvgBitmap& SetSize(wxSize siz){return SetSize(siz.x, siz.y);}
71 static bool RendersText();
77 static wxString TextRenderingDiagnosis(bool rendersText);
79 static wxBitmap GetInvalidBitmap(int targetSize);
80private:
82 wxBitmapBundle m_svg;
83};
84
85#endif // SVGBITMAP_H
A wxBitmap with a constructor that generates the image from SVG.
Definition: SvgBitmap.h:43
static wxBitmap GetInvalidBitmap(int targetSize)
An "invalid bitmap" sign.
Definition: SvgBitmap.cpp:161
const SvgBitmap & SetSize(wxSize siz)
Sets the bitmap to a new size and renders the svg image at this size.
Definition: SvgBitmap.h:59
static wxString TextRenderingDiagnosis(bool rendersText)
Why SVG plots are available or not, given RendersText()'s result.
Definition: SvgBitmap.cpp:119
SvgBitmap(wxWindow *window, const unsigned char *data, const size_t len, int width=640, int height=480)
Renders an SVG image.
const SvgBitmap & SetSize(int width, int height)
Sets the bitmap to a new size and renders the svg image at this size.
Definition: SvgBitmap.cpp:61
static bool RendersText()
Does the SVG renderer wxWidgets was built with draw text?
Definition: SvgBitmap.cpp:152