📄 image acquisition and display.htm
字号:
method. A shortcut is to call the <CODE>setData()</CODE> method, which copies
a rectangular region from a supplied <CODE>Raster</CODE> directly into the
<CODE>TiledImage</CODE>.
<P>A final way to modify the contents of a <CODE>TiledImage</CODE> is through
calls to the <CODE>createGraphics()</CODE> method. This method returns a
<CODE>GraphicsJAI</CODE> object that can be used to draw line art, text, and
images in the usual AWT manner.
<P>A <CODE>TiledImage</CODE> does not attempt to maintain synchronous state on
its own. That task is left to <CODE>SnapshotImage</CODE>. If a synchronous
(unchangeable) view of a <CODE>TiledImage</CODE> is desired, its
<CODE>createSnapshot()</CODE> method must be used. Otherwise, changes due to
calls to <CODE>set()</CODE> or direct writing of tiles by objects that call
<CODE>getWritableTile()</CODE> will be visible.
<P><CODE>TiledImage</CODE> does not actually cause its tiles to be computed
until their contents are demanded. Once a tile has been computed, its contents
may be discarded if it can be determined that it can be recomputed identically
from the source. The <CODE>lockTile()</CODE> method forces a tile to be
computed and maintained for the lifetime of the <CODE>TiledImage</CODE>.
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Image Acquisition and Display.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.TiledImage </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>TiledImage(Point origin, SampleModel sampleModel,
int tileWidth, int tileHeight)
<P></P></LI></UL></PRE>
<DL><A name=52409>
<DT>
<DD>constructs a <CODE>TiledImage</CODE> with a <CODE>SampleModel</CODE>
that is compatible with a given <CODE>SampleModel</CODE>, and given tile
dimensions. The width and height are taken from the
<CODE>SampleModel</CODE>, and the image begins at a specified point.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=4><EM>Parameters</EM>:
<P></P>
<TD><CODE>origin</CODE>
<P></P>
<TD>A Point indicating the image's upper left corner.
<P></P>
<TR vAlign=top>
<TD><CODE>sampleModel</CODE>
<P></P>
<TD>A SampleModel with which to be compatible.
<P></P>
<TR vAlign=top>
<TD><CODE>tileWidth</CODE>
<P></P>
<TD>The desired tile width.
<P></P>
<TR vAlign=top>
<TD><CODE>tileHeight</CODE>
<P></P>
<TD>The desired tile height.
<P></P></TR></TBODY></TABLE>
<P></A>
<P></P></DD></DL><PRE><UL>
<LI>TiledImage(SampleModel sampleModel, int tileWidth,
int tileHeight)
<P></P></LI></UL></PRE>
<DL><A name=52524>
<DT>
<DD>constructs a <CODE>TiledImage</CODE> starting at the global coordinate
origin.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=3><EM>Parameters</EM>:
<P></P>
<TD><CODE>sampleModel</CODE>
<P></P>
<TD>A <CODE>SampleModel</CODE> with which to be compatible.
<P></P>
<TR vAlign=top>
<TD><CODE>tileWidth</CODE>
<P></P>
<TD>The desired tile width.
<P></P>
<TR vAlign=top>
<TD><CODE>tileHeight</CODE>
<P></P>
<TD>The desired tile height.
<P></P></TR></TBODY></TABLE>
<P></A>
<P></P></DD></DL><PRE><UL>
<LI>TiledImage(int minX, int minY, int width, int height,
int tileGridXOffset, int tileGridYOffset,
SampleModel sampleModel, ColorModel colorModel)
<P></P></LI></UL></PRE>
<DL><A name=54010>
<DT>
<DD>constructs a <CODE>TiledImage</CODE> of a specified width and height.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=8><EM>Parameters</EM>:
<P></P>
<TD><CODE>minX</CODE>
<P></P>
<TD>The index of the leftmost column of tiles.
<P></P>
<TR vAlign=top>
<TD><CODE>minY</CODE>
<P></P>
<TD>The index of the uppermost row of tiles.
<P></P>
<TR vAlign=top>
<TD><CODE>width</CODE>
<P></P>
<TD>The width of the <CODE>TiledImage</CODE>.
<P></P>
<TR vAlign=top>
<TD><CODE>height</CODE>
<P></P>
<TD>The height of the <CODE>TiledImage</CODE>.
<P></P>
<TR vAlign=top>
<TD><CODE>tileGridX-Offset</CODE>
<P></P>
<TD>The <EM>x</EM> coordinate of the upper-left pixel of tile (0, 0).
<P></P>
<TR vAlign=top>
<TD><CODE>tileGridY-Offset</CODE>
<P></P>
<TD>The <EM>y</EM> coordinate of the upper-left pixel of tile (0, 0).
<P></P>
<TR vAlign=top>
<TD><CODE>sampleModel</CODE>
<P></P>
<TD>a <CODE>SampleModel</CODE> with which to be compatible.
<P></P>
<TR vAlign=top>
<TD><CODE>colorModel</CODE>
<P></P>
<TD>A <CODE>ColorModel</CODE> to associate with the image.
<P></P></TR></TBODY></TABLE>
<P></A>
<P></P></DD></DL><PRE><UL>
<LI>void setData(Raster r)
<P></P></LI></UL></PRE>
<DL><A name=77626>
<DT>
<DD>sets a region of a <CODE>TiledImage</CODE> to be a copy of a supplied
<CODE>Raster</CODE>. The <CODE>Raster</CODE>'s coordinate system is used to
position it within the image. The computation of all overlapping tiles will
be forced prior to modification of the data of the affected area.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD><EM>Parameter</EM>:<EM></EM>
<P></P>
<TD><CODE>r</CODE>
<P></P>
<TD>A <CODE>Raster</CODE> containing pixels to be copied into the
<CODE>TiledImage</CODE>.
<P></P></TR></TBODY></TABLE>
<P></A>
<P></P></DD></DL><PRE><UL>
<LI>void setData(Raster r, ROI roi)
<P></P></LI></UL></PRE>
<DL><A name=77688>
<DT>
<DD>sets a region of a <CODE>TiledImage</CODE> to be a copy of a supplied
<CODE>Raster</CODE>. The <CODE>Raster</CODE>'s coordinate system is used to
position it within the image. The computation of all overlapping tiles will
be forced prior to modification of the data of the affected area. </A>
<P></P></DD></DL><PRE><UL>
<LI>WritableRaster getWritableTile(int tileX, int tileY)
<P></P></LI></UL></PRE>
<DL><A name=52639>
<DT>
<DD>retrieves a particular tile from the image for reading and writing. The
tile will be computed if it hasn't been previously. Writes to the tile will
become visible to readers of this image in the normal Java manner.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=2><EM>Parameters</EM>:
<P></P>
<TD><CODE>tileX</CODE>
<P></P>
<TD>The <EM>x</EM> index of the tile.
<P></P>
<TR vAlign=top>
<TD><CODE>tileY</CODE>
<P></P>
<TD>The <EM>y</EM> index of the tile.
<P></P></TR></TBODY></TABLE>
<P></A>
<P></P></DD></DL><PRE><UL>
<LI>Raster getTile(int tileX, int tileY)
<P></P></LI></UL></PRE>
<DL><A name=52691>
<DT>
<DD>retrieves a particular tile from the image for reading only. The tile
will be computed if it hasn't been previously. Any attempt to write to the
tile will produce undefined results.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=2><EM>Parameters</EM>:
<P></P>
<TD><CODE>tileX</CODE>
<P></P>
<TD>The <EM>x</EM> index of the tile.
<P></P>
<TR vAlign=top>
<TD><CODE>tileY</CODE>
<P></P>
<TD>The <EM>y</EM> index of the tile.
<P></P></TR></TBODY></TABLE>
<P></A>
<P></P></DD></DL><PRE><UL>
<LI>boolean isTileWritable(int tileX, int tileY)
<P></P></LI></UL></PRE>
<DL><A name=52792>
<DT>
<DD>returns true if a tile has writers.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=2><EM>Parameters</EM>:
<P></P>
<TD><CODE>tileX</CODE>
<P></P>
<TD>The <EM>x</EM> index of the tile.
<P></P>
<TR vAlign=top>
<TD><CODE>tileY</CODE>
<P></P>
<TD>The <EM>y</EM> index of the tile.
<P></P></TR></TBODY></TABLE>
<P></A>
<P></P></DD></DL><PRE><UL>
<LI>boolean hasTileWriters()
<P></P></LI></UL></PRE>
<DL><A name=52825>
<DT>
<DD>returns true if any tile is being held by a writer, false otherwise.
This provides a quick way to check whether it is necessary to make copies of
tiles - if there are no writers, it is safe to use the tiles directly, while
registering to learn of future writers. </A>
<P></P></DD></DL><PRE><UL>
<LI>void releaseWritableTile(int tileX, int tileY)
<P></P></LI></UL></PRE>
<DL><A name=52849>
<DT>
<DD>indicates that a writer is done updating a tile. The effects of
attempting to release a tile that has not been grabbed, or releasing a tile
more than once are undefined.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=2><EM>Parameters</EM>:
<P></P>
<TD><CODE>tileX</CODE>
<P></P>
<TD>The <EM>x</EM> index of the tile.
<P></P>
<TR vAlign=top>
<TD><CODE>tileY</CODE>
<P></P>
<TD>The <EM>y</EM> index of the tile.
<P></P></TR></TBODY></TABLE>
<P></A>
<P></P></DD></DL><PRE><UL>
<LI>void set(RenderedImage im)
<P></P></LI></UL></PRE>
<DL><A name=59584>
<DT>
<DD>overlays a given <CODE>RenderedImage</CODE> on top of the current
contents of the <CODE>TiledImage</CODE>. The source image must have a
<CODE>SampleModel</CODE> compatible with that of this image.
<P>
<TABLE cellPadding=3 border=3>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -