mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-24 01:01:15 -06:00
ENABLE_THUMBNAIL_GENERATOR -> WIP: Refactoring and preparation for adding thumbnails to exported gcode and 3mf files
This commit is contained in:
parent
959ef9a9ec
commit
4d1153c866
15 changed files with 346 additions and 46 deletions
|
|
@ -7,16 +7,16 @@ namespace Slic3r {
|
|||
|
||||
void ThumbnailData::set(unsigned int w, unsigned int h)
|
||||
{
|
||||
if (!pixels.empty())
|
||||
reset();
|
||||
|
||||
if ((w == 0) || (h == 0))
|
||||
return;
|
||||
|
||||
width = w;
|
||||
height = h;
|
||||
// defaults to white texture
|
||||
pixels = std::vector<unsigned char>(width * height * 4, 255);
|
||||
if ((width != w) || (height != h))
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
// defaults to white texture
|
||||
pixels = std::vector<unsigned char>(width * height * 4, 255);
|
||||
}
|
||||
}
|
||||
|
||||
void ThumbnailData::reset()
|
||||
|
|
@ -26,6 +26,11 @@ void ThumbnailData::reset()
|
|||
pixels.clear();
|
||||
}
|
||||
|
||||
bool ThumbnailData::is_valid() const
|
||||
{
|
||||
return (width != 0) && (height != 0) && ((unsigned int)pixels.size() == 4 * width * height);
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // ENABLE_THUMBNAIL_GENERATOR
|
||||
|
|
@ -16,6 +16,8 @@ struct ThumbnailData
|
|||
ThumbnailData() { reset(); }
|
||||
void set(unsigned int w, unsigned int h);
|
||||
void reset();
|
||||
|
||||
bool is_valid() const;
|
||||
};
|
||||
|
||||
} // namespace Slic3r
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue