aboutsummaryrefslogtreecommitdiff
path: root/vendor/exr/examples/5c_write_mip_maps.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/exr/examples/5c_write_mip_maps.rs')
-rw-r--r--vendor/exr/examples/5c_write_mip_maps.rs73
1 files changed, 0 insertions, 73 deletions
diff --git a/vendor/exr/examples/5c_write_mip_maps.rs b/vendor/exr/examples/5c_write_mip_maps.rs
deleted file mode 100644
index 1096c4e..0000000
--- a/vendor/exr/examples/5c_write_mip_maps.rs
+++ /dev/null
@@ -1,73 +0,0 @@
-
-extern crate smallvec;
-extern crate rand;
-extern crate half;
-
-
-// exr imports
-extern crate exr;
-
-
-
-/// Writes two layers, each with multiple mip maps.
-/// All mip maps have solid color for brevity.
-fn main() {
- use exr::prelude::*;
- use exr::math::RoundingMode;
- use smallvec::smallvec;
-
- let full_size = Vec2(512, 512);
- let size_rounding = RoundingMode::Up;
-
- let mip_levels_sizes = exr::meta::mip_map_levels(
- size_rounding, full_size
- ).collect::<Vec<_>>();
-
- let red_mip_levels = mip_levels_sizes.iter()
- .map(|(_index, level_size)|{
- FlatSamples::F32(vec![0.1_f32; level_size.area() ])
- })
- .collect();
-
- let green_mip_levels = mip_levels_sizes.iter()
- .map(|(_index, level_size)|{
- FlatSamples::F32(vec![0.6_f32; level_size.area() ])
- })
- .collect();
-
- let blue_mip_levels = mip_levels_sizes.iter()
- .map(|(_index, level_size)|{
- FlatSamples::F32(vec![1.0_f32; level_size.area() ])
- })
- .collect();
-
- let rgb_mip_maps = AnyChannels::sort(smallvec![
- AnyChannel::new("R", Levels::Mip { level_data: red_mip_levels, rounding_mode: size_rounding }),
- AnyChannel::new("G", Levels::Mip { level_data: green_mip_levels, rounding_mode: size_rounding }),
- AnyChannel::new("B", Levels::Mip { level_data: blue_mip_levels, rounding_mode: size_rounding }),
- ]);
-
- let layer1 = Layer::new(
- full_size,
- LayerAttributes::named("teal rgb"),
- Encoding::FAST_LOSSLESS,
- rgb_mip_maps
- );
-
- let mut layer2 = layer1.clone();
- layer2.attributes.layer_name = Some("Copied Layer".into());
- layer2.encoding = Encoding::SMALL_FAST_LOSSLESS;
-
- // define the visible area of the canvas
- let image_attributes = ImageAttributes::new(
- IntegerBounds::from_dimensions(full_size)
- );
-
- let image = Image::empty(image_attributes)
- .with_layer(layer1).with_layer(layer2);
-
- println!("writing image...");
- image.write().to_file("mip_maps.exr").unwrap();
-
- println!("created file mip_maps.exr");
-} \ No newline at end of file