- 所有已知的实现类:
-
AbstractButton,AbstractColorChooserPanel,Applet,BasicArrowButton,BasicComboBoxRenderer,BasicComboBoxRenderer.UIResource,BasicComboPopup,BasicInternalFrameTitlePane,BasicInternalFrameTitlePane.SystemMenuBar,BasicSplitPaneDivider,BasicToolBarUI.DragWindow,Box,Box.Filler,Button,Canvas,CellRendererPane,Checkbox,Choice,Component,Container,DefaultListCellRenderer,DefaultListCellRenderer.UIResource,DefaultTableCellRenderer,DefaultTableCellRenderer.UIResource,DefaultTreeCellEditor.DefaultTextField,DefaultTreeCellEditor.EditorContainer,DefaultTreeCellRenderer,Dialog,FileDialog,Frame,JApplet,JButton,JCheckBox,JCheckBoxMenuItem,JColorChooser,JComboBox,JComponent,JDesktopPane,JDialog,JEditorPane,JFileChooser,JFormattedTextField,JFrame,JInternalFrame,JInternalFrame.JDesktopIcon,JLabel,JLayer,JLayeredPane,JList,JMenu,JMenuBar,JMenuItem,JOptionPane,JPanel,JPasswordField,JPopupMenu,JPopupMenu.Separator,JProgressBar,JRadioButton,JRadioButtonMenuItem,JRootPane,JScrollBar,JScrollPane,JScrollPane.ScrollBar,JSeparator,JSlider,JSpinner,JSpinner.DateEditor,JSpinner.DefaultEditor,JSpinner.ListEditor,JSpinner.NumberEditor,JSplitPane,JTabbedPane,JTable,JTableHeader,JTextArea,JTextComponent,JTextField,JTextPane,JToggleButton,JToolBar,JToolBar.Separator,JToolTip,JTree,JViewport,JWindow,Label,List,MetalComboBoxButton,MetalComboBoxUI.MetalComboPopup,MetalFileChooserUI.FileRenderer,MetalFileChooserUI.FilterComboBoxRenderer,MetalInternalFrameTitlePane,MetalScrollButton,Panel,Scrollbar,ScrollPane,TextArea,TextComponent,TextField,Window
public interface ImageObserver
用于接收有关图像信息的异步更新接口,当图像被构建时会收到通知。
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intimageUpdate中infoflags参数中的标志,指示异步跟踪的图像在生成完成之前被中止。static final intinfoflags参数中的此标志表示先前绘制的静态图像现在已完成,可以以最终形式再次绘制。static final intinfoflags参数中的此标志表示正在异步跟踪的图像遇到错误。static final intinfoflags参数中的此标志表示先前绘制的多帧图像的另一个完整帧现在可用于再次绘制。static final intinfoflags参数中的此标志表示基本图像的高度现在可用,并且可以从imageUpdate回调方法的height参数中获取。static final intinfoflags参数中的此标志表示图像的属性现在可用。static final intinfoflags参数中的此标志表示用于绘制图像的缩放变体所需的更多像素现已可用。static final intinfoflags参数中的此标志表示基本图像的宽度现在可用,并且可以从imageUpdate回调方法的width参数中获取。 -
Method Summary
Modifier and TypeMethodDescriptionbooleanimageUpdate(Image img, int infoflags, int x, int y, int width, int height) 当有关先前使用异步接口请求的图像的信息变得可用时,将调用此方法。
-
Field Details
-
WIDTH
static final int WIDTHinfoflags参数中的此标志表示基本图像的宽度现在可用,并且可以从imageUpdate回调方法的width参数中获取。- 参见:
-
HEIGHT
static final int HEIGHTinfoflags参数中的此标志表示基本图像的高度现在可用,并且可以从imageUpdate回调方法的height参数中获取。- 参见:
-
PROPERTIES
static final int PROPERTIESinfoflags参数中的此标志表示图像的属性现在可用。- 参见:
-
SOMEBITS
static final int SOMEBITSinfoflags参数中的此标志表示用于绘制图像的缩放变体所需的更多像素现已可用。新像素的边界框可以从imageUpdate回调方法的x、y、width和height参数中获取。- 参见:
-
FRAMEBITS
static final int FRAMEBITSinfoflags参数中的此标志表示先前绘制的多帧图像的另一个完整帧现在可用于再次绘制。应忽略imageUpdate回调方法的x、y、width和height参数。- 参见:
-
ALLBITS
static final int ALLBITSinfoflags参数中的此标志表示先前绘制的静态图像现在已完成,可以以最终形式再次绘制。应忽略imageUpdate回调方法的x、y、width和height参数。- 参见:
-
ERROR
static final int ERRORinfoflags参数中的此标志表示正在异步跟踪的图像遇到错误。不会再提供更多信息,绘制图像将失败。为方便起见,同时将指示ABORT标志,以指示图像生成已中止。- 参见:
-
ABORT
static final int ABORTinfoflags参数中的此标志表示正在异步跟踪的图像在生成完成之前已中止。不会再提供更多信息,除非采取进一步操作来触发另一个图像生成序列。如果在此图像更新中未设置ERROR标志,则访问图像中的任何数据将重新启动生成过程,可能从头开始。- 参见:
-
-
Method Details
-
imageUpdate
当有关先前使用异步接口请求的图像的信息变得可用时,将调用此方法。异步接口是诸如getWidth(ImageObserver)和drawImage(img, x, y, ImageObserver)之类的方法调用,这些方法将ImageObserver对象作为参数。这些方法将调用者注册为对图像本身的信息感兴趣(在getWidth(ImageObserver)的情况下)或对图像的输出版本感兴趣(在drawImage(img, x, y, [w, h,] ImageObserver)调用的情况下)。如果需要进一步更新,则此方法应返回true;如果已获取所需信息,则返回false。正在跟踪的图像通过img参数传递。各种常量组合形成infoflags参数,指示有关图像的哪些信息现在可用。x、y、width和height参数的解释取决于infoflags参数的内容。
infoflags参数应是以下标志的按位包含OR运算结果:WIDTH、HEIGHT、PROPERTIES、SOMEBITS、FRAMEBITS、ALLBITS、ERROR、ABORT。- 参数:
-
img- 被观察的图像。 -
infoflags- 以下标志的按位包含OR运算结果:WIDTH、HEIGHT、PROPERTIES、SOMEBITS、FRAMEBITS、ALLBITS、ERROR、ABORT。 -
x- x坐标。 -
y- y坐标。 -
width- 宽度。 -
height- 高度。 - 返回:
-
如果infoflags指示图像已完全加载,则返回
false;否则返回true。 - 参见:
-