spice namespace
Contents
- Reference
Contains the entire public interface of the library.
Namespaces
- namespace blend_function
- blend operations
- namespace blur
- namespace helpers
- namespace interpolation
- Interpolation operations on images.
- namespace noise
- namespace print
- namespace statistics
Classes
-
template<typename T>class image
-
template<typename T>class matrix
-
template<size_t Dimensions, typename T, bool Owner = true>class nd_vector_impl
-
template<size_t Dimensions, typename T>class nd_vector_impl<Dimensions, T, true>
-
template<typename T>struct range
- class transform_2d
Typedefs
- using channel_list = std::vector<std::string>
-
template<typename T = float>using color = nd_
vector<T, 1> -
template<typename T = float>using pixel_view = nd_
span<T, 1> -
template<typename T = float>using column_view = nd_
vector<T, 2> -
template<typename T, size_t Dimensions>using nd_span = nd_
vector_ impl<Dimensions, T, false> -
template<typename T, size_t Dimensions>using nd_vector = nd_
vector_ impl<Dimensions, T, true>
Functions
-
template<typename T, typename Interpolation = interpolation::bilinear<T>, typename BlendFunction = blend_function::overlay<T>>void merge(image<T>& a, image<T> const& b, transform_
2d tx) - Copy values from image
b, transformed bytx, into imagea. -
template<typename T>auto operator<<(std::ostream& os, color<T> const& pxl) -> std::ostream&
-
template<typename T>auto operator<<(std::ostream& os, pixel_
view<T> const& pxl) -> std::ostream& -
template<typename T>auto transpose(image<T> const& img) -> image<T>
-
template<typename T>auto load_image(char const* filename, const OIIO::ImageSpec* config = nullptr, bool ensure_alpha = false) -> image<T>
-
template<typename T>auto write_image(char const* filename, image<T> const& data, OIIO::TypeDesc const& format = helpers::
type_to_typedesc<T>()) -> bool -
template<typename T, bool Throws = true>auto invert(matrix<T> m) -> matrix<T>
- Invert matrix m.
-
auto translate(float x,
float y) -> transform_
2d -
auto rotate(float angle) -> transform_
2d -
auto scale(float x,
float y) -> transform_
2d
Variables
- const int NO_ALPHA
- Symbolic alpha channel index signifying the absence of opacity data.
- const int DISABLE_ALPHA_DEDUCTION
- Symbolic alpha channel index used to disable automatic detection of the alpha channel where applicable.
Typedef documentation
using spice:: channel_list = std::vector<std::string>
Alias for convenience and forwards compatibility (channel_list might pack much more information in the future: channel to index mapping etc...).
template<typename T = float>
using spice:: pixel_view = nd_ span<T, 1>
Refers to a single pixel in a spice::. Note that this class has no information about the size of the image it is referring to and thus cannot perform bounds checking. Use image:: for that.
template<typename T = float>
using spice:: column_view = nd_ vector<T, 2>
Refers to a column of pixel data in a spice::. Note that this class has no information about the size of the image it is referring to and thus cannot perform bounds checking. Use image:: for that.
template<typename T, size_t Dimensions>
using spice:: nd_span = nd_ vector_ impl<Dimensions, T, false>
Non-owning nd_ providing a view over a slice of an nd_vector. Can also be used to wrap a raw pointer representing the start of a multidimensional buffer.
template<typename T, size_t Dimensions>
using spice:: nd_vector = nd_ vector_ impl<Dimensions, T, true>
Owning nd_ managing its own buffer.
Function documentation
#include <include/spice/composite.hpp>
template<typename T, typename Interpolation = interpolation::bilinear<T>, typename BlendFunction = blend_function::overlay<T>>
void spice:: merge(image<T>& a,
image<T> const& b,
transform_ 2d tx)
Copy values from image b, transformed by tx, into image a.
| Template parameters | |
|---|---|
| T | |
| Interpolation | The interpolation function type |
| BlendFunction | The blend function type |
| Parameters | |
| a | the destination image |
| b | the source image |
| tx | the transformation to be applied to image b |
template<typename T>
std::ostream& spice:: operator<<(std::ostream& os,
color<T> const& pxl)
Specialized formatter for spice::.
template<typename T>
std::ostream& spice:: operator<<(std::ostream& os,
pixel_ view<T> const& pxl)
Specialized formatter for spice::.
template<typename T>
image<T> spice:: load_image(char const* filename,
const OIIO::ImageSpec* config = nullptr,
bool ensure_alpha = false)
| Parameters | |
|---|---|
| filename | The path on disk relative to the current working directory |
| config | file format specific parameters in the form of an ImageSpec configuration that will be handed through to OIIO |
| ensure_alpha | if this is true, load_image will add an alpha channel (labelled "A") if none is present in the source image. |
| Returns | An image object representing the file contents |
Loads an image from disk and returns a representation of the indicated data type. All conversions are handled internally by OIIO. If the image could not be read, an empty image is returned (size 0x0x0).
template<typename T>
bool spice:: write_image(char const* filename,
image<T> const& data,
OIIO::TypeDesc const& format = helpers:: type_to_typedesc<T>())
| Parameters | |
|---|---|
| filename | The path to write to relative to the current working directory |
| data | The image to save to disk |
| format | The data format the file should be written with |
| Returns | true if the image was successfully written, false if an error occurred. |
Writes an image to a file at the specified location.
#include <include/spice/matrix.hpp>
template<typename T, bool Throws = true>
matrix<T> spice:: invert(matrix<T> m)
Invert matrix m.
| Template parameters | |
|---|---|
| T | |
| Throws | set this to false to presume invertibility |
| Parameters | |
| m | the matrix to invert |
| Returns | matrix<T> |
| Exceptions | |
| std::domain_error | if the matrix is not invertible. Only applicable if template aregument Throws is set to true. |
transform_ 2d spice:: translate(float x,
float y)
#include <include/spice/transform.hpp>
Creates a transform_ describing the translation by the given vector.
transform_ 2d spice:: rotate(float angle)
#include <include/spice/transform.hpp>
Creates a transform_ describing the rotation by the given angle.
transform_ 2d spice:: scale(float x,
float y)
#include <include/spice/transform.hpp>
Creates a transform_ describing the scale by the given factors.