mirror of
https://github.com/boostorg/gil.git
synced 2026-01-25 18:22:16 +00:00
98 lines
7.9 KiB
HTML
98 lines
7.9 KiB
HTML
<!-- Copyright 2008 Lubomir Bourdev and Hailin Jin
|
|
Distributed under the Boost Software License, Version 1.0.
|
|
(See accompanying file LICENSE_1_0.txt or copy at
|
|
http://www.boost.org/LICENSE_1_0.txt)
|
|
-->
|
|
<!--
|
|
Copyright 2005-2007 Adobe Systems Incorporated
|
|
Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
|
|
or a copy at http://stlab.adobe.com/licenses.html)
|
|
Some files are held under additional license.
|
|
Please see "http://stlab.adobe.com/licenses.html" for more information.
|
|
-->
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
|
<head>
|
|
<TITLE>channel_convert</TITLE>
|
|
<META HTTP-EQUIV="content-type" CONTENT="text/html;charset=ISO-8859-1"/>
|
|
<link type="text/css" rel="stylesheet" href="../_static/style.css">
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary="header">
|
|
<tr>
|
|
<td valign="top" width="300">
|
|
<h3><a href="../index.html"><img
|
|
alt="C++ Boost" src="../_static/boost.png" border="0"></a></h3>
|
|
</td>
|
|
<td >
|
|
<h1 align="center"><a href="../index.html"></a></h1>
|
|
</td>
|
|
<td>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<hr/>
|
|
<table border="0" cellspacing="0" cellpadding="0" style='width: 100%; margin: 0; padding: 0'><tr>
|
|
<td width="100%" valign="top" style='padding-left: 10px; padding-right: 10px; padding-bottom: 10px'>
|
|
<div class="qindex"><a class="qindex" href="index.html">Modules</a>
|
|
| <a class="qindex" href="classes.html">Alphabetical List</a>
|
|
| <a class="qindex" href="annotated.html">Class List</a>
|
|
</div>
|
|
<!-- End Header -->
|
|
<!-- Generated by Doxygen 1.8.13 -->
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#groups">Modules</a> |
|
|
<a href="#nested-classes">Classes</a> |
|
|
<a href="#func-members">Functions</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">channel_convert<div class="ingroups"><a class="el" href="group___channel.html">Channel</a> » <a class="el" href="group___channel_algorithm.html">Algorithms and Utility Functions</a></div></div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Converting from one channel type to anotherConversion is done as a simple linear mapping of one channel range to the other, such that the minimum/maximum value of the source maps to the minimum/maximum value of the destination. One implication of this is that the value 0 of signed channels may not be preserved!
|
|
<a href="#details">More...</a></p>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
|
|
Modules</h2></td></tr>
|
|
<tr class="memitem:group___channel_convert_unsigned_algorithm"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group___channel_convert_unsigned_algorithm.html">channel_converter_unsigned</a></td></tr>
|
|
<tr class="memdesc:group___channel_convert_unsigned_algorithm"><td class="mdescLeft"> </td><td class="mdescRight">Convert one unsigned/floating point channel to another. Converts both the channel type and range. <br /></td></tr>
|
|
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
|
|
Classes</h2></td></tr>
|
|
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1gil_1_1channel__converter.html">channel_converter< SrcChannelV, DstChannelV ></a></td></tr>
|
|
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">A unary function object converting between channel types. <a href="structboost_1_1gil_1_1channel__converter.html#details">More...</a><br /></td></tr>
|
|
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1gil_1_1default__channel__converter.html">default_channel_converter</a></td></tr>
|
|
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Same as <a class="el" href="structboost_1_1gil_1_1channel__converter.html" title="A unary function object converting between channel types. ">channel_converter</a>, except it takes the destination channel by reference, which allows us to move the templates from the class level to the method level. This is important when invoking it on heterogeneous pixels. <a href="structboost_1_1gil_1_1default__channel__converter.html#details">More...</a><br /></td></tr>
|
|
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr class="memitem:ga1ca10b1d27bc2f2ce4906b8890e613a5"><td class="memTemplParams" colspan="2"><a id="ga1ca10b1d27bc2f2ce4906b8890e613a5"></a>
|
|
template<typename DstChannel , typename SrcChannel > </td></tr>
|
|
<tr class="memitem:ga1ca10b1d27bc2f2ce4906b8890e613a5"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="structboost_1_1gil_1_1channel__traits.html">channel_traits</a>< DstChannel >::value_type </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group___channel_convert_algorithm.html#ga1ca10b1d27bc2f2ce4906b8890e613a5">channel_convert</a> (const SrcChannel &src)</td></tr>
|
|
<tr class="memdesc:ga1ca10b1d27bc2f2ce4906b8890e613a5"><td class="mdescLeft"> </td><td class="mdescRight">Converting from one channel type to another. <br /></td></tr>
|
|
<tr class="separator:ga1ca10b1d27bc2f2ce4906b8890e613a5"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<p>Converting from one channel type to another</p>
|
|
<p>Conversion is done as a simple linear mapping of one channel range to the other, such that the minimum/maximum value of the source maps to the minimum/maximum value of the destination. One implication of this is that the value 0 of signed channels may not be preserved! </p>
|
|
<p>When creating new channel models, it is often a good idea to provide specializations for the channel conversion algorithms, for example, for performance optimizations. If the new model is an integral type that can be signed, it is easier to define the conversion only for the unsigned type (<code>channel_converter_unsigned</code>) and provide specializations of <code>detail::channel_convert_to_unsigned</code> and <code>detail::channel_convert_from_unsigned</code> to convert between the signed and unsigned type.</p>
|
|
<p>Example: </p><div class="fragment"><div class="line"><span class="comment">// bits32f is a floating point channel with range [0.0f ... 1.0f]</span></div><div class="line">bits32f src_channel = channel_traits<bits32f>::max_value();</div><div class="line">assert(src_channel == 1);</div><div class="line"></div><div class="line"><span class="comment">// bits8 is 8-bit unsigned integral channel (typedef-ed from unsigned char)</span></div><div class="line">bits8 dst_channel = channel_convert<bits8>(src_channel);</div><div class="line">assert(dst_channel == 255); <span class="comment">// max value goes to max value</span></div></div><!-- fragment --> </div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.13
|
|
</small></address>
|
|
</body>
|
|
</html>
|