MCPcopy Create free account
hub / github.com/alandefreitas/matplotplusplus / image_data_string

Method image_data_string

source/matplot/axes_objects/matrix.cpp:276–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274 }
275
276 std::string matrix::image_data_string() {
277 std::stringstream ss;
278 ss.precision(10);
279 ss << std::fixed;
280 auto [h, w] = size(matrices_[0]);
281 double x_width_ = x_width();
282 double y_width_ = y_width();
283 for (size_t i = 0; i < w; ++i) {
284 for (size_t j = 0; j < h; ++j) {
285 ss << " " << x_ + x_width_ * i;
286 ss << " " << y_ + y_width_ * j;
287 ss << " " << static_cast<int>(matrices_[0][j][i]);
288 if (matrices_.size() >= 3) {
289 ss << " " << static_cast<int>(matrices_[1][j][i]);
290 ss << " " << static_cast<int>(matrices_[2][j][i]);
291 }
292 if (has_alpha()) {
293 ss << " "
294 << static_cast<int>(
295 (1 - alpha_) *
296 (is_rgba() ? matrices_[3][j][i] : 255.));
297 }
298 ss << "\n";
299 }
300 }
301 ss << " e\n";
302 return ss.str();
303 }
304
305 std::string matrix::data_string() {
306 return matrices_.size() > 1 ? image_data_string()

Callers

nothing calls this directly

Calls 4

sizeFunction · 0.85
x_widthFunction · 0.85
y_widthFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected