protected class Component.FlipBufferStrategy extends BufferStrategy
Canvas或Window 。
Canvas , Window , BufferStrategy
| Modifier and Type | Field and Description |
|---|---|
protected BufferCapabilities |
caps
缓冲功能
|
protected Image |
drawBuffer
绘图缓冲区
|
protected VolatileImage |
drawVBuffer
绘图缓冲区作为易失性图像
|
protected int |
numBuffers
缓冲区的数量
|
protected boolean |
validatedContents
绘图缓冲区是否最近从丢失状态恢复。
|
| Modifier | Constructor and Description |
|---|---|
protected |
FlipBufferStrategy(int numBuffers, BufferCapabilities caps)
为此组件创建一个新的翻转缓冲区策略。
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contentsLost()
返回自上次调用
getDrawGraphics以来绘图缓冲区是否丢失。
|
boolean |
contentsRestored()
返回绘图缓冲区是否最近从丢失状态恢复并重新初始化为默认背景颜色(白色)。
|
protected void |
createBuffers(int numBuffers, BufferCapabilities caps)
使用给定的功能创建一个或多个复杂的翻转缓冲区。
|
protected void |
destroyBuffers()
破坏通过此对象创建的缓冲区
|
void |
dispose()
释放此
BufferStrategy系统资源,并将其从关联的组件中删除。
|
protected void |
flip(BufferCapabilities.FlipContents flipAction)
翻转通过复制或移动视频指针将后缓冲区的内容移动到前缓冲区。
|
protected Image |
getBackBuffer() |
BufferCapabilities |
getCapabilities()
返回这个
BufferCapabilities的
BufferStrategy 。
|
Graphics |
getDrawGraphics()
为绘图缓冲区创建一个图形上下文。
|
protected void |
revalidate()
如果绘图缓冲区丢失,则还原它
|
void |
show()
使下一个可用的缓冲区可以被blitting或flipping看到。
|
protected int numBuffers
protected BufferCapabilities caps
protected Image drawBuffer
protected VolatileImage drawVBuffer
protected boolean validatedContents
protected FlipBufferStrategy(int numBuffers,
BufferCapabilities caps)
throws AWTException
Canvas或Window 。
numBuffers - 缓冲区的数量
caps - 缓冲区的功能
AWTException - 如果提供的功能不能被支持或满足
ClassCastException - 如果组件不是画布或窗口。
IllegalStateException - 如果组件没有对等体
IllegalArgumentException - 如果
numBuffers小于2,或
BufferCapabilities.isPageFlipping不是
true 。
Canvas , Window , createBuffers(int, BufferCapabilities)
protected void createBuffers(int numBuffers,
BufferCapabilities caps)
throws AWTException
numBuffers - 要创建的缓冲区数;
必须大于1
caps - 缓冲区的功能。
BufferCapabilities.isPageFlipping必须是true 。
AWTException - 如果提供的功能不能被支持或满足
IllegalStateException - 如果组件没有对等体
IllegalArgumentException - 如果numBuffers小于2,或
BufferCapabilities.isPageFlipping不是
true 。
BufferCapabilities.isPageFlipping()
protected Image getBackBuffer()
IllegalStateException - 如果缓冲区尚未创建
protected void flip(BufferCapabilities.FlipContents flipAction)
flipAction - 描述后台缓冲区内容的翻转动作的整数值。
这应该是BufferCapabilities.FlipContents属性的值之一。
IllegalStateException - 如果尚未创建缓冲区
BufferCapabilities.getFlipContents()
protected void destroyBuffers()
public BufferCapabilities getCapabilities()
BufferStrategy复制
BufferCapabilities的
BufferStrategy 。
getCapabilities在类别
BufferStrategy
public Graphics getDrawGraphics()
BufferStrategy复制
getDrawGraphics在类别
BufferStrategy
protected void revalidate()
public boolean contentsLost()
BufferStrategy复制
getDrawGraphics以来绘图缓冲区是否丢失。
由于缓冲区策略中的缓冲区通常是VolatileImage ,它们可能会丢失。
有关丢失缓冲区的讨论,请参见VolatileImage 。
contentsLost在类别
BufferStrategy
getDrawGraphics以来,绘图缓冲区是否丢失
VolatileImage
public boolean contentsRestored()
BufferStrategy复制
VolatileImage ,它们可能会丢失。
如果自上次呼叫getDrawGraphics以来,表面最近已经从丢失的状态恢复,则可能需要重新绘制。
有关丢失缓冲区的讨论,请参见VolatileImage 。
contentsRestored在类别
BufferStrategy
VolatileImage
public void show()
show在类别
BufferStrategy
public void dispose()
BufferStrategy当前BufferStrategy系统资源,并将其从关联的组件中删除。
调用此方法后, getBufferStrategy将返回null。
在BufferStrategy之后尝试使用BufferStrategy将导致未定义的行为。
dispose在
BufferStrategy
Window.createBufferStrategy(int) ,
Canvas.createBufferStrategy(int) ,
Window.getBufferStrategy() ,
Canvas.getBufferStrategy()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.