mirror of
https://github.com/boostorg/gil.git
synced 2026-01-23 17:42:30 +00:00
100 lines
8.1 KiB
HTML
100 lines
8.1 KiB
HTML
<!-- HTML header for doxygen 1.8.13-->
|
|
<!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">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.9.8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>Generic Image Library: channel_convert</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
<link href="doxygen-boost.css" rel="stylesheet" type="text/css"/>
|
|
</head>
|
|
<body>
|
|
<div class="boost-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="Boost GIL" src="../_static/gil.png" border="0"></a></h3>
|
|
</td>
|
|
<td ><h1 align="center"><a href="../index.html"></a></h1></td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<hr/>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<!-- Generated by Doxygen 1.9.8 -->
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(function() {
|
|
initMenu('',false,false,'search.php','Search');
|
|
});
|
|
/* @license-end */
|
|
</script>
|
|
<div id="main-nav"></div>
|
|
</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 another.
|
|
<a href="#details">More...</a></p>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="groups" name="groups"></a>
|
|
Modules</h2></td></tr>
|
|
<tr class="memitem:group___channel_convert_unsigned_algorithm" id="r_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 id="nested-classes" 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 id="func-members" name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr class="memitem:gaedf6a65199e8c8a58ed23f00400753bf" id="r_gaedf6a65199e8c8a58ed23f00400753bf"><td class="memTemplParams" colspan="2"><a id="gaedf6a65199e8c8a58ed23f00400753bf" name="gaedf6a65199e8c8a58ed23f00400753bf"></a>
|
|
template<typename DstChannel , typename SrcChannel > </td></tr>
|
|
<tr class="memitem:gaedf6a65199e8c8a58ed23f00400753bf"><td class="memTemplItemLeft" align="right" valign="top">auto </td><td class="memTemplItemRight" valign="bottom"><b>channel_convert</b> (SrcChannel const &src) -> typename channel_traits< DstChannel >::value_type</td></tr>
|
|
<tr class="memdesc:gaedf6a65199e8c8a58ed23f00400753bf"><td class="mdescLeft"> </td><td class="mdescRight">Converting from one channel type to another. <br /></td></tr>
|
|
<tr class="separator:gaedf6a65199e8c8a58ed23f00400753bf"><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">// float32_t is a floating point channel with range [0.0f ... 1.0f]</span></div>
|
|
<div class="line"><a class="code hl_typedef" href="group___channel_model.html#gaa70e2f51d4342cd54a28684f20c6135b">float32_t</a> src_channel = channel_traits<float32_t>::max_value();</div>
|
|
<div class="line">assert(src_channel == 1);</div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="comment">// uint8_t is 8-bit unsigned integral channel (aliased from unsigned char)</span></div>
|
|
<div class="line">uint8_t dst_channel = channel_convert<uint8_t>(src_channel);</div>
|
|
<div class="line">assert(dst_channel == 255); <span class="comment">// max value goes to max value</span></div>
|
|
<div class="ttc" id="agroup___channel_model_html_gaa70e2f51d4342cd54a28684f20c6135b"><div class="ttname"><a href="group___channel_model.html#gaa70e2f51d4342cd54a28684f20c6135b">boost::gil::float32_t</a></div><div class="ttdeci">scoped_channel_value< float, float_point_zero< float >, float_point_one< float > > float32_t</div><div class="ttdoc">32-bit floating point channel type with range [0.0f ... 1.0f]. Models ChannelValueConcept</div><div class="ttdef"><b>Definition</b> typedefs.hpp:153</div></div>
|
|
</div><!-- fragment --> </div><!-- contents -->
|
|
<!-- HTML footer for doxygen 1.8.13-->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/>
|
|
<address class="footer">
|
|
<small>
|
|
Generated by  <a href="http://www.doxygen.org/index.html">doxygen</a> 1.9.8
|
|
</small>
|
|
</address>
|
|
</body>
|
|
</html>
|