OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp} Namespace Reference

Classes

struct  PaneColors

Enumerations

enum  : int {
  ID_UV_FRAME = wxID_HIGHEST + 4200 , ID_UV_SNAP , ID_UV_AVG_SCALE , ID_UV_CUT ,
  ID_UV_JOIN , ID_UV_UNJOIN , ID_UV_UNWRAP , ID_UV_MARK_SEAMS ,
  ID_UV_SEAM_PATH , ID_UV_CLEAR_SEAMS , ID_UV_CLEAR_EDITS , ID_UV_SELECT_ISLAND ,
  ID_UV_SELECT_VERTEX , ID_UV_SELECT_EDGE , ID_UV_BG_HEIGHT , ID_UV_BG_CHECKER ,
  ID_UV_BG_DISTORTION , ID_UV_PICK_TEXTURE
}

Functions

wxSize gl_drawable_size (const wxWindow *win, const wxSize &logical_size)
std::vector< int > gl_attrib_list ()
void set_line_width (float width)
uint64_t undirected_edge_key (int a, int b)
bool point_in_triangle (const Vec2f &p, const Vec2f &a, const Vec2f &b, const Vec2f &c)
float angle_delta (float from, float to)
Transform3d to_transform3d (const UVEditorCanvas::IslandTransform &m)
wxBitmap pane_icon (wxWindow *win, const std::string &name, int size_dip)
wxSize drawn_size (const wxBitmap &bmp)
wxBitmap faded (const wxBitmap &bmp, double alpha)
wxColour mix (const wxColour &a, const wxColour &b, double t)

Variables

const ColorRGBA UV_COLOR_BG = { 0.16f, 0.16f, 0.16f, 1.f }
const ColorRGBA UV_COLOR_OUTSIDE = { 0.16f, 0.16f, 0.16f, 0.72f }
const ColorRGBA UV_COLOR_GRID = { 1.f, 1.f, 1.f, 0.08f }
const ColorRGBA UV_COLOR_HALO = { 0.06f, 0.06f, 0.07f, 1.f }
const ColorRGBA UV_COLOR_TILE_OUTLINE = { 0.70f, 0.70f, 0.72f, 1.f }
const ColorRGBA UV_COLOR_WIRE = { 1.f, 1.f, 1.f, 0.30f }
const ColorRGBA UV_COLOR_WIRE_SHADOW = { 0.f, 0.f, 0.f, 0.35f }
const ColorRGBA UV_COLOR_BOUNDARY = { 0.93f, 0.93f, 0.94f, 1.f }
const ColorRGBA UV_COLOR_HOVER = { 0.72f, 0.98f, 0.93f, 1.f }
const ColorRGBA UV_COLOR_HOVER_FILL = { 1.f, 1.f, 1.f, 0.12f }
const ColorRGBA UV_COLOR_FILL = { 1.f, 1.f, 1.f, 0.f }
const ColorRGBA UV_COLOR_SEL_FILL = { 0.15f, 0.85f, 0.75f, 0.24f }
const ColorRGBA UV_COLOR_SEL_WIRE = { 0.55f, 1.f, 0.92f, 0.55f }
const ColorRGBA UV_COLOR_SEL_BOUNDARY = { 0.16f, 0.90f, 0.78f, 1.f }
const ColorRGBA UV_COLOR_DIAL = { 1.f, 0.85f, 0.2f, 0.9f }
constexpr float SNAP_PIXELS = 28.f

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : int
Enumerator
ID_UV_FRAME 
ID_UV_SNAP 
ID_UV_AVG_SCALE 
ID_UV_CUT 
ID_UV_JOIN 
ID_UV_UNJOIN 
ID_UV_UNWRAP 
ID_UV_MARK_SEAMS 
ID_UV_SEAM_PATH 
ID_UV_CLEAR_SEAMS 
ID_UV_CLEAR_EDITS 
ID_UV_SELECT_ISLAND 
ID_UV_SELECT_VERTEX 
ID_UV_SELECT_EDGE 
ID_UV_BG_HEIGHT 
ID_UV_BG_CHECKER 
ID_UV_BG_DISTORTION 
ID_UV_PICK_TEXTURE 
1712 : int {
1713 ID_UV_FRAME = wxID_HIGHEST + 4200,
1714 ID_UV_SNAP,
1716 ID_UV_CUT,
1717 ID_UV_JOIN,
1724 ID_UV_SELECT_ISLAND, // + SelectMode
1727 ID_UV_BG_HEIGHT, // + Background
1731};
@ ID_UV_FRAME
Definition UVEditorCanvas.cpp:1713
@ ID_UV_SELECT_ISLAND
Definition UVEditorCanvas.cpp:1724
@ ID_UV_UNJOIN
Definition UVEditorCanvas.cpp:1718
@ ID_UV_JOIN
Definition UVEditorCanvas.cpp:1717
@ ID_UV_SNAP
Definition UVEditorCanvas.cpp:1714
@ ID_UV_CLEAR_EDITS
Definition UVEditorCanvas.cpp:1723
@ ID_UV_PICK_TEXTURE
Definition UVEditorCanvas.cpp:1730
@ ID_UV_CLEAR_SEAMS
Definition UVEditorCanvas.cpp:1722
@ ID_UV_SELECT_VERTEX
Definition UVEditorCanvas.cpp:1725
@ ID_UV_SEAM_PATH
Definition UVEditorCanvas.cpp:1721
@ ID_UV_CUT
Definition UVEditorCanvas.cpp:1716
@ ID_UV_SELECT_EDGE
Definition UVEditorCanvas.cpp:1726
@ ID_UV_BG_HEIGHT
Definition UVEditorCanvas.cpp:1727
@ ID_UV_UNWRAP
Definition UVEditorCanvas.cpp:1719
@ ID_UV_BG_DISTORTION
Definition UVEditorCanvas.cpp:1729
@ ID_UV_BG_CHECKER
Definition UVEditorCanvas.cpp:1728
@ ID_UV_AVG_SCALE
Definition UVEditorCanvas.cpp:1715
@ ID_UV_MARK_SEAMS
Definition UVEditorCanvas.cpp:1720

Function Documentation

◆ angle_delta()

float Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::angle_delta ( float from,
float to )
163{
164 float d = to - from;
165 while (d > float(M_PI))
166 d -= 2.f * float(M_PI);
167 while (d < -float(M_PI))
168 d += 2.f * float(M_PI);
169 return d;
170}
#define M_PI
Definition ExtrusionSimulator.cpp:31

References angle_delta(), and M_PI.

Referenced by angle_delta().

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

◆ drawn_size()

wxSize Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::drawn_size ( const wxBitmap & bmp)
1752{
1753#ifdef __WXGTK3__
1754 return bmp.GetLogicalSize();
1755#else
1756 return ScalableBitmap::GetBmpSize(bmp);
1757#endif
1758}
wxSize GetBmpSize() const
Definition wxExtensions.cpp:959

References drawn_size(), and ScalableBitmap::GetBmpSize().

Referenced by drawn_size().

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

◆ faded()

wxBitmap Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::faded ( const wxBitmap & bmp,
double alpha )
1762{
1763 wxImage image = bmp.ConvertToImage();
1764 if (!image.HasAlpha())
1765 image.InitAlpha();
1766 unsigned char *a = image.GetAlpha();
1767 for (int i = 0, n = image.GetWidth() * image.GetHeight(); i < n; ++i)
1768 a[i] = (unsigned char) std::lround(a[i] * alpha);
1769 return wxBitmap(image, -1, bmp.GetScaleFactor());
1770}

References faded().

Referenced by faded().

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

◆ gl_attrib_list()

std::vector< int > Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::gl_attrib_list ( )
106{
107 int antialiasing_samples = 4;
108 if (const AppConfig *app_config = wxGetApp().app_config; app_config != nullptr) {
109 const std::string value = app_config->get(SETTING_OPENGL_AA_SAMPLES);
110 if (value == "0" || value == "2" || value == "4" || value == "8" || value == "16")
111 antialiasing_samples = ::atoi(value.c_str());
112 }
113 // OpenGLManager's own auto-detection has already run by now (View3D is created before this
114 // canvas), so this only reads its verdict rather than re-detecting.
116 antialiasing_samples = 0;
117
118 return {
119 WX_GL_RGBA,
120 WX_GL_DOUBLEBUFFER,
121 WX_GL_MIN_RED, 8,
122 WX_GL_MIN_GREEN, 8,
123 WX_GL_MIN_BLUE, 8,
124 WX_GL_MIN_ALPHA, 8,
125 WX_GL_DEPTH_SIZE, 24,
126 WX_GL_STENCIL_SIZE, 8,
127 WX_GL_SAMPLE_BUFFERS, antialiasing_samples > 0 ? GL_TRUE : GL_FALSE,
128 WX_GL_SAMPLES, antialiasing_samples,
129 0
130 };
131}
#define SETTING_OPENGL_AA_SAMPLES
Definition AppConfig.hpp:34
Definition AppConfig.hpp:100
static bool can_multisample()
Definition OpenGLManager.hpp:100
#define GL_TRUE
Definition gl.h:1892
#define GL_FALSE
Definition gl.h:648

References Slic3r::GUI::OpenGLManager::can_multisample(), gl_attrib_list(), GL_FALSE, GL_TRUE, and SETTING_OPENGL_AA_SAMPLES.

Referenced by gl_attrib_list().

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

◆ gl_drawable_size()

wxSize Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::gl_drawable_size ( const wxWindow * win,
const wxSize & logical_size )
86{
87#if defined(__APPLE__) || defined(__WXGTK3__)
88 const double scale = (win != nullptr) ? win->GetContentScaleFactor() : 1.0;
89 if (scale > 0.0)
90 return wxSize(std::max(1, int(std::lround(logical_size.GetWidth() * scale))),
91 std::max(1, int(std::lround(logical_size.GetHeight() * scale))));
92#else
93 (void) win;
94#endif
95 return wxSize(std::max(1, logical_size.GetWidth()), std::max(1, logical_size.GetHeight()));
96}
int scale(const int val)
Definition WipeTowerDialog.cpp:58

References gl_drawable_size(), and scale().

Referenced by gl_drawable_size().

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

◆ mix()

wxColour Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::mix ( const wxColour & a,
const wxColour & b,
double t )
1787{
1788 const auto ch = [t](unsigned char x, unsigned char y) { return (unsigned char) std::lround(x + (y - x) * t); };
1789 return wxColour(ch(a.Red(), b.Red()), ch(a.Green(), b.Green()), ch(a.Blue(), b.Blue()));
1790}

References mix().

Referenced by mix().

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

◆ pane_icon()

wxBitmap Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::pane_icon ( wxWindow * win,
const std::string & name,
int size_dip )
1738{
1739#ifdef __WXGTK3__
1740 if (const double scale = win->GetContentScaleFactor(); scale > 1.0) {
1741 static BitmapCache cache;
1742 const unsigned px = unsigned(std::lround(size_dip * scale));
1743 if (wxBitmap *bmp = cache.load_svg(name, 0, px, false, wxGetApp().dark_mode()); bmp != nullptr && bmp->IsOk())
1744 return wxBitmap(bmp->ConvertToImage(), -1, scale);
1745 }
1746#endif
1747 return create_scaled_bitmap(name, win, size_dip);
1748}
Definition BitmapCache.hpp:22
wxBitmap * load_svg(const std::string &bitmap_key, unsigned width=0, unsigned height=0, const bool grayscale=false, const bool dark_mode=false, const std::string &new_color="", const float scale_in_center=0.f)
Definition BitmapCache.cpp:326
wxBitmap create_scaled_bitmap(const std::string &bmp_name_in, wxWindow *win, const int px_cnt, const bool grayscale, const std::string &new_color, const bool menu_bitmap, const bool resize, const bool bitmap2, const std::vector< std::string > &array_new_color)
Definition wxExtensions.cpp:448

References create_scaled_bitmap(), Slic3r::GUI::BitmapCache::load_svg(), pane_icon(), and scale().

Referenced by pane_icon().

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

◆ point_in_triangle()

bool Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::point_in_triangle ( const Vec2f & p,
const Vec2f & a,
const Vec2f & b,
const Vec2f & c )
151{
152 const auto cross = [](const Vec2f &u, const Vec2f &v) { return u.x() * v.y() - u.y() * v.x(); };
153 const float d0 = cross(b - a, p - a);
154 const float d1 = cross(c - b, p - b);
155 const float d2 = cross(a - c, p - c);
156 const bool has_neg = (d0 < 0.f) || (d1 < 0.f) || (d2 < 0.f);
157 const bool has_pos = (d0 > 0.f) || (d1 > 0.f) || (d2 > 0.f);
158 return !(has_neg && has_pos);
159}
T cross(const boost::geometry::model::d2::point_xy< T > &v1, const boost::geometry::model::d2::point_xy< T > &v2)
Definition ExtrusionSimulator.cpp:168
Eigen::Matrix< float, 2, 1, Eigen::DontAlign > Vec2f
Definition Point.hpp:64

References Slic3r::cross(), and point_in_triangle().

Referenced by point_in_triangle().

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

◆ set_line_width()

void Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::set_line_width ( float width)
137{
138 ::glLineWidth(width);
139 ::glGetError();
140}
#define glGetError
Definition gl.h:3849
#define glLineWidth
Definition gl.h:4215

References glGetError, glLineWidth, and set_line_width().

Referenced by set_line_width().

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

◆ to_transform3d()

Transform3d Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::to_transform3d ( const UVEditorCanvas::IslandTransform & m)
174{
175 Transform3d t = Transform3d::Identity();
176 t(0, 0) = m(0, 0); t(0, 1) = m(0, 1); t(0, 3) = m(0, 2);
177 t(1, 0) = m(1, 0); t(1, 1) = m(1, 1); t(1, 3) = m(1, 2);
178 return t;
179}
Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign > Transform3d
Definition Point.hpp:96

References to_transform3d().

Referenced by to_transform3d().

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

◆ undirected_edge_key()

uint64_t Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::undirected_edge_key ( int a,
int b )
143{
144 if (a > b)
145 std::swap(a, b);
146 return (uint64_t(uint32_t(a)) << 32) | uint32_t(b);
147}

References undirected_edge_key().

Referenced by undirected_edge_key().

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

Variable Documentation

◆ SNAP_PIXELS

float Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::SNAP_PIXELS = 28.f
constexpr

◆ UV_COLOR_BG

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_BG = { 0.16f, 0.16f, 0.16f, 1.f }
56{ 0.16f, 0.16f, 0.16f, 1.f };

◆ UV_COLOR_BOUNDARY

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_BOUNDARY = { 0.93f, 0.93f, 0.94f, 1.f }
67{ 0.93f, 0.93f, 0.94f, 1.f };

◆ UV_COLOR_DIAL

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_DIAL = { 1.f, 0.85f, 0.2f, 0.9f }
75{ 1.f, 0.85f, 0.2f, 0.9f }; // rotation protractor (#11)

◆ UV_COLOR_FILL

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_FILL = { 1.f, 1.f, 1.f, 0.f }
71{ 1.f, 1.f, 1.f, 0.f };

◆ UV_COLOR_GRID

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_GRID = { 1.f, 1.f, 1.f, 0.08f }
60{ 1.f, 1.f, 1.f, 0.08f };

◆ UV_COLOR_HALO

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_HALO = { 0.06f, 0.06f, 0.07f, 1.f }
63{ 0.06f, 0.06f, 0.07f, 1.f };

◆ UV_COLOR_HOVER

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_HOVER = { 0.72f, 0.98f, 0.93f, 1.f }
68{ 0.72f, 0.98f, 0.93f, 1.f }; // what a click would grab

◆ UV_COLOR_HOVER_FILL

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_HOVER_FILL = { 1.f, 1.f, 1.f, 0.12f }
69{ 1.f, 1.f, 1.f, 0.12f };

◆ UV_COLOR_OUTSIDE

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_OUTSIDE = { 0.16f, 0.16f, 0.16f, 0.72f }
59{ 0.16f, 0.16f, 0.16f, 0.72f };

◆ UV_COLOR_SEL_BOUNDARY

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_SEL_BOUNDARY = { 0.16f, 0.90f, 0.78f, 1.f }
74{ 0.16f, 0.90f, 0.78f, 1.f }; // the app teal, brightened to read on texture

◆ UV_COLOR_SEL_FILL

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_SEL_FILL = { 0.15f, 0.85f, 0.75f, 0.24f }
72{ 0.15f, 0.85f, 0.75f, 0.24f };

◆ UV_COLOR_SEL_WIRE

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_SEL_WIRE = { 0.55f, 1.f, 0.92f, 0.55f }
73{ 0.55f, 1.f, 0.92f, 0.55f };

◆ UV_COLOR_TILE_OUTLINE

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_TILE_OUTLINE = { 0.70f, 0.70f, 0.72f, 1.f }
64{ 0.70f, 0.70f, 0.72f, 1.f };

◆ UV_COLOR_WIRE

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_WIRE = { 1.f, 1.f, 1.f, 0.30f }
65{ 1.f, 1.f, 1.f, 0.30f }; // interior edges, unselected

◆ UV_COLOR_WIRE_SHADOW

const ColorRGBA Slic3r::GUI::anonymous_namespace{UVEditorCanvas.cpp}::UV_COLOR_WIRE_SHADOW = { 0.f, 0.f, 0.f, 0.35f }
66{ 0.f, 0.f, 0.f, 0.35f }; // 1 px offset under the wire