 |
wxMaxima
|
Go to the documentation of this file.
37 #include <wx/filesys.h>
38 #include <wx/fs_arc.h>
39 #include <wx/buffer.h>
40 #define NANOSVG_ALL_COLOR_KEYWORDS
41 #include "nanoSVG/nanosvg.h"
42 #include "nanoSVG/nanosvgrast.h"
91 Image(
Configuration **config, wxString image, std::shared_ptr<wxFileSystem> filesystem,
bool remove =
true);
98 void SetConfiguration(
Configuration **config){ m_configuration = config; }
113 void GnuplotSource(wxString gnuplotFilename, wxString dataFilename, std::shared_ptr<wxFileSystem> filesystem);
153 if ((m_scaledBitmap.GetWidth() > 1) || (m_scaledBitmap.GetHeight() > 1))
154 m_scaledBitmap.Create(1, 1);
213 wxMemoryBuffer m_gnuplotSource_Compressed;
215 wxMemoryBuffer m_gnuplotData_Compressed;
217 size_t m_originalWidth;
219 size_t m_originalHeight;
221 wxBitmap m_scaledBitmap;
223 wxString m_extension;
227 wxString m_gnuplotSource;
229 wxString m_gnuplotData;
230 void LoadImage_Backgroundtask(wxString image, std::shared_ptr<wxFileSystem> filesystem,
bool remove);
231 void LoadGnuplotSource_Backgroundtask(wxString gnuplotFilename, wxString dataFilename, std::shared_ptr<wxFileSystem> filesystem);
233 void LoadImage(wxString image, std::shared_ptr<wxFileSystem> filesystem,
bool remove =
true);
235 static wxMemoryBuffer ReadCompressedImage(wxInputStream *data);
245 wxString m_imageName;
248 struct free_deleter {
void operator()(
void *p)
const { std::free(p); } };
250 std::unique_ptr<struct NSVGrasterizer, free_deleter> m_svgRast{
nullptr};
252 std::shared_ptr<wxFileSystem> m_fs_keepalive_gnuplotdata;
253 std::shared_ptr<wxFileSystem> m_fs_keepalive_imagedata;
wxBitmap GetUnscaledBitmap()
Returns the image in its unscaled form.
Definition: Image.cpp:172
void SetMaxWidth(double width)
Set the maximum width this image shall be displayed with.
Definition: Image.h:164
wxMemoryBuffer GetCompressedImage()
Returns the original image in its compressed form.
Definition: Image.cpp:201
int GetPPI() const
Return the image's resolution.
Definition: Image.h:100
wxBitmap GetBitmap(double scale=1.0)
Returns the bitmap being displayed with custom scale.
Definition: Image.cpp:650
long m_width
The width of the scaled image.
Definition: Image.h:187
wxMemoryBuffer m_compressedImage
The image in its original compressed form.
Definition: Image.h:203
long m_height
The height of the scaled image.
Definition: Image.h:189
wxString GnuplotSource()
Definition: Image.cpp:532
wxMemoryBuffer GetGnuplotSource()
Returns the gnuplot source of this image.
Definition: Image.cpp:424
void LoadImage(const wxBitmap &bitmap)
"Loads" an image from a bitmap
Definition: Image.cpp:736
void InvalidBitmap()
Creates a bitmap showing an error message.
Definition: Image.cpp:709
void Recalculate(double scale=1.0)
Can be called to specify a specific scale.
Definition: Image.cpp:923
static const wxString & GetBadImageToolTip()
The tooltip to use wherever an image that's not Ok is shown.
Definition: Image.cpp:988
void ClearCache()
Definition: Image.h:151
bool IsOk()
Does the image show an actual image or an "broken image" symbol?
Definition: Image.cpp:216
void GnuplotSource(wxString gnuplotFilename, wxString dataFilename)
Load the gnuplot source file from the system's filesystem.
Definition: Image.h:116
void SetPPI(int ppi)
Set the image's resolution.
Definition: Image.h:102
wxMemoryBuffer GetGnuplotData()
Returns the gnuplot data of this image.
Definition: Image.cpp:459
double GetHeightList() const
The maximum height this image shall be displayed with.
Definition: Image.h:162
Definition: Configuration.h:83
wxString GetExtension()
Returns the file name extension of the current image.
Definition: Image.cpp:755
void SetMaxHeight(double height)
Set the maximum height this image shall be displayed with.
Definition: Image.h:166
wxString GnuplotData()
Definition: Image.cpp:494
size_t GetOriginalWidth()
Returns the original width.
Definition: Image.cpp:206
Image(Configuration **config)
A constructor that generates an empty image. See LoadImage()
Definition: Image.cpp:39
size_t GetOriginalHeight()
Returns the original height.
Definition: Image.cpp:211
double GetMaxWidth() const
The maximum width this image shall be displayed with.
Definition: Image.h:160
Definition: nanosvg.h:158
bool CanExportSVG() const
Can this image be exported in SVG format?
Definition: Image.h:206
wxSize ToImageFile(wxString filename)
Saves the image in its original form, or as .png if it originates in a bitmap.
Definition: Image.cpp:577