|
|
|
|
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Pixel` trait in crate `image`."><meta name="keywords" content="rust, rustlang, rust-lang, Pixel"><title>image::Pixel - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../image/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Trait Pixel</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#associated-types">Associated Types</a><div class="sidebar-links"><a href="#associatedtype.Subpixel">Subpixel</a></div><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.apply">apply</a><a href="#tymethod.apply2">apply2</a><a href="#tymethod.apply_with_alpha">apply_with_alpha</a><a href="#tymethod.blend">blend</a><a href="#tymethod.channel_count">channel_count</a><a href="#tymethod.channels">channels</a><a href="#tymethod.channels4">channels4</a><a href="#tymethod.channels_mut">channels_mut</a><a href="#tymethod.color_model">color_model</a><a href="#tymethod.color_type">color_type</a><a href="#tymethod.from_channels">from_channels</a><a href="#tymethod.from_slice">from_slice</a><a href="#tymethod.from_slice_mut">from_slice_mut</a><a href="#tymethod.invert">invert</a><a href="#tymethod.map">map</a><a href="#tymethod.map2">map2</a><a href="#tymethod.map_with_alpha">map_with_alpha</a><a href="#tymethod.to_bgr">to_bgr</a><a href="#tymethod.to_bgra">to_bgra</a><a href="#tymethod.to_luma">to_luma</a><a href="#tymethod.to_luma_alpha">to_luma_alpha</a><a href="#tymethod.to_rgb">to_rgb</a><a href="#tymethod.to_rgba">to_rgba</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='index.html'>image</a></p><script>window.sidebarCurrent = {name: 'Pixel', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/image/buffer.rs.html#18-133' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='index.html'>image</a>::<wbr><a class="trait" href=''>Pixel</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait Pixel: <a class="trait" href="https://doc.rust-lang.org/nightly/core
|
|
|
|
|
type <a href='#associatedtype.Subpixel' class="type">Subpixel</a>: <a class="trait" href="../image/trait.Primitive.html" title="trait image::Primitive">Primitive</a>;
|
|
|
|
|
fn <a href='#tymethod.channel_count' class='fnname'>channel_count</a>() -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.channels' class='fnname'>channels</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a>Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.channels_mut' class='fnname'>channels_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a>Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.color_model' class='fnname'>color_model</a>() -> &'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.color_type' class='fnname'>color_type</a>() -> <a class="enum" href="../image/enum.ColorType.html" title="enum image::ColorType">ColorType</a>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.channels4' class='fnname'>channels4</a>(<br> &self<br> ) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.from_channels' class='fnname'>from_channels</a>(<br> a: Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, <br> b: Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, <br> c: Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, <br> d: Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a><br> ) -> Self;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.from_slice' class='fnname'>from_slice</a>(slice: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a>Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.from_slice_mut' class='fnname'>from_slice_mut</a>(slice: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a>Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.to_rgb' class='fnname'>to_rgb</a>(&self) -> <a class="struct" href="../image/struct.Rgb.html" title="struct image::Rgb">Rgb</a><Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.to_rgba' class='fnname'>to_rgba</a>(&self) -> <a class="struct" href="../image/struct.Rgba.html" title="struct image::Rgba">Rgba</a><Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.to_luma' class='fnname'>to_luma</a>(&self) -> <a class="struct" href="../image/struct.Luma.html" title="struct image::Luma">Luma</a><Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.to_luma_alpha' class='fnname'>to_luma_alpha</a>(&self) -> <a class="struct" href="../image/struct.LumaA.html" title="struct image::LumaA">LumaA</a><Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.to_bgr' class='fnname'>to_bgr</a>(&self) -> <a class="struct" href="../image/struct.Bgr.html" title="struct image::Bgr">Bgr</a><Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.to_bgra' class='fnname'>to_bgra</a>(&self) -> <a class="struct" href="../image/struct.Bgra.html" title="struct image::Bgra">Bgra</a><Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.map' class='fnname'>map</a><F>(&self, f: F) -> Self<br> <span class="where">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a></span>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.apply' class='fnname'>apply</a><F>(&mut self, f: F)<br> <span class="where">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a></span>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.map_with_alpha' class='fnname'>map_with_alpha</a><F, G>(&self, f: F, g: G) -> Self<br> <span class="where">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>,<br> G: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a></span>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.apply_with_alpha' class='fnname'>apply_with_alpha</a><F, G>(&mut self, f: F, g: G)<br> <span class="where">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>,<br> G: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a></span>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.map2' class='fnname'>map2</a><F>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self, f: F) -> Self<br> <span class="where">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a></span>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.apply2' class='fnname'>apply2</a><F>(&mut self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self, f: F)<br> <span class="where">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a></span>;
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.invert' class='fnname'>invert</a>(&mut self);
|
|
|
|
|
<div class='item-spacer'></div> fn <a href='#tymethod.blend' class='fnname'>blend</a>(&mut self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self);
|
|
|
|
|
}</pre></div><div class='docblock'><p>A generalized pixel.</p>
|
|
|
|
|
<p>A pixel object is usually not used standalone but as a view into an image buffer.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<h2 id='associated-types' class='small-section-header'>Associated Types<a href='#associated-types' class='anchor'></a></h2><div class='methods'><h3 id='associatedtype.Subpixel' class='method'><code id='Subpixel.t'>type <a href='#associatedtype.Subpixel' class="type">Subpixel</a>: <a class="trait" href="../image/trait.Primitive.html" title="trait image::Primitive">Primitive</a></code></h3><div class='docblock'><p>The underlying subpixel type.</p>
|
|
|
|
|
</div></div><span class='loading-content'>Loading content...</span>
|
|
|
|
|
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.channel_count' class='method'><code id='channel_count.v'>fn <a href='#tymethod.channel_count' class='fnname'>channel_count</a>() -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></code></h3><div class='docblock'><p>Returns the number of channels of this pixel type.</p>
|
|
|
|
|
</div><h3 id='tymethod.channels' class='method'><code id='channels.v'>fn <a href='#tymethod.channels' class='fnname'>channels</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a>Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></code></h3><div class='docblock'><p>Returns the components as a slice.</p>
|
|
|
|
|
</div><h3 id='tymethod.channels_mut' class='method'><code id='channels_mut.v'>fn <a href='#tymethod.channels_mut' class='fnname'>channels_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a>Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></code></h3><div class='docblock'><p>Returns the components as a mutable slice</p>
|
|
|
|
|
</div><h3 id='tymethod.color_model' class='method'><code id='color_model.v'>fn <a href='#tymethod.color_model' class='fnname'>color_model</a>() -> &'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code></h3><div class='docblock'><p>Returns a string that can help to interpret the meaning each channel
|
|
|
|
|
See <a href="http://gegl.org/babl/">gimp babl</a>.</p>
|
|
|
|
|
</div><h3 id='tymethod.color_type' class='method'><code id='color_type.v'>fn <a href='#tymethod.color_type' class='fnname'>color_type</a>() -> <a class="enum" href="../image/enum.ColorType.html" title="enum image::ColorType">ColorType</a></code></h3><div class='docblock'><p>Returns the ColorType for this pixel format</p>
|
|
|
|
|
</div><h3 id='tymethod.channels4' class='method'><code id='channels4.v'>fn <a href='#tymethod.channels4' class='fnname'>channels4</a>(<br> &self<br>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></h3><div class='docblock'><p>Returns the channels of this pixel as a 4 tuple. If the pixel
|
|
|
|
|
has less than 4 channels the remainder is filled with the maximum value</p>
|
|
|
|
|
<p>TODO deprecate</p>
|
|
|
|
|
</div><h3 id='tymethod.from_channels' class='method'><code id='from_channels.v'>fn <a href='#tymethod.from_channels' class='fnname'>from_channels</a>(<br> a: Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, <br> b: Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, <br> c: Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, <br> d: Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a><br>) -> Self</code></h3><div class='docblock'><p>Construct a pixel from the 4 channels a, b, c and d.
|
|
|
|
|
If the pixel does not contain 4 channels the extra are ignored.</p>
|
|
|
|
|
<p>TODO deprecate</p>
|
|
|
|
|
</div><h3 id='tymethod.from_slice' class='method'><code id='from_slice.v'>fn <a href='#tymethod.from_slice' class='fnname'>from_slice</a>(slice: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a>Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self</code></h3><div class='docblock'><p>Returns a view into a slice.</p>
|
|
|
|
|
<p>Note: The slice length is not checked on creation. Thus the caller has to ensure
|
|
|
|
|
that the slice is long enough to present panics if the pixel is used later on.</p>
|
|
|
|
|
</div><h3 id='tymethod.from_slice_mut' class='method'><code id='from_slice_mut.v'>fn <a href='#tymethod.from_slice_mut' class='fnname'>from_slice_mut</a>(slice: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [</a>Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>Self</code></h3><div class='docblock'><p>Returns mutable view into a mutable slice.</p>
|
|
|
|
|
<p>Note: The slice length is not checked on creation. Thus the caller has to ensure
|
|
|
|
|
that the slice is long enough to present panics if the pixel is used later on.</p>
|
|
|
|
|
</div><h3 id='tymethod.to_rgb' class='method'><code id='to_rgb.v'>fn <a href='#tymethod.to_rgb' class='fnname'>to_rgb</a>(&self) -> <a class="struct" href="../image/struct.Rgb.html" title="struct image::Rgb">Rgb</a><Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>></code></h3><div class='docblock'><p>Convert this pixel to RGB</p>
|
|
|
|
|
</div><h3 id='tymethod.to_rgba' class='method'><code id='to_rgba.v'>fn <a href='#tymethod.to_rgba' class='fnname'>to_rgba</a>(&self) -> <a class="struct" href="../image/struct.Rgba.html" title="struct image::Rgba">Rgba</a><Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>></code></h3><div class='docblock'><p>Convert this pixel to RGB with an alpha channel</p>
|
|
|
|
|
</div><h3 id='tymethod.to_luma' class='method'><code id='to_luma.v'>fn <a href='#tymethod.to_luma' class='fnname'>to_luma</a>(&self) -> <a class="struct" href="../image/struct.Luma.html" title="struct image::Luma">Luma</a><Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>></code></h3><div class='docblock'><p>Convert this pixel to luma</p>
|
|
|
|
|
</div><h3 id='tymethod.to_luma_alpha' class='method'><code id='to_luma_alpha.v'>fn <a href='#tymethod.to_luma_alpha' class='fnname'>to_luma_alpha</a>(&self) -> <a class="struct" href="../image/struct.LumaA.html" title="struct image::LumaA">LumaA</a><Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>></code></h3><div class='docblock'><p>Convert this pixel to luma with an alpha channel</p>
|
|
|
|
|
</div><h3 id='tymethod.to_bgr' class='method'><code id='to_bgr.v'>fn <a href='#tymethod.to_bgr' class='fnname'>to_bgr</a>(&self) -> <a class="struct" href="../image/struct.Bgr.html" title="struct image::Bgr">Bgr</a><Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>></code></h3><div class='docblock'><p>Convert this pixel to BGR</p>
|
|
|
|
|
</div><h3 id='tymethod.to_bgra' class='method'><code id='to_bgra.v'>fn <a href='#tymethod.to_bgra' class='fnname'>to_bgra</a>(&self) -> <a class="struct" href="../image/struct.Bgra.html" title="struct image::Bgra">Bgra</a><Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>></code></h3><div class='docblock'><p>Convert this pixel to BGR with an alpha channel</p>
|
|
|
|
|
</div><h3 id='tymethod.map' class='method'><code id='map.v'>fn <a href='#tymethod.map' class='fnname'>map</a><F>(&self, f: F) -> Self <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, </span></code></h3><div class='docblock'><p>Apply the function <code>f</code> to each channel of this pixel.</p>
|
|
|
|
|
</div><h3 id='tymethod.apply' class='method'><code id='apply.v'>fn <a href='#tymethod.apply' class='fnname'>apply</a><F>(&mut self, f: F) <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, </span></code></h3><div class='docblock'><p>Apply the function <code>f</code> to each channel of this pixel.</p>
|
|
|
|
|
</div><h3 id='tymethod.map_with_alpha' class='method'><code id='map_with_alpha.v'>fn <a href='#tymethod.map_with_alpha' class='fnname'>map_with_alpha</a><F, G>(&self, f: F, g: G) -> Self <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>,<br> G: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, </span></code></h3><div class='docblock'><p>Apply the function <code>f</code> to each channel except the alpha channel.
|
|
|
|
|
Apply the function <code>g</code> to the alpha channel.</p>
|
|
|
|
|
</div><h3 id='tymethod.apply_with_alpha' class='method'><code id='apply_with_alpha.v'>fn <a href='#tymethod.apply_with_alpha' class='fnname'>apply_with_alpha</a><F, G>(&mut self, f: F, g: G) <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>,<br> G: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, </span></code></h3><div class='docblock'><p>Apply the function <code>f</code> to each channel except the alpha channel.
|
|
|
|
|
Apply the function <code>g</code> to the alpha channel. Works in-place.</p>
|
|
|
|
|
</div><h3 id='tymethod.map2' class='method'><code id='map2.v'>fn <a href='#tymethod.map2' class='fnname'>map2</a><F>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self, f: F) -> Self <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, </span></code></h3><div class='docblock'><p>Apply the function <code>f</code> to each channel of this pixel and
|
|
|
|
|
<code>other</code> pairwise.</p>
|
|
|
|
|
</div><h3 id='tymethod.apply2' class='method'><code id='apply2.v'>fn <a href='#tymethod.apply2' class='fnname'>apply2</a><F>(&mut self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self, f: F) <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>) -> Self::<a class="type" href="../image/trait.Pixel.html#associatedtype.Subpixel" title="type image::Pixel::Subpixel">Subpixel</a>, </span></code></h3><div class='docblock'><p>Apply the function <code>f</code> to each channel of this pixel and
|
|
|
|
|
<code>other</code> pairwise. Works in-place.</p>
|
|
|
|
|
</div><h3 id='tymethod.invert' class='method'><code id='invert.v'>fn <a href='#tymethod.invert' class='fnname'>invert</a>(&mut self)</code></h3><div class='docblock'><p>Invert this pixel</p>
|
|
|
|
|
</div><h3 id='tymethod.blend' class='method'><code id='blend.v'>fn <a href='#tymethod.blend' class='fnname'>blend</a>(&mut self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self)</code></h3><div class='docblock'><p>Blend the color of a given pixel into ourself, taking into account alpha channels</p>
|
|
|
|
|
</div></div><span class='loading-content'>Loading content...</span>
|
|
|
|
|
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'><h3 id='impl-Pixel' class='impl'><code class='in-band'>impl<T: <a class="trait" href="../image/trait.Primitive.html" title="trait image::Primitive">Primitive</a> + 'static> Pixel for <a class="struct" href="../image/struct.Bgr.html" title="struct image::Bgr">Bgr</a><T></code><a href='#impl-Pixel' class='anchor'></a><a class='srclink' href='../src/image/color.rs.html#79-205' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='associatedtype.Subpixel-1' class="type"><code id='Subpixel.t-1'>type <a href='#associatedtype.Subpixel-1' class="type">Subpixel</a> = T</code></h4><h4 id='method.channel_count' class="method hidden"><code id='channel_count.v-1'>fn <a href='#method.channel_count' class='fnname'>channel_count</a>() -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></code><a class='srclink' href='../src/image/color.rs.html#83-85' title='goto source code'>[src]</a></h4><h4 id='method.color_model' class="method hidden"><code id='color_model.v-1'>fn <a href='#method.color_model' class='fnname'>color_model</a>() -> &'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code><a class='srclink' href='../src/image/color.rs.html#86-88' title='goto source code'>[src]</a></h4><h4 id='method.color_type' class="method hidden"><code id='color_type.v-1'>fn <a href='#method.color_type' class='fnname'>color_type</a>() -> <a class="enum" href="../image/enum.ColorType.html" title="enum image::ColorType">ColorType</a></code><a class='srclink' href='../src/image/color.rs.html#89-91' title='goto source code'>[src]</a></h4><h4 id='method.channels' class="method hidden"><code id='channels.v-1'>fn <a href='#method.channels' class='fnname'>channels</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[T]</a></code><a class='srclink' href='../src/image/color.rs.html#93-95' title='goto source code'>[src]</a></h4><h4 id='method.channels_mut' class="method hidden"><code id='channels_mut.v-1'>fn <a href='#method.channels_mut' class='fnname'>channels_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&mut [T]</a></code><a class='srclink' href='../src/image/color.rs.html#97-99' title='goto source code'>[src]</a></h4><h4 id='method.channels4' class="method hidden"><code id='channels4.v-1'>fn <a href='#method.channels4' class='fnname'>channels4</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>T, T, T, T<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><a class='srclink' href='../src/image/color.rs.html#102-106' title='goto source code'>[src]</a></h4><h4 id='method.from_channels' class="method hidden"><code id='from_channels.v-1'>fn <a href='#method.from_channels' class='fnname'>from_channels</a>(a: T, b: T, c: T, d: T) -> <a class="struct" href="../image/struct.Bgr.html" title="struct image::Bgr">Bgr</a><T></code><a class='srclink' href='../src/image/color.rs.html#108-110' title='goto source code'>[src]</a></h4><h4 id='method.from_slice' class="method hidden"><code id='from_slice.v-1'>fn <a href='#method.from_slice' class='fnname'>from_slice</a>(slice: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[T]</a>) -> &<a class="struct" href="../image/struct.Bgr.html" title="struct image::Bgr">Bgr</a><T></code><a class='srclink' href='../src/image/color.rs.html#112-115' title='goto source code'>[src]</a></h4><h4 id='method.from_slice_mut' class="method hidden"><code id='from_slice_mut.v-1'>fn <a href='#method.from_slice_mut' class='fnname'>from_slice_mut</a>(slice: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&am
|
|
|
|
|
src="../implementors/image/trait.Pixel.js">
|
|
|
|
|
</script></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "image";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|