[][src]Struct nvtt_rs::OutputOptions

pub struct OutputOptions { /* fields omitted */ }

Object which stores the output options for the texture. This provides a safer interface for the NvttOutputOptions type.

Implementations

impl OutputOptions[src]

pub fn new() -> Result<Self, Error>[src]

Create a new OutputOptions.

pub fn into_raw(self) -> *mut NvttOutputOptions[src]

Returns the underlying NvttOutputOptions pointer type. It is your responsibility to call nvttDestroyOutputOptions on this value to clean up the NvttOutputOptions resources.

pub fn set_output_location<'a, T: 'a + ?Sized + Into<OutputLocation<'a>>>(
    &mut self,
    out_location: T
) -> Result<&mut Self, PathConvertError>
[src]

Set the output location. This can be either a path or an in-memory buffer. For more information, see the OutputLocation type.

Notes

nvtt only supports ASCII filenames on Windows. If you need to support non-ASCII filenames, you will need to pass OutputLocation::Buffer, and then write the data into the file using another method. An example of to do this is shown below.

The OutputOptions will write to a buffer unless specified otherwise.

Example

use nvtt_rs::{
    CompressionOptions, CompressionOutput, Compressor,
    InputOptions, OutputLocation, OutputOptions,
};

let compressor = Compressor::new()?;
let input_opts = InputOptions::new()?;
let compression_opts = CompressionOptions::new()?;
let mut output_opts = OutputOptions::new()?;

output_opts.set_output_location(OutputLocation::Buffer);

// Set other texture options here...

match compressor.compress(&compression_opts, &input_opts, &output_opts)? {
    CompressionOutput::Memory { data, .. } => {
        std::fs::write("OutFile.dds", &data[..])?;
    }
    _ => {}
};

pub fn set_write_header<B: Into<NvttBoolean>>(
    &mut self,
    write_header: B
) -> &mut Self
[src]

If set to true, then the OutputOptions will write texture metadata into a header section of the file.

pub fn set_srgb_flag<B: Into<NvttBoolean>>(
    &mut self,
    write_srgb: B
) -> &mut Self
[src]

If write_srgb is set to true, then the output image will be in the sRGB colorspace.

pub fn set_container(&mut self, container: Container) -> &mut Self[src]

Set the Container type of the output image.

Trait Implementations

impl Debug for OutputOptions[src]

impl Drop for OutputOptions[src]

impl Send for OutputOptions[src]

impl Sync for OutputOptions[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.