| <!DOCTYPE HTML> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (21) on Thu Oct 05 19:54:57 CEST 2023 --> |
| <title>ImageRenderer (Apache SIS 1.4 API)</title> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="dc.created" content="2023-10-05"> |
| <meta name="description" content="declaration: module: org.apache.sis.feature, package: org.apache.sis.coverage.grid, class: ImageRenderer"> |
| <meta name="generator" content="javadoc/ClassWriterImpl"> |
| <meta name="keywords" content="org.apache.sis.coverage.grid.ImageRenderer class"> |
| <meta name="keywords" content="getNumBands()"> |
| <meta name="keywords" content="getBounds()"> |
| <meta name="keywords" content="getXYDimensions()"> |
| <meta name="keywords" content="getImageGeometry()"> |
| <meta name="keywords" content="getProperty()"> |
| <meta name="keywords" content="addProperty()"> |
| <meta name="keywords" content="setData()"> |
| <meta name="keywords" content="setInterleavedPixelOffsets()"> |
| <meta name="keywords" content="setVisibleBand()"> |
| <meta name="keywords" content="setCategoryColors()"> |
| <meta name="keywords" content="createRaster()"> |
| <meta name="keywords" content="createImage()"> |
| <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../../sis.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../../script-dir/jquery-ui.min.css" title="Style"> |
| <script type="text/javascript" src="../../../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../../../script-dir/jquery-3.6.1.min.js"></script> |
| <script type="text/javascript" src="../../../../../../script-dir/jquery-ui.min.js"></script> |
| </head> |
| <body class="class-declaration-page"> |
| <script type="text/javascript">var pathtoroot = "../../../../../../"; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <div class="flex-box"> |
| <header role="banner" class="flex-header"> |
| <nav role="navigation"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="top-nav" id="navbar-top"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span></button> |
| <div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div> |
| <ul id="navbar-top-firstrow" class="nav-list" title="Navigation"> |
| <li><a href="../../../../../../index.html">Overview</a></li> |
| <li><a href="../../../../../module-summary.html">Module</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="nav-bar-cell1-rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../help-doc.html#class">Help</a></li> |
| </ul> |
| <ul class="sub-nav-list-small"> |
| <li> |
| <p>Summary:</p> |
| <ul> |
| <li>Nested</li> |
| <li>Field</li> |
| <li><a href="#constructor-summary">Constr</a></li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| </li> |
| <li> |
| <p>Detail:</p> |
| <ul> |
| <li>Field</li> |
| <li><a href="#constructor-detail">Constr</a></li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="sub-nav"> |
| <div id="navbar-sub-list"> |
| <ul class="sub-nav-list"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor-summary">Constr</a> | </li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| <ul class="sub-nav-list"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor-detail">Constr</a> | </li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </div> |
| <div class="nav-list-search"><a href="../../../../../../search.html">SEARCH</a> |
| <input type="text" id="search-input" disabled placeholder="Search"> |
| <input type="reset" id="reset-button" disabled value="reset"> |
| </div> |
| </div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <span class="skip-nav" id="skip-navbar-top"></span></nav> |
| </header> |
| <div class="flex-content"> |
| <main role="main"> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="sub-title"><span class="module-label-in-type">Module</span> <a href="../../../../../module-summary.html">org.apache.sis.feature</a></div> |
| <div class="sub-title"><span class="package-label-in-type">Package</span> <a href="package-summary.html">org.apache.sis.coverage.grid</a></div> |
| <h1 title="Class ImageRenderer" class="title">Class ImageRenderer</h1> |
| </div> |
| <div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> |
| <div class="inheritance">ImageRenderer</div> |
| </div> |
| <section class="class-description" id="class-description"> |
| <hr> |
| <div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">ImageRenderer</span> |
| <span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div> |
| <div class="block">A builder for the rendered image to be returned by <a href="GridCoverage.html#render(org.apache.sis.coverage.grid.GridExtent)"><code>GridCoverage.render(GridExtent)</code></a>. |
| This builder does not copy any sample values. Instead, it wraps existing data arrays into |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/Raster.html" title="class or interface in java.awt.image" class="external-link"><code>Raster</code></a> objects by computing required information such as |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/ComponentSampleModel.html#getPixelStride()" title="class or interface in java.awt.image" class="external-link">pixel stride</a>, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/ComponentSampleModel.html#getScanlineStride()" title="class or interface in java.awt.image" class="external-link">scanline stride</a> and |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/ComponentSampleModel.html#getBandOffsets()" title="class or interface in java.awt.image" class="external-link">band offsets</a>. |
| Different <code>setData(…)</code> methods are provided for allowing to specify the data arrays |
| from different objects such as Java2D <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/DataBuffer.html" title="class or interface in java.awt.image" class="external-link"><code>DataBuffer</code></a> or NIO <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/Buffer.html" title="class or interface in java.nio" class="external-link"><code>Buffer</code></a>. |
| |
| <p>All <code>setData(…)</code> methods assume that the first valid element in each array is the value |
| located at <code><a href="GridCoverage.html#getGridGeometry()">GridCoverage.getGridGeometry()</a>.<a href="GridGeometry.html#getExtent()">getExtent()</a>.<a href="GridExtent.html#getLow(int)">getLow()</a></code>. This <code>ImageRenderer</code> class |
| computes automatically the offsets from that position to the position of the first value included |
| in the <code>sliceExtent</code> given to the constructor.</p> |
| |
| <h2 id="usage-example-heading">Usage example</h2> |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java">class MyResource extends GridCoverage { |
| @Override |
| public RenderedImage render(GridExtent sliceExtent) { |
| ImageRenderer renderer = new ImageRenderer(this, sliceExtent); |
| try { |
| renderer.setData(data); |
| return renderer.createImage(); |
| } catch (IllegalArgumentException | ArithmeticException | RasterFormatException e) { |
| throw new CannotEvaluateException("Cannot create an image.", e); |
| } |
| } |
| } |
| </code></pre> |
| </div> |
| |
| |
| <h2 id="limitations-heading">Limitations</h2> |
| Current implementation constructs only images made of a single tile. |
| Support for tiled images will be added in a future version.</div> |
| <dl class="notes"> |
| <dt>Since:</dt> |
| <dd>1.0</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="GridCoverage.html#render(org.apache.sis.coverage.grid.GridExtent)"><code>GridCoverage.render(GridExtent)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| <section class="summary"> |
| <ul class="summary-list"> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <li> |
| <section class="constructor-summary" id="constructor-summary"> |
| <h2>Constructor Summary</h2> |
| <div class="caption"><span>Constructors</span></div> |
| <div class="summary-table two-column-summary"> |
| <div class="table-header col-first">Constructor</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(org.apache.sis.coverage.grid.GridCoverage,org.apache.sis.coverage.grid.GridExtent)" class="member-name-link">ImageRenderer</a><wbr>(<a href="GridCoverage.html" title="class in org.apache.sis.coverage.grid">GridCoverage</a> coverage, |
| <a href="GridExtent.html" title="class in org.apache.sis.coverage.grid">GridExtent</a> sliceExtent)</code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">Creates a new image renderer for the given slice extent.</div> |
| </div> |
| </div> |
| </section> |
| </li> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <li> |
| <section class="method-summary" id="method-summary"> |
| <h2>Method Summary</h2> |
| <div id="method-summary-table"> |
| <div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div> |
| <div id="method-summary-table.tabpanel" role="tabpanel"> |
| <div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Method</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#addProperty(java.lang.String,java.lang.Object)" class="member-name-link">addProperty</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> key, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> value)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Adds a value associated to a property.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/RenderedImage.html" title="class or interface in java.awt.image" class="external-link">RenderedImage</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#createImage()" class="member-name-link">createImage</a>()</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Creates an image with the data specified by the last call to a <code>setData(…)</code> method.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/Raster.html" title="class or interface in java.awt.image" class="external-link">Raster</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#createRaster()" class="member-name-link">createRaster</a>()</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Creates a raster with the data specified by the last call to a <code>setData(…)</code> method.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>final <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Rectangle.html" title="class or interface in java.awt" class="external-link">Rectangle</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getBounds()" class="member-name-link">getBounds</a>()</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns the location of the image upper-left corner together with the image size.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="GridGeometry.html" title="class in org.apache.sis.coverage.grid">GridGeometry</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getImageGeometry(int)" class="member-name-link">getImageGeometry</a><wbr>(int dimCRS)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Computes the conversion from pixel coordinates to CRS, together with the geospatial envelope of the image.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>final int</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getNumBands()" class="member-name-link">getNumBands</a>()</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns the number of bands that the image will have.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getProperty(java.lang.String)" class="member-name-link">getProperty</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> key)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns the value associated to the given property.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>final int[]</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getXYDimensions()" class="member-name-link">getXYDimensions</a>()</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">The dimensions to select in the grid coverage for producing an image.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setCategoryColors(java.util.function.Function)" class="member-name-link">setCategoryColors</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/Function.html" title="class or interface in java.util.function" class="external-link">Function</a><<a href="../Category.html" title="class in org.apache.sis.coverage">Category</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Color.html" title="class or interface in java.awt" class="external-link">Color</a>[]> colors)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Specifies the colors to apply for each category in a sample dimension.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setData(java.awt.image.DataBuffer)" class="member-name-link">setData</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/DataBuffer.html" title="class or interface in java.awt.image" class="external-link">DataBuffer</a> data)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Sets the data as a Java2D buffer.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setData(org.apache.sis.image.DataType,java.nio.Buffer...)" class="member-name-link">setData</a><wbr>(<a href="../../image/DataType.html" title="enum class in org.apache.sis.image">DataType</a> dataType, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/Buffer.html" title="class or interface in java.nio" class="external-link">Buffer</a>... data)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Sets the data as NIO buffers.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setData(org.apache.sis.math.Vector...)" class="member-name-link">setData</a><wbr>(<a href="../../../../../../org.apache.sis.util/org/apache/sis/math/Vector.html" title="class in org.apache.sis.math">Vector</a>... data)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Sets the data as vectors.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setInterleavedPixelOffsets(int,int%5B%5D)" class="member-name-link">setInterleavedPixelOffsets</a><wbr>(int pixelStride, |
| int[] bandOffsets)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Specifies the offsets to add to sample index in each band in order to reach the sample value in the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/DataBuffer.html" title="class or interface in java.awt.image" class="external-link"><code>DataBuffer</code></a> bank.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setVisibleBand(int)" class="member-name-link">setVisibleBand</a><wbr>(int band)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Specifies the band to use for defining pixel colors when the image is displayed on screen.</div> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="inherited-list"> |
| <h3 id="methods-inherited-from-class-Object">Methods inherited from class <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3> |
| <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <section class="details"> |
| <ul class="details-list"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <li> |
| <section class="constructor-details" id="constructor-detail"> |
| <h2>Constructor Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="<init>(org.apache.sis.coverage.grid.GridCoverage,org.apache.sis.coverage.grid.GridExtent)"> |
| <h3>ImageRenderer</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="element-name">ImageRenderer</span><wbr><span class="parameters">(<a href="GridCoverage.html" title="class in org.apache.sis.coverage.grid">GridCoverage</a> coverage, |
| <a href="GridExtent.html" title="class in org.apache.sis.coverage.grid">GridExtent</a> sliceExtent)</span></div> |
| <div class="block">Creates a new image renderer for the given slice extent.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>coverage</code> - the source coverage for which to build an image.</dd> |
| <dd><code>sliceExtent</code> - the domain from which to create an image, or <code>null</code> for the <code>coverage</code> extent.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="../SubspaceNotSpecifiedException.html" title="class in org.apache.sis.coverage">SubspaceNotSpecifiedException</a></code> - if this method cannot infer a two-dimensional slice from <code>sliceExtent</code>.</dd> |
| <dd><code><a href="DisjointExtentException.html" title="class in org.apache.sis.coverage.grid">DisjointExtentException</a></code> - if the given extent does not intersect the given coverage.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ArithmeticException.html" title="class or interface in java.lang" class="external-link">ArithmeticException</a></code> - if a stride calculation overflows the 32 bits integer capacity.</dd> |
| </dl> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| <!-- ============ METHOD DETAIL ========== --> |
| <li> |
| <section class="method-details" id="method-detail"> |
| <h2>Method Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="getNumBands()"> |
| <h3>getNumBands</h3> |
| <div class="member-signature"><span class="modifiers">public final</span> <span class="return-type">int</span> <span class="element-name">getNumBands</span>()</div> |
| <div class="block">Returns the number of bands that the image will have. By default, this is the number of |
| <a href="GridCoverage.html#getSampleDimensions()">sample dimensions</a> in the grid coverage.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>the number of bands in the rendered image.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="getBounds()"> |
| <h3>getBounds</h3> |
| <div class="member-signature"><span class="modifiers">public final</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Rectangle.html" title="class or interface in java.awt" class="external-link">Rectangle</a></span> <span class="element-name">getBounds</span>()</div> |
| <div class="block">Returns the location of the image upper-left corner together with the image size. The image coordinate system |
| is relative to the <code>sliceExtent</code> specified at construction time: the (0,0) pixel coordinates correspond |
| to the <code>sliceExtent</code> <a href="GridExtent.html#getLow(int)">low coordinates</a>. Consequently, the rectangle |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Rectangle.html#x" title="class or interface in java.awt" class="external-link"><var>x</var></a> and <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Rectangle.html#y" title="class or interface in java.awt" class="external-link"><var>y</var></a> coordinates are (0,0) if |
| the image is located exactly in the area requested by <code>sliceExtent</code>, or is shifted as below otherwise: |
| |
| <blockquote>( <var>x</var>, <var>y</var> ) = |
| (grid coordinates of actually provided region) − (grid coordinates of requested region)</blockquote></div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>the rendered image location and size (never null).</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="getXYDimensions()"> |
| <h3>getXYDimensions</h3> |
| <div class="member-signature"><span class="modifiers">public final</span> <span class="return-type">int[]</span> <span class="element-name">getXYDimensions</span>()</div> |
| <div class="block">The dimensions to select in the grid coverage for producing an image. This is the array obtained |
| by <code><a href="GridExtent.html#getSubspaceDimensions(int)"><code>GridExtent.getSubspaceDimensions(2)</code></a></code>. |
| The array content is almost always {0,1}, i.e. the 2 first dimensions in a coordinate tuple.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>indices of <var>x</var> and <var>y</var> coordinate values in a grid coordinate tuple.</dd> |
| <dt>Since:</dt> |
| <dd>1.3</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="getImageGeometry(int)"> |
| <h3>getImageGeometry</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="GridGeometry.html" title="class in org.apache.sis.coverage.grid">GridGeometry</a></span> <span class="element-name">getImageGeometry</span><wbr><span class="parameters">(int dimCRS)</span></div> |
| <div class="block">Computes the conversion from pixel coordinates to CRS, together with the geospatial envelope of the image. |
| The <a href="GridGeometry.html" title="class in org.apache.sis.coverage.grid"><code>GridGeometry</code></a> returned by this method is derived from the <a href="GridCoverage.html#getGridGeometry()">coverage grid geometry</a> with the following changes: |
| |
| <ul> |
| <li>The <a href="GridGeometry.html#getDimension()">number of grid dimensions</a> is always 2.</li> |
| <li>The number of <a href="GridGeometry.html#getCoordinateReferenceSystem()">CRS</a> dimensions |
| is specified by <code>dimCRS</code> (usually 2).</li> |
| <li>The <a href="GridGeometry.html#getEnvelope()">envelope</a> may be a sub-region of the coverage envelope.</li> |
| <li>The <a href="GridGeometry.html#getExtent()">grid extent</a> is the <a href="#getBounds()">image bounds</a>.</li> |
| <li>The <a href="GridGeometry.html#getGridToCRS(org.opengis.referencing.datum.PixelInCell)">grid to CRS</a> transform is derived from the coverage transform |
| with a translation for mapping the <code>sliceExtent</code> <a href="GridExtent.html#getLow(int)">low coordinates</a> |
| to (0,0) pixel coordinates.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>dimCRS</code> - desired number of dimensions in the CRS. This is usually 2.</dd> |
| <dt>Returns:</dt> |
| <dd>conversion from pixel coordinates to CRS of the given number of dimensions, |
| together with image bounds and geospatial envelope if possible.</dd> |
| <dt>Since:</dt> |
| <dd>1.1</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list"> |
| <li><a href="../../image/PlanarImage.html#GRID_GEOMETRY_KEY"><code>PlanarImage.GRID_GEOMETRY_KEY</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="getProperty(java.lang.String)"> |
| <h3>getProperty</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span> <span class="element-name">getProperty</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> key)</span></div> |
| <div class="block">Returns the value associated to the given property. |
| The properties recognized by current implementation are: |
| |
| <ul> |
| <li><a href="../../image/PlanarImage.html#GRID_GEOMETRY_KEY">"org.apache.sis.GridGeometry"</a>.</li> |
| <li><a href="../../image/PlanarImage.html#SAMPLE_DIMENSIONS_KEY">"org.apache.sis.SampleDimensions"</a>.</li> |
| <li>Any property added by calls to <a href="#addProperty(java.lang.String,java.lang.Object)"><code>addProperty(String, Object)</code></a>.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>key</code> - the property for which to get a value.</dd> |
| <dt>Returns:</dt> |
| <dd>value associated to the given property, or <code>null</code> if none.</dd> |
| <dt>Since:</dt> |
| <dd>1.1</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="addProperty(java.lang.String,java.lang.Object)"> |
| <h3>addProperty</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">addProperty</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> key, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> value)</span></div> |
| <div class="block">Adds a value associated to a property. This method can be invoked only once for each <code>key</code>. |
| Those properties will be given to the image created by the <a href="#createImage()"><code>createImage()</code></a> method.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>key</code> - key of the property to set.</dd> |
| <dd><code>value</code> - value to associate to the given key.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if a value is already associated to the given key.</dd> |
| <dt>Since:</dt> |
| <dd>1.1</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="setData(java.awt.image.DataBuffer)"> |
| <h3>setData</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setData</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/DataBuffer.html" title="class or interface in java.awt.image" class="external-link">DataBuffer</a> data)</span></div> |
| <div class="block">Sets the data as a Java2D buffer. The <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/DataBuffer.html#getNumBanks()" title="class or interface in java.awt.image" class="external-link">number of banks</a> |
| in the given buffer must be equal to the <a href="#getNumBands()">expected number of bands</a>. |
| In each bank, the value located at the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/DataBuffer.html#getOffsets()" title="class or interface in java.awt.image" class="external-link">bank offset</a> is the value |
| located at <code><a href="GridCoverage.html#getGridGeometry()">GridCoverage.getGridGeometry()</a>.<a href="GridGeometry.html#getExtent()">getExtent()</a>.<a href="GridExtent.html#getLow(int)">getLow()</a></code>, as specified in class javadoc.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>data</code> - the Java2D buffer containing data for all bands.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if <code>data</code> is null.</dd> |
| <dd><code><a href="../MismatchedCoverageRangeException.html" title="class in org.apache.sis.coverage">MismatchedCoverageRangeException</a></code> - if the given data buffer does not have the expected amount of banks.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="setData(org.apache.sis.image.DataType,java.nio.Buffer...)"> |
| <h3>setData</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setData</span><wbr><span class="parameters">(<a href="../../image/DataType.html" title="enum class in org.apache.sis.image">DataType</a> dataType, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/Buffer.html" title="class or interface in java.nio" class="external-link">Buffer</a>... data)</span></div> |
| <div class="block">Sets the data as NIO buffers. The number of buffers must be equal to the <a href="#getNumBands()">expected |
| number of bands</a>. All buffers must be <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/Buffer.html#array()" title="class or interface in java.nio" class="external-link">backed by arrays</a> of the type specified by |
| the <code>dataType</code> argument and have the same amount of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/Buffer.html#remaining()" title="class or interface in java.nio" class="external-link">remaining elements</a>. |
| This method wraps the underlying arrays of a primitive type into a Java2D buffer; data are not copied. |
| For each buffer, the grid coverage data (not only the slice data) starts at <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/Buffer.html#position()" title="class or interface in java.nio" class="external-link">buffer position</a> and ends at that position + <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/Buffer.html#remaining()" title="class or interface in java.nio" class="external-link">remaining</a>. |
| |
| <p>The data type must be specified in order to distinguish between the signed and unsigned types. |
| <a href="../../image/DataType.html#BYTE"><code>DataType.BYTE</code></a> and <a href="../../image/DataType.html#USHORT"><code>DataType.USHORT</code></a> are unsigned, all other supported types are signed.</p> |
| |
| <p><b>Implementation note:</b> the Java2D buffer is set by a call to <a href="#setData(java.awt.image.DataBuffer)"><code>setData(DataBuffer)</code></a>, |
| which can be overridden by subclasses if desired.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>dataType</code> - type of data.</dd> |
| <dd><code>data</code> - the buffers wrapping arrays of primitive type.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if <code>data</code> is null or one of <code>data</code> element is null.</dd> |
| <dd><code><a href="../MismatchedCoverageRangeException.html" title="class in org.apache.sis.coverage">MismatchedCoverageRangeException</a></code> - if the number of specified buffers is not equal to the number of bands.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/UnsupportedOperationException.html" title="class or interface in java.lang" class="external-link">UnsupportedOperationException</a></code> - if a buffer is not backed by an accessible array or is read-only.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ArrayStoreException.html" title="class or interface in java.lang" class="external-link">ArrayStoreException</a></code> - if a buffer type is incompatible with <code>dataType</code>.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/RasterFormatException.html" title="class or interface in java.awt.image" class="external-link">RasterFormatException</a></code> - if buffers do not have the same amount of remaining values.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ArithmeticException.html" title="class or interface in java.lang" class="external-link">ArithmeticException</a></code> - if a buffer position overflows the 32 bits integer capacity.</dd> |
| <dt>Since:</dt> |
| <dd>1.1</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="setData(org.apache.sis.math.Vector...)"> |
| <h3>setData</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setData</span><wbr><span class="parameters">(<a href="../../../../../../org.apache.sis.util/org/apache/sis/math/Vector.html" title="class in org.apache.sis.math">Vector</a>... data)</span></div> |
| <div class="block">Sets the data as vectors. The number of vectors must be equal to the <a href="#getNumBands()">expected number of bands</a>. |
| All vectors must be backed by arrays (indirectly, through <a href="../../../../../../org.apache.sis.util/org/apache/sis/math/Vector.html#buffer()">buffers</a> backed by arrays) and have |
| the same <a href="../../../../../../org.apache.sis.util/org/apache/sis/math/Vector.html#size()">size</a>. |
| This method wraps the underlying arrays of a primitive type into a Java2D buffer; data are not copied. |
| |
| <p><b>Implementation note:</b> the NIO buffers are set by a call to <a href="#setData(org.apache.sis.image.DataType,java.nio.Buffer...)"><code>setData(DataType, Buffer...)</code></a>, |
| which can be overridden by subclasses if desired.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>data</code> - the vectors wrapping arrays of primitive type.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if <code>data</code> is null or one of <code>data</code> element is null.</dd> |
| <dd><code><a href="../MismatchedCoverageRangeException.html" title="class in org.apache.sis.coverage">MismatchedCoverageRangeException</a></code> - if the number of specified vectors is not equal to the number of bands.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/UnsupportedOperationException.html" title="class or interface in java.lang" class="external-link">UnsupportedOperationException</a></code> - if a vector is not backed by an accessible array or is read-only.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/RasterFormatException.html" title="class or interface in java.awt.image" class="external-link">RasterFormatException</a></code> - if vectors do not have the same size.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ArithmeticException.html" title="class or interface in java.lang" class="external-link">ArithmeticException</a></code> - if a buffer position overflows the 32 bits integer capacity.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="setInterleavedPixelOffsets(int,int[])"> |
| <h3>setInterleavedPixelOffsets</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setInterleavedPixelOffsets</span><wbr><span class="parameters">(int pixelStride, |
| int[] bandOffsets)</span></div> |
| <div class="block">Specifies the offsets to add to sample index in each band in order to reach the sample value in the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/DataBuffer.html" title="class or interface in java.awt.image" class="external-link"><code>DataBuffer</code></a> bank. |
| This method should be invoked when the data given to <code>setData(…)</code> contains only one <a href="../../../../../../org.apache.sis.util/org/apache/sis/math/Vector.html" title="class in org.apache.sis.math"><code>Vector</code></a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/Buffer.html" title="class or interface in java.nio" class="external-link"><code>Buffer</code></a> or |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/DataBuffer.html" title="class or interface in java.awt.image" class="external-link"><code>DataBuffer</code></a> bank, and the bands in that unique bank are interleaved. |
| |
| <h4 id="example-heading">Example</h4> |
| For an image having three bands named Red (R), Green (G) and Blue (B), if the sample values are stored in a single bank in a |
| R₀,G₀,B₀, R₁,G₁,B₁, R₂,G₂,B₂, R₃,G₃,B₃, <i>etc.</i> fashion, then this method should be invoked as below: |
| |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java">setInterleavedPixelOffsets(3, new int[] {0, 1, 2}); |
| </code></pre> |
| </div> |
| </div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>pixelStride</code> - the number of data elements between each pixel in the data vector or buffer.</dd> |
| <dd><code>bandOffsets</code> - offsets to add to sample index in each band. This is typically {0, 1, 2, …}. |
| The length of this array shall be equal to <a href="#getNumBands()"><code>getNumBands()</code></a>.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="setVisibleBand(int)"> |
| <h3>setVisibleBand</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setVisibleBand</span><wbr><span class="parameters">(int band)</span></div> |
| <div class="block">Specifies the band to use for defining pixel colors when the image is displayed on screen. |
| All other bands, if any, will exist in the raster but be ignored at display time. |
| The default value is 0, the first (and often only) band. |
| |
| <h4 id="implementation-note-heading">Implementation note</h4> |
| An <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/IndexColorModel.html" title="class or interface in java.awt.image" class="external-link"><code>IndexColorModel</code></a> will be used for displaying the image.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>band</code> - the band to use for display purpose.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if the given band is not between 0 (inclusive) |
| and <a href="#getNumBands()"><code>getNumBands()</code></a> (exclusive).</dd> |
| <dt>Since:</dt> |
| <dd>1.2</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="../../image/Colorizer.Target.html#getVisibleBand()"><code>Colorizer.Target.getVisibleBand()</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="setCategoryColors(java.util.function.Function)"> |
| <h3>setCategoryColors</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="element-name">setCategoryColors</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/Function.html" title="class or interface in java.util.function" class="external-link">Function</a><<a href="../Category.html" title="class in org.apache.sis.coverage">Category</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Color.html" title="class or interface in java.awt" class="external-link">Color</a>[]> colors)</span></div> |
| <div class="block">Specifies the colors to apply for each category in a sample dimension. |
| The given function can return <code>null</code> for unrecognized categories. |
| If this method is never invoked, or if a category is unrecognized, |
| then the default is a grayscale for |
| <a href="../Category.html#isQuantitative()">quantitative categories</a> and |
| transparent for qualitative categories (typically "no data" values). |
| |
| <h4 id="example-heading1">Example</h4> |
| The following code specifies a color palette from blue to red with white in the middle. |
| This is useful for data with a clear 0 (white) in the middle of the range, |
| with a minimal value equals to the negative of the maximal value. |
| |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java">setCategoryColors((category) -> category.isQuantitative() ? new Color[] { |
| Color.BLUE, Color.CYAN, Color.WHITE, Color.YELLOW, Color.RED} : null); |
| </code></pre> |
| </div> |
| </div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>colors</code> - the colors to use for each category. The <code>colors</code> argument cannot be null, |
| but <code>colors.apply(Category)</code> can return null.</dd> |
| <dt>Since:</dt> |
| <dd>1.2</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="createRaster()"> |
| <h3>createRaster</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/Raster.html" title="class or interface in java.awt.image" class="external-link">Raster</a></span> <span class="element-name">createRaster</span>()</div> |
| <div class="block">Creates a raster with the data specified by the last call to a <code>setData(…)</code> method. |
| The raster upper-left corner is located at the position given by <a href="#getBounds()"><code>getBounds()</code></a>. |
| The returned raster is often an instance of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/WritableRaster.html" title="class or interface in java.awt.image" class="external-link"><code>WritableRaster</code></a>, but read-only rasters are also allowed.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>the raster, usually (but not necessarily) an instance of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/WritableRaster.html" title="class or interface in java.awt.image" class="external-link"><code>WritableRaster</code></a>.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalStateException.html" title="class or interface in java.lang" class="external-link">IllegalStateException</a></code> - if no <code>setData(…)</code> method has been invoked before this method call.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/RasterFormatException.html" title="class or interface in java.awt.image" class="external-link">RasterFormatException</a></code> - if a call to a <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/Raster.html" title="class or interface in java.awt.image" class="external-link"><code>Raster</code></a> factory method failed.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ArithmeticException.html" title="class or interface in java.lang" class="external-link">ArithmeticException</a></code> - if a property of the raster to construct exceeds the capacity of 32 bits integers.</dd> |
| <dt>Since:</dt> |
| <dd>1.1</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="createImage()"> |
| <h3>createImage</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/RenderedImage.html" title="class or interface in java.awt.image" class="external-link">RenderedImage</a></span> <span class="element-name">createImage</span>()</div> |
| <div class="block">Creates an image with the data specified by the last call to a <code>setData(…)</code> method. |
| The image upper-left corner is located at the position given by <a href="#getBounds()"><code>getBounds()</code></a>. |
| The two-dimensional <a href="#getImageGeometry(int)">image geometry</a> is stored as |
| a property associated to the <a href="../../image/PlanarImage.html#GRID_GEOMETRY_KEY">"org.apache.sis.GridGeometry"</a> key. |
| The sample dimensions are stored as a property associated to the |
| <a href="../../image/PlanarImage.html#SAMPLE_DIMENSIONS_KEY">"org.apache.sis.SampleDimensions"</a> key. |
| |
| <p>The default implementation returns an instance of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/WritableRenderedImage.html" title="class or interface in java.awt.image" class="external-link"><code>WritableRenderedImage</code></a> |
| if the <a href="#createRaster()"><code>createRaster()</code></a> return value is an instance of <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/WritableRaster.html" title="class or interface in java.awt.image" class="external-link"><code>WritableRaster</code></a>, |
| or a read-only <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/RenderedImage.html" title="class or interface in java.awt.image" class="external-link"><code>RenderedImage</code></a> otherwise.</p></div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>the image.</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalStateException.html" title="class or interface in java.lang" class="external-link">IllegalStateException</a></code> - if no <code>setData(…)</code> method has been invoked before this method call.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/RasterFormatException.html" title="class or interface in java.awt.image" class="external-link">RasterFormatException</a></code> - if a call to a <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/image/Raster.html" title="class or interface in java.awt.image" class="external-link"><code>Raster</code></a> factory method failed.</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ArithmeticException.html" title="class or interface in java.lang" class="external-link">ArithmeticException</a></code> - if a property of the image to construct exceeds the capacity of 32 bits integers.</dd> |
| <dt>Since:</dt> |
| <dd>1.1</dd> |
| </dl> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <!-- ========= END OF CLASS DATA ========= --> |
| </main> |
| </div> |
| </div> |
| </body> |
| </html> |