OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
ScalableBitmap Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/wxExtensions.hpp>

Collaboration diagram for ScalableBitmap:

Public Member Functions

 ScalableBitmap ()
 ScalableBitmap (wxWindow *parent, const std::string &icon_name="", const int px_cnt=16, const bool grayscale=false, const bool resize=false, const bool bitmap2=false, const std::vector< std::string > &new_color=std::vector< std::string >())
 ~ScalableBitmap ()
wxSize GetBmpSize () const
int GetBmpWidth () const
int GetBmpHeight () const
void msw_rescale ()
const wxBitmap & bmp () const
wxBitmap & bmp ()
const std::string & name () const
int px_cnt () const

Static Public Member Functions

static wxSize GetBmpSize (const wxBitmap &bmp)

Private Attributes

wxWindow * m_parent { nullptr }
wxBitmap m_bmp = wxBitmap()
std::string m_icon_name = ""
int m_px_cnt {16}
bool m_grayscale { false }
bool m_resize { false }

Detailed Description

Constructor & Destructor Documentation

◆ ScalableBitmap() [1/2]

ScalableBitmap::ScalableBitmap ( )
inline
170{};

◆ ScalableBitmap() [2/2]

ScalableBitmap::ScalableBitmap ( wxWindow * parent,
const std::string & icon_name = "",
const int px_cnt = 16,
const bool grayscale = false,
const bool resize = false,
const bool bitmap2 = false,
const std::vector< std::string > & new_color = std::vector<std::string>() )
946 :
947 m_parent(parent), m_icon_name(icon_name),
948 m_px_cnt(px_cnt), m_grayscale(grayscale), m_resize(resize) // BBS: support resize by fill border
949{
950 m_bmp = create_scaled_bitmap(icon_name, parent, px_cnt, m_grayscale, new_color.empty() ? std::string() : new_color.front(), false, resize, bitmap2, new_color);
951 if (px_cnt == 0) {
952 m_px_cnt = m_bmp.GetHeight(); // scale
953 unsigned int height = (unsigned int) (parent->FromDIP(m_px_cnt) + 0.5f);
954 if (height != GetBmpHeight())
955 msw_rescale();
956 }
957}
int m_px_cnt
Definition wxExtensions.hpp:199
void msw_rescale()
Definition wxExtensions.cpp:1000
std::string m_icon_name
Definition wxExtensions.hpp:198
int px_cnt() const
Definition wxExtensions.hpp:193
wxWindow * m_parent
Definition wxExtensions.hpp:196
bool m_resize
Definition wxExtensions.hpp:201
wxBitmap m_bmp
Definition wxExtensions.hpp:197
int GetBmpHeight() const
Definition wxExtensions.cpp:988
bool m_grayscale
Definition wxExtensions.hpp:200
coord_t height(const BoundingBox &box)
Definition Arrange.cpp:1185
wxBitmap create_scaled_bitmap(const std::string &bmp_name, wxWindow *win=nullptr, const int px_cnt=16, const bool grayscale=false, const std::string &new_color=std::string(), const bool menu_bitmap=false, const bool resize=false, const bool bitmap2=false, const std::vector< std::string > &array_new_color=std::vector< std::string >())
Definition wxExtensions.cpp:448

References create_scaled_bitmap(), GetBmpHeight(), m_bmp, m_grayscale, m_icon_name, m_parent, m_px_cnt, m_resize, msw_rescale(), and px_cnt().

Here is the call graph for this function:

◆ ~ScalableBitmap()

ScalableBitmap::~ScalableBitmap ( )
inline
179{}

Member Function Documentation

◆ bmp() [1/2]

wxBitmap & ScalableBitmap::bmp ( )
inline
190{ return m_bmp; }

References m_bmp.

◆ bmp() [2/2]

◆ GetBmpHeight()

int ScalableBitmap::GetBmpHeight ( ) const
989{
990 if (!m_bmp.IsOk())
991 return 0;
992#ifdef __APPLE__
993 return m_bmp.GetScaledHeight();
994#else
995 return m_bmp.GetHeight();
996#endif
997}

References m_bmp.

Referenced by ScalableBitmap(), Slic3r::GUI::DevExtruderImage::doRender(), Slic3r::GUI::ExtruderImage::doRender(), FanSwitchButton::render(), ImageSwitchButton::render(), and Slic3r::GUI::ImageGrid::renderIconText().

Here is the caller graph for this function:

◆ GetBmpSize() [1/2]

wxSize ScalableBitmap::GetBmpSize ( ) const
960{
961#ifdef __APPLE__
962 return m_bmp.GetScaledSize();
963#else
964 return m_bmp.GetSize();
965#endif
966}

References m_bmp.

Referenced by Slic3r::GUI::AMSExtImage::doRender(), Slic3r::GUI::AMSHumidity::doRender(), Slic3r::GUI::ExtruderImage::doRender(), Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::drawn_size(), Button::render(), TempInput::render(), and Slic3r::GUI::AMSLib::render_lite_lib().

Here is the caller graph for this function:

◆ GetBmpSize() [2/2]

wxSize ScalableBitmap::GetBmpSize ( const wxBitmap & bmp)
static
969{
970#ifdef __APPLE__
971 return bmp.GetScaledSize();
972#else
973 return bmp.GetSize();
974#endif
975}
const wxBitmap & bmp() const
Definition wxExtensions.hpp:189

References bmp().

Here is the call graph for this function:

◆ GetBmpWidth()

int ScalableBitmap::GetBmpWidth ( ) const
978{
979 if (!m_bmp.IsOk())
980 return 0;
981#ifdef __APPLE__
982 return m_bmp.GetScaledWidth();
983#else
984 return m_bmp.GetWidth();
985#endif
986}

References m_bmp.

Referenced by Slic3r::GUI::AMSHumidity::doRender(), Slic3r::GUI::DevExtruderImage::doRender(), Slic3r::GUI::ExtruderImage::doRender(), FanSwitchButton::render(), ImageSwitchButton::render(), and Slic3r::GUI::ImageGrid::renderIconText().

Here is the caller graph for this function:

◆ msw_rescale()

void ScalableBitmap::msw_rescale ( )
1001{
1002 // BBS: support resize by fill border
1004}

References create_scaled_bitmap(), m_bmp, m_grayscale, m_icon_name, m_parent, m_px_cnt, and m_resize.

Referenced by ScalableBitmap(), Slic3r::GUI::PublishSettingsDialog::on_dpi_changed(), and TempInput::render().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ name()

const std::string & ScalableBitmap::name ( ) const
inline
191{ return m_icon_name; }

References m_icon_name.

Referenced by ScalableButton::SetBitmap_(), and ScalableButton::SetBitmapDisabled_().

Here is the caller graph for this function:

◆ px_cnt()

int ScalableBitmap::px_cnt ( ) const
inline
193{return m_px_cnt;}

References m_px_cnt.

Referenced by ScalableBitmap().

Here is the caller graph for this function:

Member Data Documentation

◆ m_bmp

wxBitmap ScalableBitmap::m_bmp = wxBitmap()
private

◆ m_grayscale

bool ScalableBitmap::m_grayscale { false }
private
200{ false };

Referenced by ScalableBitmap(), and msw_rescale().

◆ m_icon_name

std::string ScalableBitmap::m_icon_name = ""
private

Referenced by ScalableBitmap(), msw_rescale(), and name().

◆ m_parent

wxWindow* ScalableBitmap::m_parent { nullptr }
private
196{ nullptr };

Referenced by ScalableBitmap(), and msw_rescale().

◆ m_px_cnt

int ScalableBitmap::m_px_cnt {16}
private
199{16};

Referenced by ScalableBitmap(), msw_rescale(), and px_cnt().

◆ m_resize

bool ScalableBitmap::m_resize { false }
private
201{ false };

Referenced by ScalableBitmap(), and msw_rescale().


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