Files
pj2/doc/edu/rit/image/GrayPngWriter.html
2016-04-27 01:07:35 -04:00

351 lines
17 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_51) on Wed Apr 06 13:11:03 EDT 2016 -->
<title>GrayPngWriter (Parallel Java 2 Library Documentation)</title>
<meta name="date" content="2016-04-06">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="GrayPngWriter (Parallel Java 2 Library Documentation)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/GrayPngWriter.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../edu/rit/image/GrayImageQueue.html" title="class in edu.rit.image"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../edu/rit/image/ImageQueue.html" title="class in edu.rit.image"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?edu/rit/image/GrayPngWriter.html" target="_top">Frames</a></li>
<li><a href="GrayPngWriter.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">edu.rit.image</div>
<h2 title="Class GrayPngWriter" class="title">Class GrayPngWriter</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>edu.rit.image.GrayPngWriter</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">GrayPngWriter</span>
extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">Class GrayPngWriter provides an object for writing an 8-bit grayscale PNG
image. To write an image:
<OL TYPE=1>
<P><LI>
Create an instance of class GrayPngWriter, specifying the image dimensions
and the output stream to which to write the image.
<P><LI>
Optionally, call the writer's <a href="../../../edu/rit/image/GrayPngWriter.html#setPixelDimensions(int, int, edu.rit.image.PixelUnit)"><code>setPixelDimensions()</code></a> method to set the pixels' physical size. If not
specified, the default is 300&times;300 pixels per inch.
<P><LI>
Call the writer's <a href="../../../edu/rit/image/GrayPngWriter.html#getImageQueue()"><code>getImageQueue()</code></a> method to get the
writer's image queue, which is an instance of class <a href="../../../edu/rit/image/GrayImageQueue.html" title="class in edu.rit.image">GrayImageQueue</a>.
<P><LI>
Generate rows of pixel data and put them into the image queue by calling the
image queue's <a href="../../../edu/rit/image/GrayImageQueue.html#put(int, edu.rit.image.GrayArray)"><code>put()</code></a> method. Each
row of pixel data must be stored in a <a href="../../../edu/rit/image/GrayArray.html" title="class in edu.rit.image">GrayArray</a> whose
length is equal to the number of columns in the image. Each element of the
array specifies the gray level for one pixel. You must call the image queue's
<a href="../../../edu/rit/image/GrayImageQueue.html#put(int, edu.rit.image.GrayArray)"><code>put()</code></a> method once for every row of
pixels in the image. You do not have to put the rows in any particular order.
<P><LI>
Call the writer's <a href="../../../edu/rit/image/GrayPngWriter.html#write()"><code>write()</code></a> method to write the pixel data to
the PNG image.
</OL>
<P>
Steps 4 and 5 can be performed concurrently in separate threads. In Step 4,
multiple threads can put the pixel data rows into the image queue
concurrently.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../edu/rit/image/GrayPngWriter.html#GrayPngWriter(int, int, java.io.OutputStream)">GrayPngWriter</a></strong>(int&nbsp;rows,
int&nbsp;cols,
<a href="http://docs.oracle.com/javase/7/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a>&nbsp;out)</code>
<div class="block">Construct a new grayscale PNG writer.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../edu/rit/image/GrayImageQueue.html" title="class in edu.rit.image">GrayImageQueue</a></code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/image/GrayPngWriter.html#getImageQueue()">getImageQueue</a></strong>()</code>
<div class="block">Returns this grayscale PNG writer's image queue.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/image/GrayPngWriter.html#setPixelDimensions(int, int, edu.rit.image.PixelUnit)">setPixelDimensions</a></strong>(int&nbsp;xPpu,
int&nbsp;yPpu,
<a href="../../../edu/rit/image/PixelUnit.html" title="enum in edu.rit.image">PixelUnit</a>&nbsp;unit)</code>
<div class="block">Set this grayscale PNG writer's physical pixel dimensions to the given
values.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../edu/rit/image/GrayPngWriter.html#write()">write</a></strong>()</code>
<div class="block">Write this grayscale PNG writer's image to the underlying output stream.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="GrayPngWriter(int, int, java.io.OutputStream)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>GrayPngWriter</h4>
<pre>public&nbsp;GrayPngWriter(int&nbsp;rows,
int&nbsp;cols,
<a href="http://docs.oracle.com/javase/7/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a>&nbsp;out)</pre>
<div class="block">Construct a new grayscale PNG writer. The PNG image consists of the given
number of rows and columns. The PNG image will be written to the given
output stream.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>rows</code> - Number of rows. Must be &ge; 1.</dd><dd><code>cols</code> - Number of columns. Must be &ge; 1.</dd><dd><code>out</code> - Output stream.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - (unchecked exception) Thrown if <TT>rows</TT> &lt; 1 or <TT>cols</TT>
&lt; 1.</dd>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - (unchecked exception) Thrown if <TT>out</TT> is null.</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="setPixelDimensions(int, int, edu.rit.image.PixelUnit)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setPixelDimensions</h4>
<pre>public&nbsp;void&nbsp;setPixelDimensions(int&nbsp;xPpu,
int&nbsp;yPpu,
<a href="../../../edu/rit/image/PixelUnit.html" title="enum in edu.rit.image">PixelUnit</a>&nbsp;unit)</pre>
<div class="block">Set this grayscale PNG writer's physical pixel dimensions to the given
values. If not specified, the default is 300&times;300 pixels per inch.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>xPpu</code> - Pixels per unit, X axis.</dd><dd><code>yPpu</code> - Pixels per unit, Y axis.</dd><dd><code>unit</code> - Pixel dimension units.</dd></dl>
</li>
</ul>
<a name="getImageQueue()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getImageQueue</h4>
<pre>public&nbsp;<a href="../../../edu/rit/image/GrayImageQueue.html" title="class in edu.rit.image">GrayImageQueue</a>&nbsp;getImageQueue()</pre>
<div class="block">Returns this grayscale PNG writer's image queue.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Image queue.</dd></dl>
</li>
</ul>
<a name="write()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>write</h4>
<pre>public&nbsp;void&nbsp;write()
throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</a></pre>
<div class="block">Write this grayscale PNG writer's image to the underlying output stream.
The pixel data is obtained from the image queue. The underlying output
stream is closed once the image is written.</div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - Thrown if an I/O error occurred.</dd>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</a></code> - Thrown if the calling thread is interrupted while blocked in this
method.</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/GrayPngWriter.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../edu/rit/image/GrayImageQueue.html" title="class in edu.rit.image"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../edu/rit/image/ImageQueue.html" title="class in edu.rit.image"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?edu/rit/image/GrayPngWriter.html" target="_top">Frames</a></li>
<li><a href="GrayPngWriter.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><FONT SIZE="-2">Copyright &copy; 2013&ndash;2016 by Alan Kaminsky. All rights reserved. Send comments to ark</FONT><FONT SIZE="1" COLOR="#FFFFFF">&shy;</FONT><FONT SIZE="-2">&#64;</FONT><FONT SIZE="1" COLOR="#FFFFFF">&shy;</FONT><FONT SIZE="-2">cs.rit.edu.</FONT></small></p>
</body>
</html>