OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::ThumbnailPanel Class Reference

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

Inheritance diagram for Slic3r::GUI::ThumbnailPanel:
Collaboration diagram for Slic3r::GUI::ThumbnailPanel:

Public Member Functions

 ThumbnailPanel (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
 ~ThumbnailPanel ()
void OnPaint (wxPaintEvent &event)
void PaintBackground (wxDC &dc)
void OnEraseBackground (wxEraseEvent &event)
void set_thumbnail (wxImage &img)
void render (wxDC &dc)

Public Attributes

wxBitmap m_bitmap
wxStaticBitmap * m_staticbitmap {nullptr}

Private Attributes

ScalableBitmap m_background_bitmap
wxBitmap bitmap_with_background
int m_brightness_value {-1}

Detailed Description

Constructor & Destructor Documentation

◆ ThumbnailPanel()

Slic3r::GUI::ThumbnailPanel::ThumbnailPanel ( wxWindow * parent,
wxWindowID winid = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize )
6486 : wxPanel(parent, winid, pos, size)
6487 {
6488#ifdef __WINDOWS__
6489 SetDoubleBuffered(true);
6490#endif //__WINDOWS__
6491
6492 SetBackgroundStyle(wxBG_STYLE_CUSTOM);
6493 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
6494 m_staticbitmap = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize);
6495 m_background_bitmap = ScalableBitmap(this,"thumbnail_grid",256);
6496 sizer->Add(m_staticbitmap, 1, wxEXPAND, 0);
6497 Bind(wxEVT_PAINT, &ThumbnailPanel::OnPaint, this);
6498 SetSizer(sizer);
6499 Layout();
6500 Fit();
6501 }
void OnPaint(wxPaintEvent &event)
Definition SelectMachine.cpp:6517
wxStaticBitmap * m_staticbitmap
Definition SelectMachine.hpp:267
ScalableBitmap m_background_bitmap
Definition SelectMachine.hpp:279

References m_background_bitmap, m_staticbitmap, and OnPaint().

Here is the call graph for this function:

◆ ~ThumbnailPanel()

Slic3r::GUI::ThumbnailPanel::~ThumbnailPanel ( )
6541{}

Member Function Documentation

◆ OnEraseBackground()

void Slic3r::GUI::ThumbnailPanel::OnEraseBackground ( wxEraseEvent & event)

◆ OnPaint()

void Slic3r::GUI::ThumbnailPanel::OnPaint ( wxPaintEvent & event)
6517 {
6518
6519 wxPaintDC dc(this);
6520 render(dc);
6521 }
void render(wxDC &dc)
Definition SelectMachine.cpp:6523

References render().

Referenced by ThumbnailPanel().

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

◆ PaintBackground()

void Slic3r::GUI::ThumbnailPanel::PaintBackground ( wxDC & dc)

◆ render()

void Slic3r::GUI::ThumbnailPanel::render ( wxDC & dc)
6523 {
6524
6525 if (wxGetApp().dark_mode() && m_brightness_value < SHOW_BACKGROUND_BITMAP_PIXEL_THRESHOLD) {
6526 #ifdef __WXMSW__
6527 wxMemoryDC memdc;
6528 wxBitmap bmp(GetSize());
6529 memdc.SelectObject(bmp);
6530 memdc.DrawBitmap(bitmap_with_background, 0, 0);
6531 dc.Blit(0, 0, GetSize().GetWidth(), GetSize().GetHeight(), &memdc, 0, 0);
6532 #else
6533 dc.DrawBitmap(bitmap_with_background, 0, 0);
6534 #endif
6535 }
6536 else
6537 dc.DrawBitmap(m_bitmap, 0, 0);
6538
6539 }
#define SHOW_BACKGROUND_BITMAP_PIXEL_THRESHOLD
Definition GUI_App.hpp:56
int m_brightness_value
Definition SelectMachine.hpp:281
wxBitmap bitmap_with_background
Definition SelectMachine.hpp:280
wxBitmap m_bitmap
Definition SelectMachine.hpp:266

References bitmap_with_background, m_bitmap, m_brightness_value, and SHOW_BACKGROUND_BITMAP_PIXEL_THRESHOLD.

Referenced by OnPaint().

Here is the caller graph for this function:

◆ set_thumbnail()

void Slic3r::GUI::ThumbnailPanel::set_thumbnail ( wxImage & img)
6504 {
6506 m_bitmap = img;
6507 //Paint the background bitmap to the thumbnail bitmap with wxMemoryDC
6508 wxMemoryDC dc;
6509 bitmap_with_background.Create(wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight()));
6510 dc.SelectObject(bitmap_with_background);
6511 dc.DrawBitmap(m_background_bitmap.bmp(), 0, 0);
6512 dc.DrawBitmap(m_bitmap, 0, 0);
6513 dc.SelectObject(wxNullBitmap);
6514 Refresh();
6515 }
static int get_brightness_value(wxImage image)
Definition SelectMachine.hpp:133

References bitmap_with_background, Slic3r::GUI::get_brightness_value(), m_background_bitmap, m_bitmap, and m_brightness_value.

Here is the call graph for this function:

Member Data Documentation

◆ bitmap_with_background

wxBitmap Slic3r::GUI::ThumbnailPanel::bitmap_with_background
private

Referenced by render(), and set_thumbnail().

◆ m_background_bitmap

ScalableBitmap Slic3r::GUI::ThumbnailPanel::m_background_bitmap
private

Referenced by ThumbnailPanel(), and set_thumbnail().

◆ m_bitmap

wxBitmap Slic3r::GUI::ThumbnailPanel::m_bitmap

Referenced by render(), and set_thumbnail().

◆ m_brightness_value

int Slic3r::GUI::ThumbnailPanel::m_brightness_value {-1}
private
281{-1};

Referenced by render(), and set_thumbnail().

◆ m_staticbitmap

wxStaticBitmap* Slic3r::GUI::ThumbnailPanel::m_staticbitmap {nullptr}
267{nullptr};

Referenced by ThumbnailPanel().


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