wxMaxima
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes
BitmapOut Class Referencefinal

Renders portions of the work sheet (including 2D maths) as bitmap. More...

#include <BitmapOut.h>

Public Member Functions

 BitmapOut (const Configuration *const *configuration, double scale=1)
 The constructor.
 
 BitmapOut (const Configuration *const *configuration, std::unique_ptr< Cell > &&tree, double scale=1, long maxSize=-1)
 Constructs and renders the bitmap, setting the IsOK() status accordingly.
 
bool Render (std::unique_ptr< Cell > &&tree, long int maxSize=-1)
 Renders tree as bitmap.
 
bool IsOk () const
 Returns whether the tree rendering succeeded.
 
wxSize ToFile (const wxString &file)
 Exports this bitmap to a file.
 
wxBitmap GetBitmap () const
 Returns the bitmap representation of the list of cells that was passed to SetData()
 
std::unique_ptr< wxBitmapDataObject > GetDataObject () const
 
bool ToClipboard () const
 Copies the bitmap representation of the list of cells that was passed to SetData()
 

Static Public Member Functions

static wxBitmap RenderForClipboard (const Configuration *const *configuration, const std::function< std::unique_ptr< Cell >()> &cells, double scale)
 Draws cells as a bitmap for the clipboard.
 

Static Public Attributes

static constexpr long CLIPBOARD_MAX_PIXELS = 32000000
 The largest bitmap, in pixels, that is put on the clipboard.
 

Detailed Description

Renders portions of the work sheet (including 2D maths) as bitmap.

This is used for exporting HTML with embedded maths as bitmap and for putting bitmaps for the clipboard

Constructor & Destructor Documentation

◆ BitmapOut()

BitmapOut::BitmapOut ( const Configuration *const *  configuration,
double  scale = 1 
)
explicit

The constructor.

Parameters
scaleBy which factor the resolution should be increased in respect to the default 755 DPI?
configurationA pointer to the pointer to this worksheet's configuration storage

Member Function Documentation

◆ Render()

bool BitmapOut::Render ( std::unique_ptr< Cell > &&  tree,
long int  maxSize = -1 
)

Renders tree as bitmap.

Parameters
treeThe list of cells that is to be rendered
maxSizemaxSize tells the maximum size [in square pixels] that will be rendered. -1 means: No limit.
Returns
true, if the bitmap could be created.

◆ RenderForClipboard()

wxBitmap BitmapOut::RenderForClipboard ( const Configuration *const *  configuration,
const std::function< std::unique_ptr< Cell >()> &  cells,
double  scale 
)
static

Draws cells as a bitmap for the clipboard.

Draws at the given scale if the bitmap stays below CLIPBOARD_MAX_PIXELS, else at scale 1 if that is small enough, and else not at all.

Parameters
configurationA pointer to the pointer to the configuration to draw with
cellsMakes a fresh copy of the cells each time it is called: a BitmapOut consumes the cells it draws, and the second try needs them again.
scaleThe scale to try first
Returns
The bitmap, or an invalid bitmap if it would have been too large.

◆ ToFile()

wxSize BitmapOut::ToFile ( const wxString &  file)

Exports this bitmap to a file.

Returns
The size of the bitmap in millimeters. Sizes <0 indicate that the export has failed.

Field Documentation

◆ CLIPBOARD_MAX_PIXELS

constexpr long BitmapOut::CLIPBOARD_MAX_PIXELS = 32000000
staticconstexpr

The largest bitmap, in pixels, that is put on the clipboard.

Without a limit, copying a large matrix as a whole (a selected block only contains the selected entries) asked for a bitmap of several gigabytes: copying a 300x300 matrix grew wxMaxima to 8 GB and kept it busy for minutes. wxQt draws every clipboard format when Ctrl+C is pressed, so there nothing reached the clipboard until that was over. 32 million pixels are 128 MB, more than any program pasting a picture wants.


The documentation for this class was generated from the following files: