aboutsummaryrefslogtreecommitdiff
path: root/vendor/exr/examples/0c_read_rgba.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
committerValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
commita990de90fe41456a23e58bd087d2f107d321f3a1 (patch)
tree15afc392522a9e85dc3332235e311b7d39352ea9 /vendor/exr/examples/0c_read_rgba.rs
parent3d48cd3f81164bbfc1a755dc1d4a9a02f98c8ddd (diff)
downloadfparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.tar.xz
fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.zip
Deleted vendor folder
Diffstat (limited to 'vendor/exr/examples/0c_read_rgba.rs')
-rw-r--r--vendor/exr/examples/0c_read_rgba.rs30
1 files changed, 0 insertions, 30 deletions
diff --git a/vendor/exr/examples/0c_read_rgba.rs b/vendor/exr/examples/0c_read_rgba.rs
deleted file mode 100644
index a2126f8..0000000
--- a/vendor/exr/examples/0c_read_rgba.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-extern crate exr;
-
-/// `exr` offers a few simplified functions for the most basic use cases.
-/// `read_first_rgba_layer_from_file` is a such a function, which loads rgba exr files.
-/// To load the pixel data, you need to specify
-/// how to create and how to set the pixels of your image.
-fn main() {
- let image = exr::prelude::read_first_rgba_layer_from_file(
- "generated_rgba.exr",
-
- // instantiate your image type with the size of the image in file
- |resolution, _| {
- let default_pixel = [0.0, 0.0, 0.0, 0.0];
- let empty_line = vec![ default_pixel; resolution.width() ];
- let empty_image = vec![ empty_line; resolution.height() ];
- empty_image
- },
-
- // transfer the colors from the file to your image type,
- // requesting all values to be converted to f32 numbers (you can also directly use f16 instead)
- // and you could also use `Sample` instead of `f32` to keep the original data type from the file
- |pixel_vector, position, (r,g,b, a): (f32, f32, f32, f32)| {
- pixel_vector[position.y()][position.x()] = [r, g, b, a]
- },
-
- ).expect("run the `1_write_rgba` example to generate the required file");
-
- // printing all pixels might kill the console, so only print some meta data about the image
- println!("opened file generated_rgba.exr: {:#?}", image.layer_data.attributes);
-} \ No newline at end of file