struct.ImageFormat.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta name="generator" content="rustdoc">
  7. <meta name="description" content="API documentation for the Rust `ImageFormat` struct in crate `ocl`.">
  8. <meta name="keywords" content="rust, rustlang, rust-lang, ImageFormat">
  9. <title>ocl::builders::ImageFormat - Rust</title>
  10. <link rel="stylesheet" type="text/css" href="../../normalize.css">
  11. <link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle">
  12. <link rel="stylesheet" type="text/css" href="../../dark.css">
  13. <link rel="stylesheet" type="text/css" href="../../main.css" id="themeStyle">
  14. <script src="../../storage.js"></script>
  15. </head>
  16. <body class="rustdoc struct">
  17. <!--[if lte IE 8]>
  18. <div class="warning">
  19. This old browser is unsupported and will most likely display funky
  20. things.
  21. </div>
  22. <![endif]-->
  23. <nav class="sidebar">
  24. <div class="sidebar-menu">&#9776;</div>
  25. <p class='location'>Struct ImageFormat</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#fields">Fields</a><div class="sidebar-links"><a href="#structfield.channel_order">channel_order</a><a href="#structfield.channel_data_type">channel_data_type</a></div><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.new">new</a><a href="#method.new_rgba">new_rgba</a><a href="#method.from_raw">from_raw</a><a href="#method.list_from_raw">list_from_raw</a><a href="#method.to_raw">to_raw</a><a href="#method.new_raw">new_raw</a><a href="#method.pixel_bytes">pixel_bytes</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a></div></div><p class='location'><a href='../index.html'>ocl</a>::<wbr><a href='index.html'>builders</a></p><script>window.sidebarCurrent = {name: 'ImageFormat', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div>
  26. </nav>
  27. <div class="theme-picker">
  28. <button id="theme-picker" aria-label="Pick another theme!">
  29. <img src="../../brush.svg" width="18" alt="Pick another theme!">
  30. </button>
  31. <div id="theme-choices"></div>
  32. </div>
  33. <script src="../../theme.js"></script>
  34. <nav class="sub">
  35. <form class="search-form js-only">
  36. <div class="search-container">
  37. <input class="search-input" name="search"
  38. autocomplete="off"
  39. placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
  40. type="search">
  41. </div>
  42. </form>
  43. </nav>
  44. <section id='main' class="content">
  45. <h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>ocl</a>::<wbr><a href='index.html'>builders</a>::<wbr><a class="struct" href=''>ImageFormat</a></span><span class='out-of-band'><span id='render-detail'>
  46. <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
  47. [<span class='inner'>&#x2212;</span>]
  48. </a>
  49. </span><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#788-791' title='goto source code'>[src]</a></span></h1>
  50. <pre class='rust struct'>pub struct ImageFormat {
  51. pub channel_order: <a class="enum" href="../../ocl/enums/enum.ImageChannelOrder.html" title="enum ocl::enums::ImageChannelOrder">ImageChannelOrder</a>,
  52. pub channel_data_type: <a class="enum" href="../../ocl/enums/enum.ImageChannelDataType.html" title="enum ocl::enums::ImageChannelDataType">ImageChannelDataType</a>,
  53. }</pre><div class='docblock'><p>Image format properties used by <code>Image</code>.</p>
  54. <p>A structure that describes format properties of the image to be allocated. (from SDK)</p>
  55. <h1 id="examples-from-sdk" class="section-header"><a href="#examples-from-sdk">Examples (from SDK)</a></h1>
  56. <p>To specify a normalized unsigned 8-bit / channel RGBA image:
  57. image_channel_order = CL_RGBA
  58. image_channel_data_type = CL_UNORM_INT8</p>
  59. <p>image_channel_data_type values of CL_UNORM_SHORT_565, CL_UNORM_SHORT_555
  60. and CL_UNORM_INT_101010 are special cases of packed image formats where
  61. the channels of each element are packed into a single unsigned short or
  62. unsigned int. For these special packed image formats, the channels are
  63. normally packed with the first channel in the most significant bits of the
  64. bitfield, and successive channels occupying progressively less significant
  65. locations. For CL_UNORM_SHORT_565, R is in bits 15:11, G is in bits 10:5
  66. and B is in bits 4:0. For CL_UNORM_SHORT_555, bit 15 is undefined, R is in
  67. bits 14:10, G in bits 9:5 and B in bits 4:0. For CL_UNORM_INT_101010, bits
  68. 31:30 are undefined, R is in bits 29:20, G in bits 19:10 and B in bits
  69. 9:0. OpenCL implementations must maintain the minimum precision specified
  70. by the number of bits in image_channel_data_type. If the image format
  71. specified by image_channel_order, and image_channel_data_type cannot be
  72. supported by the OpenCL implementation, then the call to clCreateImage
  73. will return a NULL memory object.</p>
  74. </div><h2 id='fields' class='fields small-section-header'>
  75. Fields<a href='#fields' class='anchor'></a></h2><span id="structfield.channel_order" class="structfield small-section-header">
  76. <a href="#structfield.channel_order" class="anchor field"></a>
  77. <span id="channel_order.v" class='invisible'>
  78. <code>channel_order: <a class="enum" href="../../ocl/enums/enum.ImageChannelOrder.html" title="enum ocl::enums::ImageChannelOrder">ImageChannelOrder</a></code>
  79. </span></span><span id="structfield.channel_data_type" class="structfield small-section-header">
  80. <a href="#structfield.channel_data_type" class="anchor field"></a>
  81. <span id="channel_data_type.v" class='invisible'>
  82. <code>channel_data_type: <a class="enum" href="../../ocl/enums/enum.ImageChannelDataType.html" title="enum ocl::enums::ImageChannelDataType">ImageChannelDataType</a></code>
  83. </span></span>
  84. <h2 id='methods' class='small-section-header'>
  85. Methods<a href='#methods' class='anchor'></a>
  86. </h2>
  87. <h3 id='impl' class='impl'><span class='in-band'><code>impl <a class="struct" href="../../ocl/builders/struct.ImageFormat.html" title="struct ocl::builders::ImageFormat">ImageFormat</a></code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#793-917' title='goto source code'>[src]</a></span></h3>
  88. <div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>pub fn <a href='#method.new' class='fnname'>new</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;order: <a class="enum" href="../../ocl/enums/enum.ImageChannelOrder.html" title="enum ocl::enums::ImageChannelOrder">ImageChannelOrder</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;data_type: <a class="enum" href="../../ocl/enums/enum.ImageChannelDataType.html" title="enum ocl::enums::ImageChannelDataType">ImageChannelDataType</a><br>) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageFormat.html" title="struct ocl::builders::ImageFormat">ImageFormat</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#794-799' title='goto source code'>[src]</a></span></h4>
  89. <h4 id='method.new_rgba' class="method"><span id='new_rgba.v' class='invisible'><code>pub fn <a href='#method.new_rgba' class='fnname'>new_rgba</a>() -&gt; <a class="struct" href="../../ocl/builders/struct.ImageFormat.html" title="struct ocl::builders::ImageFormat">ImageFormat</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#801-806' title='goto source code'>[src]</a></span></h4>
  90. <h4 id='method.from_raw' class="method"><span id='from_raw.v' class='invisible'><code>pub fn <a href='#method.from_raw' class='fnname'>from_raw</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;fmt_raw: <a class="struct" href="../../cl_sys/cl_h/struct.cl_image_format.html" title="struct cl_sys::cl_h::cl_image_format">cl_image_format</a><br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../../ocl/builders/struct.ImageFormat.html" title="struct ocl::builders::ImageFormat">ImageFormat</a>, <a class="enum" href="../../ocl_core/types/structs/enum.ImageFormatParseError.html" title="enum ocl_core::types::structs::ImageFormatParseError">ImageFormatParseError</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#808-822' title='goto source code'>[src]</a></span></h4>
  91. <h4 id='method.list_from_raw' class="method"><div class="important-traits"><div class='tooltip'>ⓘ<span class='tooltiptext'>Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;</span></div><div class="content hidden"><h3 class="important">Important traits for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;</h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;</span></code></div></div><span id='list_from_raw.v' class='invisible'><code>pub fn <a href='#method.list_from_raw' class='fnname'>list_from_raw</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;list_raw: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../../cl_sys/cl_h/struct.cl_image_format.html" title="struct cl_sys::cl_h::cl_image_format">cl_image_format</a>&gt;<br>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../../ocl/builders/struct.ImageFormat.html" title="struct ocl::builders::ImageFormat">ImageFormat</a>, <a class="enum" href="../../ocl_core/types/structs/enum.ImageFormatParseError.html" title="enum ocl_core::types::structs::ImageFormatParseError">ImageFormatParseError</a>&gt;&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#824-828' title='goto source code'>[src]</a></span></h4>
  92. <h4 id='method.to_raw' class="method"><span id='to_raw.v' class='invisible'><code>pub fn <a href='#method.to_raw' class='fnname'>to_raw</a>(&amp;self) -&gt; <a class="struct" href="../../cl_sys/cl_h/struct.cl_image_format.html" title="struct cl_sys::cl_h::cl_image_format">cl_image_format</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#830-835' title='goto source code'>[src]</a></span></h4>
  93. <h4 id='method.new_raw' class="method"><span id='new_raw.v' class='invisible'><code>pub fn <a href='#method.new_raw' class='fnname'>new_raw</a>() -&gt; <a class="struct" href="../../cl_sys/cl_h/struct.cl_image_format.html" title="struct cl_sys::cl_h::cl_image_format">cl_image_format</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#837-842' title='goto source code'>[src]</a></span></h4>
  94. <h4 id='method.pixel_bytes' class="method"><span id='pixel_bytes.v' class='invisible'><code>pub fn <a href='#method.pixel_bytes' class='fnname'>pixel_bytes</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#853-916' title='goto source code'>[src]</a></span></h4>
  95. <div class='docblock'><p>Returns the size in bytes of a pixel using the format specified by this
  96. <code>ImageFormat</code>.</p>
  97. <p>TODO: Add a special case for Depth &amp; DepthStencil
  98. (https://www.khronos.org/registry/cl/sdk/2.0/docs/man/xhtml/cl_khr_gl_depth_images.html).</p>
  99. <p>TODO: Validate combinations.
  100. TODO: Use <code>core::get_image_info</code> to check these with a test.</p>
  101. </div></div>
  102. <h2 id='implementations' class='small-section-header'>
  103. Trait Implementations<a href='#implementations' class='anchor'></a>
  104. </h2>
  105. <h3 id='impl-Clone' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../../ocl/builders/struct.ImageFormat.html" title="struct ocl::builders::ImageFormat">ImageFormat</a></code><a href='#impl-Clone' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#787' title='goto source code'>[src]</a></span></h3>
  106. <div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="struct" href="../../ocl/builders/struct.ImageFormat.html" title="struct ocl::builders::ImageFormat">ImageFormat</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#787' title='goto source code'>[src]</a></span></h4>
  107. <div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
  108. </div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#112-114' title='goto source code'>[src]</a></span></h4>
  109. <div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
  110. </div></div><h3 id='impl-Debug' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../../ocl/builders/struct.ImageFormat.html" title="struct ocl::builders::ImageFormat">ImageFormat</a></code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#787' title='goto source code'>[src]</a></span></h3>
  111. <div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, __arg_0: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/ocl_core/types/structs.rs.html#787' title='goto source code'>[src]</a></span></h4>
  112. <div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
  113. </div></div></section>
  114. <section id='search' class="content hidden"></section>
  115. <section class="footer"></section>
  116. <aside id="help" class="hidden">
  117. <div>
  118. <h1 class="hidden">Help</h1>
  119. <div class="shortcuts">
  120. <h2>Keyboard Shortcuts</h2>
  121. <dl>
  122. <dt><kbd>?</kbd></dt>
  123. <dd>Show this help dialog</dd>
  124. <dt><kbd>S</kbd></dt>
  125. <dd>Focus the search field</dd>
  126. <dt><kbd>↑</kbd></dt>
  127. <dd>Move up in search results</dd>
  128. <dt><kbd>↓</kbd></dt>
  129. <dd>Move down in search results</dd>
  130. <dt><kbd>↹</kbd></dt>
  131. <dd>Switch tab</dd>
  132. <dt><kbd>&#9166;</kbd></dt>
  133. <dd>Go to active search result</dd>
  134. <dt><kbd>+</kbd></dt>
  135. <dd>Expand all sections</dd>
  136. <dt><kbd>-</kbd></dt>
  137. <dd>Collapse all sections</dd>
  138. </dl>
  139. </div>
  140. <div class="infos">
  141. <h2>Search Tricks</h2>
  142. <p>
  143. Prefix searches with a type followed by a colon (e.g.
  144. <code>fn:</code>) to restrict the search to a given type.
  145. </p>
  146. <p>
  147. Accepted types are: <code>fn</code>, <code>mod</code>,
  148. <code>struct</code>, <code>enum</code>,
  149. <code>trait</code>, <code>type</code>, <code>macro</code>,
  150. and <code>const</code>.
  151. </p>
  152. <p>
  153. Search functions by type signature (e.g.
  154. <code>vec -> usize</code> or <code>* -> vec</code>)
  155. </p>
  156. </div>
  157. </div>
  158. </aside>
  159. <script>
  160. window.rootPath = "../../";
  161. window.currentCrate = "ocl";
  162. </script>
  163. <script src="../../main.js"></script>
  164. <script defer src="../../search-index.js"></script>
  165. </body>
  166. </html>