wxMaxima
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Image Class Referencefinal

#include <Image.h>

Collaboration diagram for Image:
Collaboration graph
[legend]

Public Member Functions

 Image (Configuration **config)
 A constructor that generates an empty image. See LoadImage()
 
 Image (Configuration **config, wxMemoryBuffer image, wxString type)
 A constructor that loads the compressed file from a wxMemoryBuffer.
 
 Image (Configuration **config, const wxBitmap &bitmap)
 
 Image (Configuration **config, wxString image, std::shared_ptr< wxFileSystem > filesystem, bool remove=true)
 
 Image (Configuration **config, const Image &image)
 
 Image (const Image &image)=delete
 
void SetConfiguration (Configuration **config)
 
int GetPPI () const
 Return the image's resolution.
 
void SetPPI (int ppi)
 Set the image's resolution.
 
void InvalidBitmap ()
 Creates a bitmap showing an error message.
 
void GnuplotSource (wxString gnuplotFilename, wxString dataFilename, std::shared_ptr< wxFileSystem > filesystem)
 
void GnuplotSource (wxString gnuplotFilename, wxString dataFilename)
 Load the gnuplot source file from the system's filesystem.
 
wxString GnuplotSource ()
 
wxString GnuplotData ()
 
wxMemoryBuffer GetGnuplotSource ()
 Returns the gnuplot source of this image.
 
wxMemoryBuffer GetGnuplotData ()
 Returns the gnuplot data of this image.
 
void ClearCache ()
 
wxString GetExtension ()
 Returns the file name extension of the current image.
 
double GetMaxWidth () const
 The maximum width this image shall be displayed with.
 
double GetHeightList () const
 The maximum height this image shall be displayed with.
 
void SetMaxWidth (double width)
 Set the maximum width this image shall be displayed with.
 
void SetMaxHeight (double height)
 Set the maximum height this image shall be displayed with.
 
void LoadImage (const wxBitmap &bitmap)
 "Loads" an image from a bitmap
 
wxSize ToImageFile (wxString filename)
 Saves the image in its original form, or as .png if it originates in a bitmap.
 
wxBitmap GetBitmap (double scale=1.0)
 Returns the bitmap being displayed with custom scale.
 
bool IsOk ()
 Does the image show an actual image or an "broken image" symbol?
 
wxBitmap GetUnscaledBitmap ()
 Returns the image in its unscaled form.
 
void Recalculate (double scale=1.0)
 Can be called to specify a specific scale.
 
wxMemoryBuffer GetCompressedImage ()
 Returns the original image in its compressed form.
 
size_t GetOriginalWidth ()
 Returns the original width.
 
size_t GetOriginalHeight ()
 Returns the original height.
 
bool CanExportSVG () const
 Can this image be exported in SVG format?
 

Static Public Member Functions

static const wxString & GetBadImageToolTip ()
 The tooltip to use wherever an image that's not Ok is shown.
 

Public Attributes

long m_width
 The width of the scaled image.
 
long m_height
 The height of the scaled image.
 
wxMemoryBuffer m_compressedImage
 The image in its original compressed form.
 

Detailed Description

Manages an auto-scaling image

This class keeps two versions of an image:

Storing images this way has many advantages:

Constructor & Destructor Documentation

◆ Image() [1/2]

Image::Image ( Configuration **  config,
const wxBitmap &  bitmap 
)

A constructor that loads a bitmap

This constructor actually has to do some compression since we got the bitmap in an uncompressed form.

◆ Image() [2/2]

Image::Image ( Configuration **  config,
wxString  image,
std::shared_ptr< wxFileSystem >  filesystem,
bool  remove = true 
)

A constructor that loads an image

Parameters
configThe pointer to the current configuration storage for the worksheet
imageThe name of the file
filesystemThe filesystem to load it from
removetrue = Delete the file after loading it

Member Function Documentation

◆ ClearCache()

void Image::ClearCache ( )
inline

Temporarily forget the scaled image in order to save memory

Will recreate the scaled image as soon as needed.

◆ GnuplotData()

wxString Image::GnuplotData ( )

Returns the gnuplot data file name of this image

If maxima has deleted the temporary file in the meantime or if it comes from a .wxmx file and has never been created from maxima the file is created by this function.

If the file cannot be created (for example if no gnuplot source exists/ is known) this function returns wxEmptyString.

◆ GnuplotSource() [1/2]

wxString Image::GnuplotSource ( )

Returns the gnuplot source file name of this image

If maxima has deleted the temporary file in the meantime or if it comes from a .wxmx file and has never been created from maxima the file is created by this function.

If the file cannot be created (for example if no gnuplot source exists/ is known) this function returns wxEmptyString.

◆ GnuplotSource() [2/2]

void Image::GnuplotSource ( wxString  gnuplotFilename,
wxString  dataFilename,
std::shared_ptr< wxFileSystem >  filesystem 
)

Sets the name of the gnuplot source and data file of this image

Causes the files to be cached if they are not way too long; As the files are text-only they profit from being compressed and are stored in the memory in their compressed form.


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