⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gifimage.html

📁 java对GIF的编解码工具,有完整的说明和例子
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2_04) on Wed Dec 15 18:51:46 EET 2004 -->
<TITLE>
GifImage
</TITLE>

<META NAME="keywords" CONTENT="com.gif4j.light.GifImage class">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    parent.document.title="GifImage";
}
</SCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">

<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/GifImage.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../com/gif4j/light/GifFrame.html" title="class in com.gif4j.light"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../com/gif4j/light/ImageUtils.html" title="class in com.gif4j.light"><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>  &nbsp;
&nbsp;<A HREF="GifImage.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.gif4j.light</FONT>
<BR>
Class GifImage</H2>
<PRE>
java.lang.Object
  <IMG SRC="../../../resources/inherit.gif" ALT="extended by"><B>com.gif4j.light.GifImage</B>
</PRE>
<HR>
<DL>
<DT>public class <B>GifImage</B><DT>extends java.lang.Object</DL>

<P>
<p> An instance of this java class is used to represent a gif image as a sequence of one or more frames (instances of <code>GifFrame</code> class) and to contain the next general gif specific parameters: <li> Logical Screen Descriptor - The Logical Screen Descriptor contains the parameters necessary to define the area of the display device within which the images will be rendered.  The coordinates in this block are given with respect to the top-left corner of the virtual screen; they do not necessarily refer to absolute coordinates on the display device.  This implies that they could refer to window coordinates in a window-based environment or printer coordinates when a printer is used.<br> The logical screen area should be large enough to display all of your individual frames in it. If an image in the GIF file is larger than the logical screen or, by its positioning, extends beyond the screen, the portion that is off-screen will not be displayed. </li> <li> Global Color Table (global palette, optional field) - This palette can have 2, 4, 8, 16, 32, 64, 128 , or 256 defined colors. Palettes are very important. Every color displayed in your GIF must come from a palette. The fewer colors used, the easier it will be for systems to display your images. The global palette is applied to all images in a GIF file. If an individual images differs greatly from that global palette, it may have a local palette that affects its color ONLY. However, no image can every reference more than one palette, so 256 colors per image is the max. <br> Gif4J doesn't calculate and use global color table by default. To receive better quality every added <code>GifFrame</code> has his own Local Color Table, but to optimize final image size (every Local Color Table takes up to 768 bytes) you can force Global Color Table usage (see <A HREF="../../../com/gif4j/light/GifEncoder.html#encode(com.gif4j.light.GifImage, java.io.OutputStream, boolean)"><CODE>GifEncoder.encode(com.gif4j.light.GifImage gifImage, java.io.OutputStream outputStream, boolean forceGlobalColorTableUsage)</CODE></A>). In this case local color tables will be union to global color table. This feature is recommended to use for images with a lot of <code>GifFrames</code>. </li> <li> Loop Extension - gif image can have an Application Extension Block that tells Encoder to loop the entire GIF file. </li> <li> Comments - gif image can have a plenty of embedded ASCII text comments. </li> </p> <p> To add new frame the next method should be used:<br> <A HREF="../../../com/gif4j/light/GifImage.html#addGifFrame(com.gif4j.light.GifFrame)"><CODE>addGifFrame(com.gif4j.light.GifFrame frame)</CODE></A> </p> <p><code>GifImage</code> is also used to control the next general parameters: <li>final image size by provided 'resize strategy' parameter:<br> <A HREF="../../../com/gif4j/light/GifImage.html#RESIZE_STRATEGY_CROP_TO_FIT_IMAGE_SIZE"><CODE>RESIZE_STRATEGY_CROP_TO_FIT_IMAGE_SIZE</CODE></A>,<br> <A HREF="../../../com/gif4j/light/GifImage.html#RESIZE_STRATEGY_SCALE_TO_FIT_IMAGE_SIZE"><CODE>RESIZE_STRATEGY_SCALE_TO_FIT_IMAGE_SIZE</CODE></A>,<br> <A HREF="../../../com/gif4j/light/GifImage.html#RESIZE_STRATEGY_EXTEND_TO_CURRENT"><CODE>RESIZE_STRATEGY_EXTEND_TO_CURRENT</CODE></A><br> 'resize strategy' parameter can be set by using the next constructors: <A HREF="../../../com/gif4j/light/GifImage.html#GifImage(int)"><CODE>GifImage(int resizeStrategy)</CODE></A>,<br> <A HREF="../../../com/gif4j/light/GifImage.html#GifImage(int, int, int)"><CODE>GifImage(int width, int height, int resizeStrategy)</CODE></A> </li> <li> general delay between image frames:<br> <A HREF="../../../com/gif4j/light/GifImage.html#setDefaultDelay(int)"><CODE>setDefaultDelay(int delay)</CODE></A><br> </li> <li> number of iterations the gif animation loop should be executed:<br> <A HREF="../../../com/gif4j/light/GifImage.html#setLoopNumber(int)"><CODE>setLoopNumber(int number)</CODE></A><br> </li> </p> <p> <b>Hint</b>: Use <A HREF="../../../com/gif4j/light/GifEncoder.html" title="class in com.gif4j.light"><CODE>GifEncoder</CODE></A> java class to encode and save <A HREF="../../../com/gif4j/light/GifImage.html" title="class in com.gif4j.light"><CODE>GifImage</CODE></A>(-s) into the GIF89a image file format to output streams and files.<br> </p>
<P>

<P>
<DL>
<DT><B>Version:</B></DT>  <DD>1.0</DD><DT><B>Author:</B></DT>  <DD><a href="http://www.gif4j.com">Gif4J Software - Java GIF image processing solutions</a></DD><DT><B>See Also:</B><DD><CODE>Image</CODE>, <A HREF="../../../com/gif4j/light/GifFrame.html" title="class in com.gif4j.light"><CODE>GifFrame</CODE></A>, <A HREF="../../../com/gif4j/light/GifEncoder.html" title="class in com.gif4j.light"><CODE>GifEncoder</CODE></A></DL>
<HR>

<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->


<!-- =========== FIELD SUMMARY =========== -->

<A NAME="field_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<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>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/gif4j/light/GifImage.html#RESIZE_STRATEGY_CROP_TO_FIT_IMAGE_SIZE">RESIZE_STRATEGY_CROP_TO_FIT_IMAGE_SIZE</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents a resize strategy, when every subsequent image frame is necessarily resized by cropping to fit the fixed logical screen size.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/gif4j/light/GifImage.html#RESIZE_STRATEGY_EXTEND_TO_CURRENT">RESIZE_STRATEGY_EXTEND_TO_CURRENT</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents a resize strategy, when logical screen width and height are necessarily extended to support the adding frame's size.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/gif4j/light/GifImage.html#RESIZE_STRATEGY_SCALE_TO_FIT_IMAGE_SIZE">RESIZE_STRATEGY_SCALE_TO_FIT_IMAGE_SIZE</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents a resize strategy, when every subsequent image frame is necessarily resized by scaling to fit the fixed logical screen size.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<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/gif4j/light/GifImage.html#GifImage()">GifImage</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs <code>GifImage</code> with <A HREF="../../../com/gif4j/light/GifImage.html#RESIZE_STRATEGY_EXTEND_TO_CURRENT"><CODE>RESIZE_STRATEGY_EXTEND_TO_CURRENT</CODE></A>&nbsp;resize&nbsp;strategy and indefinite general gif image width and height (these parameters will be taken from the first added <code>GifFrame</code>).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../com/gif4j/light/GifImage.html#GifImage(int)">GifImage</A></B>(int&nbsp;resizeStrategy)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs <code>GifImage</code> of one of the predefined resize strategies and indefinite logical screen width and height (these parameters will be taken from the first added <code>GifFrame</code>).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../com/gif4j/light/GifImage.html#GifImage(int, int)">GifImage</A></B>(int&nbsp;width,         int&nbsp;height)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs <code>GifImage</code> with <A HREF="../../../com/gif4j/light/GifImage.html#RESIZE_STRATEGY_SCALE_TO_FIT_IMAGE_SIZE"><CODE>RESIZE_STRATEGY_SCALE_TO_FIT_IMAGE_SIZE</CODE></A>&nbsp;resize&nbsp;strategy and the specified general logical screen width and height. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../com/gif4j/light/GifImage.html#GifImage(int, int, int)">GifImage</A></B>(int&nbsp;width,         int&nbsp;height,         int&nbsp;resizeStrategy)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs <code>GifImage</code> of one of the predefined resize strategies and general logical screen width and height. </TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<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>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/gif4j/light/GifImage.html#addComment(java.lang.String)">addComment</A></B>(java.lang.String&nbsp;comment)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Add ASCII textual comment to be embedded in this GIF image.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../com/gif4j/light/GifImage.html" title="class in com.gif4j.light">GifImage</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/gif4j/light/GifImage.html#addGifFrame(com.gif4j.light.GifFrame)">addGifFrame</A></B>(<A HREF="../../../com/gif4j/light/GifFrame.html" title="class in com.gif4j.light">GifFrame</A>&nbsp;frame)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Add the specified frame to the end of the internal sequence.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/gif4j/light/GifImage.html#getCurrentLogicHeight()">getCurrentLogicHeight</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;get current logic screen height</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/gif4j/light/GifImage.html#getCurrentLogicWidth()">getCurrentLogicWidth</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;get current logic screen width</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../com/gif4j/light/GifFrame.html" title="class in com.gif4j.light">GifFrame</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/gif4j/light/GifImage.html#getLastFrame()">getLastFrame</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the last added frame</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/gif4j/light/GifImage.html#setDefaultDelay(int)">setDefaultDelay</A></B>(int&nbsp;delay)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set default delay between frames. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/gif4j/light/GifImage.html#setLoopNumber(int)">setLoopNumber</A></B>(int&nbsp;number)</CODE>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -