#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/TextureProjectorFrame.hpp>
◆ TextureProjectorFrame()
| Slic3r::GUI::TextureProjectorFrame::TextureProjectorFrame |
( |
wxWindow * | parent | ) |
|
|
explicit |
23 : wxFrame(parent, wxID_ANY,
_L(
"Projection frame - drag over the model, then Apply"), wxDefaultPosition,
24 wxSize(360, 360),
25
26
27
28
29 wxCAPTION | wxRESIZE_BORDER | wxCLOSE_BOX | wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT)
30{
31 SetBackgroundStyle(wxBG_STYLE_PAINT);
33
34 Bind(wxEVT_SIZE, [this](wxSizeEvent &evt) { Refresh(); evt.Skip(); });
35 SetTransparent(wxByte(
m_alpha));
36
37
38
39 Bind(wxEVT_CLOSE_WINDOW, [this](wxCloseEvent &evt) {
40 if (evt.CanVeto()) {
41 evt.Veto();
42 Hide();
43 } else
44 evt.Skip();
45 });
46}
#define _L(s)
Definition OBJ.cpp:34
int m_alpha
Definition TextureProjectorFrame.hpp:54
void on_paint(wxPaintEvent &)
Definition TextureProjectorFrame.cpp:81
References _L, m_alpha, and on_paint().
◆ client_rect_on_screen()
| wxRect Slic3r::GUI::TextureProjectorFrame::client_rect_on_screen |
( |
| ) |
const |
76{
77 const wxSize sz = GetClientSize();
78 return wxRect(ClientToScreen(wxPoint(0, 0)), sz);
79}
◆ on_paint()
| void Slic3r::GUI::TextureProjectorFrame::on_paint |
( |
wxPaintEvent & | | ) |
|
|
private |
82{
83 wxPaintDC dc(this);
84 const wxSize sz = GetClientSize();
85 if (sz.x <= 0 || sz.y <= 0)
86 return;
87
88 dc.SetBackground(wxBrush(wxColour(20, 20, 20)));
89 dc.Clear();
90
92
93
94
95 wxImage
scaled =
m_bitmap.ConvertToImage().Scale(sz.x, sz.y, wxIMAGE_QUALITY_NORMAL);
96 dc.DrawBitmap(wxBitmap(
scaled), 0, 0,
false);
97 }
98
99
100
101 dc.SetPen(wxPen(wxColour(0, 200, 180), 2));
102 dc.SetBrush(*wxTRANSPARENT_BRUSH);
103 dc.DrawRectangle(0, 0, sz.x, sz.y);
104}
wxBitmap m_bitmap
Definition TextureProjectorFrame.hpp:53
BoundingBox scaled(const BoundingBoxf &bb)
Definition BoundingBox.hpp:284
References m_bitmap, and Slic3r::scaled().
Referenced by TextureProjectorFrame().
◆ opacity()
| int Slic3r::GUI::TextureProjectorFrame::opacity |
( |
| ) |
const |
|
inline |
◆ set_opacity()
| void Slic3r::GUI::TextureProjectorFrame::set_opacity |
( |
int | alpha | ) |
|
69{
70 m_alpha = std::clamp(alpha, 20, 255);
71 SetTransparent(wxByte(
m_alpha));
72 Refresh();
73}
References m_alpha.
◆ set_texture()
| void Slic3r::GUI::TextureProjectorFrame::set_texture |
( |
const std::vector< unsigned char > & | grayscale_pixels, |
|
|
int | width, |
|
|
int | height ) |
49{
50 if (width <= 0 || height <= 0 || gray.size() < size_t(width) * size_t(height)) {
52 Refresh();
53 return;
54 }
55
56 wxImage img(width, height);
57 unsigned char *dst = img.GetData();
58 for (size_t i = 0, n = size_t(width) * size_t(height); i < n; ++i) {
59 const unsigned char v = gray[i];
60 dst[i * 3 + 0] = v;
61 dst[i * 3 + 1] = v;
62 dst[i * 3 + 2] = v;
63 }
65 Refresh();
66}
References m_bitmap.
◆ m_alpha
| int Slic3r::GUI::TextureProjectorFrame::m_alpha = 140 |
|
private |
◆ m_bitmap
| wxBitmap Slic3r::GUI::TextureProjectorFrame::m_bitmap |
|
private |
The documentation for this class was generated from the following files: