Size: 800 bytes.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// cs/renderer/film.hh
#ifndef CS_RENDERER_FILM_HH
#define CS_RENDERER_FILM_HH

#include <stdint.h>

#include <iostream>
#include <tuple>

#include "cs/renderer/pixel.hh"

namespace cs::renderer {

struct Film {
  unsigned int width, height;
  Pixel** pixels;
  Film() : Film(0, 0) {}
  Film(std::tuple<unsigned int, unsigned int> dimensions)
      : Film(std::get<0>(dimensions),
             std::get<1>(dimensions)) {}
  Film(unsigned int width, unsigned int height)
      : width(width), height(height) {
    pixels = new Pixel*[width];
    for (unsigned int w = 0; w < width; w++) {
      pixels[w] = new Pixel[height];
    }
  }

  std::tuple<unsigned int, unsigned int> dimensions()
      const {
    return {width, height};
  }
};

}  // namespace cs::renderer

#endif  // CS_RENDERER_FILM_HH
v0 (commit) © 2025 @p13i.io | Load balancer proxied to: cs-code-viewer-1:8080 in 4ms.