wxMaxima
|
Manages an auto-scaling image. More...
#include <Image.h>
Data Structures | |
class | WxmxStream |
Public Member Functions | |
Image (Configuration *config) | |
A constructor that generates an empty image. See LoadImage() | |
Image (Configuration *config, const wxMemoryBuffer &image, const wxString &type) | |
A constructor that loads the compressed file from a wxMemoryBuffer. | |
Image (Configuration *config, const wxBitmap &bitmap) | |
A constructor that loads a bitmap. | |
Image (Configuration *config, const wxString &image, const wxString &wxmxFile, bool remove=true) | |
A constructor that loads an image. | |
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 (const wxString &message=wxEmptyString) |
Creates a bitmap showing an error message. | |
void | GnuplotSource (wxString gnuplotFilename, wxString dataFilename, const wxString &wxmxFile=wxEmptyString) |
Sets the name of the gnuplot source and data file of this image. | |
void | CompressedGnuplotSource (wxString gnuplotFilename, wxString dataFilename, const wxString &wxmxFile=wxEmptyString) |
Loads the compressed gnuplot source and data file for this image. | |
wxString | GnuplotSource () |
Returns the gnuplot source file name of this image. | |
wxString | GnuplotData () |
Returns the gnuplot data file name of this image. | |
const wxMemoryBuffer | GetGnuplotSource () |
Returns the gnuplot source of this image. | |
const wxMemoryBuffer | GetCompressedGnuplotSource () |
const wxMemoryBuffer | GetGnuplotData () |
Returns the gnuplot data of this image. | |
const wxMemoryBuffer | GetCompressedGnuplotData () |
void | ClearCache () |
Temporarily forget the scaled image in order to save memory. | |
wxString | GetExtension () const |
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. | |
wxBitmap | GetUnscaledBitmap () |
Returns the image in its unscaled form. | |
void | Recalculate (double scale=1.0) |
Can be called to specify a specific scale. | |
const wxMemoryBuffer | GetCompressedImage () const |
Returns the original image in its compressed form. | |
std::size_t | GetOriginalWidth () const |
Returns the original width. | |
std::size_t | GetOriginalHeight () const |
Returns the original height. | |
bool | CanExportSVG () const |
Can this image be exported in SVG format? | |
bool | HasGnuplotSource () const |
Data Fields | |
long | m_width = 1 |
The width of the scaled image. | |
long | m_height = 1 |
The height of the scaled image. | |
wxMemoryBuffer | m_compressedImage |
The image in its original compressed form. | |
Manages an auto-scaling image.
This class keeps two versions of an image:
Storing images this way has many advantages:
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::Image | ( | Configuration * | config, |
const wxString & | image, | ||
const wxString & | wxmxFile, | ||
bool | remove = true |
||
) |
A constructor that loads an image.
config | The pointer to the current configuration storage for the worksheet |
image | The name of the file |
wxmxFile | The wxmx file to load it from. Empty when loading from a standalone file from the filesystem. |
remove | true = Delete the file after loading it |
|
inline |
Temporarily forget the scaled image in order to save memory.
Will recreate the scaled image as soon as needed.
void Image::CompressedGnuplotSource | ( | wxString | gnuplotFilename, |
wxString | dataFilename, | ||
const wxString & | wxmxFile = wxEmptyString |
||
) |
Loads the compressed gnuplot source and data file for this image.
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.
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.
void Image::GnuplotSource | ( | wxString | gnuplotFilename, |
wxString | dataFilename, | ||
const wxString & | wxmxFile = wxEmptyString |
||
) |
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.