Class AbstractVisionBufferedComponent

All Implemented Interfaces:
DynamicPropertyProvider, LocaleListener, MutableDynamicPropertyProvider, StyleProvider, ComponentLifecycle, QualityMonitor, VisionComponent, ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
PMIPipe, PMIPipeJoint

public abstract class AbstractVisionBufferedComponent extends AbstractVisionComponent
This class is a subclass of AbstractFPMIComponent that provides the basic bookeeping required for creating a cached, buffered component. That is, a component that draws itself to a BufferedImage when something has changed, and then uses that buffered image in paintComponent(). Make sure that your component properly uses isOpaque() so that you get the correct type of buffered image used.
See Also:
  • Field Details

    • cacheValid

      protected transient boolean cacheValid
    • cachedImg

      protected transient BufferedImage cachedImg
    • rect

      protected transient Rectangle rect
    • useAlphaEnabledImage

      protected boolean useAlphaEnabledImage
      Set this to true to enable the use of a BufferedImage with INT_ARGB color model
  • Constructor Details

    • AbstractVisionBufferedComponent

      public AbstractVisionBufferedComponent()
  • Method Details

    • paintComponent

      protected void paintComponent(Graphics g)
      Overrides:
      paintComponent in class AbstractVisionComponent
    • drawBuffer

      protected abstract void drawBuffer(Graphics2D g, int width, int height)
      Subclasses only need to implement this function to have buffered functionality. If anything changes about the component (besides component size), such as colors or line thicknesses, call invalidateBuffer() to ensure this is called again on the next repaint
      Parameters:
      g - A graphics object that will paint onto the off-screen buffer
    • invalidateBuffer

      protected void invalidateBuffer()
    • repaintAndInvalidateBuffer

      protected void repaintAndInvalidateBuffer()