wxMaxima
Loading...
Searching...
No Matches
BitmapOut.h
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2004-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4// Copyright (C) 2015 Gunter Königsmann <wxMaxima@physikbuch.de>
5//
6// This program is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation; either version 2 of the License, or
9// (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16//
17// You should have received a copy of the GNU General Public License
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20//
21// SPDX-License-Identifier: GPL-2.0+
22
23#ifndef BITMAPOUT_H
24#define BITMAPOUT_H
25
26#include "OutCommon.h"
27
33//cppcheck-suppress ODR
34class BitmapOut final
35{
36public:
44 explicit BitmapOut(const Configuration * const *configuration, double scale = 1);
46 explicit BitmapOut(const Configuration * const *configuration, std::unique_ptr<Cell> &&tree, double scale = 1, long maxSize = -1);
47 ~BitmapOut();
48
57 bool Render(std::unique_ptr<Cell> &&tree, long int maxSize = -1);
58
60 bool IsOk() const { return m_isOk; }
61
66 wxSize ToFile(const wxString &file);
67
69 wxBitmap GetBitmap() const { return m_bmp; }
70
71 std::unique_ptr<wxBitmapDataObject> GetDataObject() const;
72
74 bool ToClipboard() const;
75
76private:
77 std::unique_ptr<Cell> m_tree;
78 OutCommon m_cmn;
79 wxBitmap m_bmp;
80 wxMemoryDC m_dc;
81 bool m_isOk = false;
82
83 bool Layout(long int maxSize = -1);
84 void Draw();
85};
86
87#endif // BITMAPOUT_H
This is the header for common code used by various file output modules that render cells to files.
Renders portions of the work sheet (including 2D maths) as bitmap.
Definition: BitmapOut.h:35
wxSize ToFile(const wxString &file)
Exports this bitmap to a file.
Definition: BitmapOut.cpp:113
bool ToClipboard() const
Copies the bitmap representation of the list of cells that was passed to SetData()
Definition: BitmapOut.cpp:143
wxBitmap GetBitmap() const
Returns the bitmap representation of the list of cells that was passed to SetData()
Definition: BitmapOut.h:69
bool Render(std::unique_ptr< Cell > &&tree, long int maxSize=-1)
Renders tree as bitmap.
Definition: BitmapOut.cpp:56
bool IsOk() const
Returns whether the tree rendering succeeded.
Definition: BitmapOut.h:60
The configuration storage for the current worksheet.
Definition: Configuration.h:85
A collection of common code used in rendering the cells to a non-default output, e....
Definition: OutCommon.h:43