?? pngencoder.html
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Sun Oct 19 10:04:44 PDT 2003 --><TITLE>PngEncoder</TITLE><META NAME="keywords" CONTENT="com.keypoint.PngEncoder,PngEncoder class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><SCRIPT>function asd(){parent.document.title="PngEncoder";}</SCRIPT><BODY BGCOLOR="white" onload="asd();"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> PREV CLASS <A HREF="../../com/keypoint/PngEncoderB.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="PngEncoder.html" TARGET="_top"><B>NO FRAMES</B></A> <SCRIPT> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT><A HREF="../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">com.keypoint</FONT><BR>Class PngEncoder</H2><PRE>java.lang.Object | +--<B>com.keypoint.PngEncoder</B></PRE><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../com/keypoint/PngEncoderB.html">PngEncoderB</A></DD></DL><HR><DL><DT>public class <B>PngEncoder</B><DT>extends java.lang.Object</DL><P>PngEncoder takes a Java Image object and creates a byte string which can be saved as a PNG file. The Image is presumed to use the DirectColorModel. <p>Thanks to Jay Denny at KeyPoint Software http://www.keypoint.com/ who let me develop this code on company time.</p> <p>You may contact me with (probably very-much-needed) improvements, comments, and bug fixes at:</p> <p><code>david@catcode.com</code></p> <p>This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.</p> <p>This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</p> <p>You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA A copy of the GNU LGPL may be found at <code>http://www.gnu.org/copyleft/lesser.html</code></p><P><P><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#bytePos">bytePos</A></B></CODE><BR> The byte position.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#bytesPerPixel">bytesPerPixel</A></B></CODE><BR> The bytes-per-pixel.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#compressionLevel">compressionLevel</A></B></CODE><BR> The compression level.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected java.util.zip.CRC32</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#crc">crc</A></B></CODE><BR> CRC.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected long</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#crcValue">crcValue</A></B></CODE><BR> The CRC value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#ENCODE_ALPHA">ENCODE_ALPHA</A></B></CODE><BR> Constant specifying that alpha channel should be encoded.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#encodeAlpha">encodeAlpha</A></B></CODE><BR> Encode alpha?</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#filter">filter</A></B></CODE><BR> The filter type.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#FILTER_LAST">FILTER_LAST</A></B></CODE><BR> Constants for filter (LAST)</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#FILTER_NONE">FILTER_NONE</A></B></CODE><BR> Constants for filter (NONE)</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#FILTER_SUB">FILTER_SUB</A></B></CODE><BR> Constants for filter (SUB)</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#FILTER_UP">FILTER_UP</A></B></CODE><BR> Constants for filter (UP)</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#height">height</A></B></CODE><BR> The width.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected static byte[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#IDAT">IDAT</A></B></CODE><BR> IDAT tag.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected static byte[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#IEND">IEND</A></B></CODE><BR> IEND tag.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected static byte[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#IHDR">IHDR</A></B></CODE><BR> IHDR tag.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected java.awt.Image</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#image">image</A></B></CODE><BR> The image.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected byte[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#leftBytes">leftBytes</A></B></CODE><BR> The left bytes.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#maxPos">maxPos</A></B></CODE><BR> The byte position.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#NO_ALPHA">NO_ALPHA</A></B></CODE><BR> Constant specifying that alpha channel should not be encoded.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected byte[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#pngBytes">pngBytes</A></B></CODE><BR> The png bytes.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected byte[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#priorRow">priorRow</A></B></CODE><BR> The prior row.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#width">width</A></B></CODE><BR> The width.</TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#PngEncoder()">PngEncoder</A></B>()</CODE><BR> Class constructor</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#PngEncoder(java.awt.Image)">PngEncoder</A></B>(java.awt.Image image)</CODE><BR> Class constructor specifying Image to encode, with no alpha channel encoding.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#PngEncoder(java.awt.Image, boolean)">PngEncoder</A></B>(java.awt.Image image, boolean encodeAlpha)</CODE><BR> Class constructor specifying Image to encode, and whether to encode alpha.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#PngEncoder(java.awt.Image, boolean, int)">PngEncoder</A></B>(java.awt.Image image, boolean encodeAlpha, int whichFilter)</CODE><BR> Class constructor specifying Image to encode, whether to encode alpha, and filter to use.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#PngEncoder(java.awt.Image, boolean, int, int)">PngEncoder</A></B>(java.awt.Image image, boolean encodeAlpha, int whichFilter, int compLevel)</CODE><BR> Class constructor specifying Image source to encode, whether to encode alpha, filter to use, and compression level.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#filterSub(byte[], int, int)">filterSub</A></B>(byte[] pixels, int startPos, int width)</CODE><BR> Perform "sub" filtering on the given row.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#filterUp(byte[], int, int)">filterUp</A></B>(byte[] pixels, int startPos, int width)</CODE><BR> Perform "up" filtering on the given row.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#getCompressionLevel()">getCompressionLevel</A></B>()</CODE><BR> Retrieve compression level</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#getEncodeAlpha()">getEncodeAlpha</A></B>()</CODE><BR> Retrieve alpha encoding status.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#getFilter()">getFilter</A></B>()</CODE><BR> Retrieve filtering scheme</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> byte[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../com/keypoint/PngEncoder.html#pngEncode()">pngEncode</A></B>()</CODE><BR> Creates an array of bytes that is the PNG equivalent of the current image.</TD></TR>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -