#include <image.h>
◆ Image() [1/2]
| raytracer::common::Image::Image |
( |
int | _width, |
|
|
int | _height, |
|
|
int | _channels, |
|
|
bool | _is_grayscale ) |
Creates an image with the given properties and fills it with zero vectors (black).
- Parameters
-
| _width | The width of the image. |
| _height | The height of the image. |
| _channels | The number of color channels of the image. |
| _is_grayscale | Whether the image is grayscale (scalar color instead of RGB). |
◆ Image() [2/2]
| raytracer::common::Image::Image |
( |
const Vec3 & | color | ) |
|
|
explicit |
Creates a 1x1 image with the given color.
- Parameters
-
| color | The color of the sole pixel. |
◆ add_color()
| void raytracer::common::Image::add_color |
( |
int | x, |
|
|
int | y, |
|
|
const Vec3 & | color ) |
Adds a color vector on top of the existing one at a given position.
- Parameters
-
| x | The row of the image, starting from the top. |
| y | The column of the image, starting from the left. |
| color | The color to add on top. |
◆ draw()
| void raytracer::common::Image::draw |
( |
int | x, |
|
|
int | y, |
|
|
const Vec3 & | color ) |
Sets the color of the image at a given position.
- Parameters
-
| x | The row of the image, starting from the top. |
| y | The column of the image, starting from the left. |
| color | The new color at that position. |
◆ generateBmp()
| void raytracer::common::Image::generateBmp |
( |
const std::string & | file_name | ) |
const |
Write the pixel data to a bitmap on disk.
- Parameters
-
| file_name | The name of the file to write to. |
◆ get_color()
| Vec3 raytracer::common::Image::get_color |
( |
const int | x, |
|
|
const int | y ) const |
|
inlinenodiscard |
Returns the color at the given position.
- Parameters
-
| x | The row of the image, starting from the top. |
| y | The column of the image, starting from the left. |
- Returns
- The color at the given position.
◆ get_color_channels()
| int raytracer::common::Image::get_color_channels |
( |
| ) |
const |
|
inlinenodiscard |
Getter for the number of color channels the image has.
- Returns
- The number of color channels the image has.
◆ get_data()
| const std::vector< Vec3 > & raytracer::common::Image::get_data |
( |
| ) |
const |
|
inlinenodiscard |
Returns a const reference to the underlying vector of colors.
- Returns
- A const reference to the underlying vector of colors.
◆ get_height()
| int raytracer::common::Image::get_height |
( |
| ) |
const |
|
inlinenodiscard |
Getter for the height of the image.
- Returns
- The height of the image.
◆ get_is_grayscale()
| bool raytracer::common::Image::get_is_grayscale |
( |
| ) |
const |
|
inlinenodiscard |
Getter for whether the image is grayscale.
- Returns
- True if the image is grayscale, false otherwise.
◆ get_width()
| int raytracer::common::Image::get_width |
( |
| ) |
const |
|
inlinenodiscard |
Getter for the width of the image.
- Returns
- The width of the image.
The documentation for this class was generated from the following files: