Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::AnycubicSLARasterEncoder Struct Reference

Public Member Functions

sla::EncodedRaster operator() (const void *ptr, size_t w, size_t h, size_t num_components)
 

Detailed Description

Member Function Documentation

◆ operator()()

sla::EncodedRaster Slic3r::AnycubicSLARasterEncoder::operator() ( const void ptr,
size_t  w,
size_t  h,
size_t  num_components 
)
inline
57 {
58 std::vector<uint8_t> dst;
59 size_t span_len;
60 std::uint8_t pixel;
61 auto size = w * h * num_components;
62 dst.reserve(size);
63
64 const std::uint8_t *src = reinterpret_cast<const std::uint8_t *>(ptr);
65 const std::uint8_t *src_end = src + size;
66 while (src < src_end) {
67 anycubicsla_get_pixel_span(src, src_end, pixel, span_len);
68 src += span_len;
69 // fully transparent of fully opaque pixel
70 if (pixel == 0 || pixel == 0xF0) {
71 pixel = pixel | (span_len >> 8);
72 std::copy(&pixel, (&pixel) + 1, std::back_inserter(dst));
73 pixel = span_len & 0xFF;
74 std::copy(&pixel, (&pixel) + 1, std::back_inserter(dst));
75 }
76 // antialiased pixel
77 else {
78 pixel = pixel | span_len;
79 std::copy(&pixel, (&pixel) + 1, std::back_inserter(dst));
80 }
81 }
82
83 return sla::EncodedRaster(std::move(dst), "pwimg");
84 }
static void anycubicsla_get_pixel_span(const std::uint8_t *ptr, const std::uint8_t *end, std::uint8_t &pixel, size_t &span_len)
Definition AnycubicSLA.cpp:36
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183

References Slic3r::anycubicsla_get_pixel_span().

+ Here is the call graph for this function:

The documentation for this struct was generated from the following file: